Skip to content

Commit

Permalink
implement proper REI hiding for unified items
Browse files Browse the repository at this point in the history
  • Loading branch information
rlnt committed Oct 28, 2022
1 parent 56a6e4c commit 7c376e5
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.almostreliable.unified.recipe.ClientRecipeTracker.ClientRecipeLink;
import com.almostreliable.unified.utils.Utils;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.entry.filtering.base.BasicFilteringRule;
import me.shedaniel.rei.api.client.gui.DisplayRenderer;
import me.shedaniel.rei.api.client.gui.widgets.Widget;
import me.shedaniel.rei.api.client.gui.widgets.Widgets;
Expand All @@ -17,7 +18,6 @@
import me.shedaniel.rei.api.client.registry.category.extension.CategoryExtensionProvider;
import me.shedaniel.rei.api.client.registry.display.DisplayCategory;
import me.shedaniel.rei.api.client.registry.display.DisplayCategoryView;
import me.shedaniel.rei.api.client.registry.entry.EntryRegistry;
import me.shedaniel.rei.api.common.display.Display;
import me.shedaniel.rei.api.common.plugins.PluginManager;
import me.shedaniel.rei.api.common.registry.ReloadStage;
Expand All @@ -31,14 +31,14 @@
public class AlmostREI implements REIClientPlugin {

@Override
public void registerEntries(EntryRegistry registry) {
public void registerBasicEntryFiltering(BasicFilteringRule<?> rule) {
// REI compat layer will automatically hide entries for Forge through JEI
if (AlmostUnifiedPlatform.INSTANCE.getPlatform() == Platform.FORGE) return;

UnifyConfig config = Config.load(UnifyConfig.NAME, new UnifyConfig.Serializer());
if (config.reiOrJeiDisabled()) return;

HideHelper.createHidingList(config).stream().map(EntryStacks::of).forEach(registry::removeEntry);
HideHelper.createHidingList(config).stream().map(EntryStacks::of).forEach(rule::hide);
}

@Override
Expand Down
3 changes: 3 additions & 0 deletions Fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@
"fabric": "*",
"minecraft": ">=${minecraftVersion}",
"java": ">=17"
},
"suggests": {
"roughlyenoughitems": ">=${reiMinVersion}"
}
}
7 changes: 7 additions & 0 deletions Forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,10 @@ mandatory = true
versionRange = "[1.18,1.19)"
ordering = "NONE"
side = "BOTH"

[[dependencies.${modId}]]
modId = "roughlyenoughitems"
mandatory = false
versionRange = "[${reiMinVersion},)"
ordering = "BEFORE"
side = "BOTH"
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ val license: String by project
val extraModsDirectory: String by project
val minecraftVersion: String by project
val forgeMinVersion: String by project
val reiMinVersion: String by project
val githubUser: String by project
val githubRepo: String by project

Expand Down Expand Up @@ -70,6 +71,7 @@ subprojects {
"license" to license,
"minecraftVersion" to minecraftVersion,
"forgeMinVersion" to forgeMinVersion,
"reiMinVersion" to reiMinVersion,
"githubUser" to githubUser,
"githubRepo" to githubRepo
)
Expand Down
5 changes: 3 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ junitVersion = 5.9.0

# Runtime Settings
extraModsDirectory = extra-mods
forgeRecipeViewer = jei
forgeRecipeViewer = rei

# Common
minecraftVersion = 1.18.2
Expand All @@ -26,7 +26,8 @@ fabricVersion = 0.59.0+1.18.2
fabricLoaderVersion = 0.14.9

# Dependencies
reiVersion = 8+
reiVersion = 8.3.557
reiMinVersion = 8.3.557
jeiVersion = 9+
kubejsVersion = 1802.5.5-build.550

Expand Down

0 comments on commit 7c376e5

Please sign in to comment.