aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/build.gradle2
-rw-r--r--default-plugin/build.gradle2
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/common/displays/anvil/AnvilRecipe.java40
-rw-r--r--fabric/src/main/java/me/shedaniel/rei/fabric/RoughlyEnoughItemsInitializerImpl.java7
-rw-r--r--fabric/src/main/java/me/shedaniel/rei/impl/client/fabric/ErrorDisplayerImpl.java38
-rw-r--r--fabric/src/main/java/me/shedaniel/rei/mixin/fabric/MixinScreen.java44
-rw-r--r--fabric/src/main/resources/fabric.mod.json3
-rw-r--r--fabric/src/main/resources/rei.mixins.json14
-rw-r--r--forge/build.gradle2
-rw-r--r--forge/src/main/java/me/shedaniel/rei/forge/JEIStub.java31
-rw-r--r--forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsInitializerImpl.java15
-rw-r--r--forge/src/main/java/me/shedaniel/rei/impl/client/forge/ErrorDisplayerImpl.java33
-rw-r--r--forge/src/main/resources/META-INF/mods.toml16
-rw-r--r--runtime/build.gradle2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsInitializer.java8
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsState.java9
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/ErrorDisplayer.java12
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java6
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/common/entry/AbstractEntryStack.java2
19 files changed, 266 insertions, 20 deletions
diff --git a/api/build.gradle b/api/build.gradle
index 44fe15010..40ea8f83d 100644
--- a/api/build.gradle
+++ b/api/build.gradle
@@ -1,3 +1,5 @@
+archivesBaseName = rootProject.name + "-" + project.name
+
dependencies {
modCompileOnly("net.fabricmc:fabric-loader:${project.fabricloader_version}")
modCompileOnly("me.shedaniel.cloth:cloth-config:${cloth_config_version}")
diff --git a/default-plugin/build.gradle b/default-plugin/build.gradle
index 6dcf4d550..ae1d0cabd 100644
--- a/default-plugin/build.gradle
+++ b/default-plugin/build.gradle
@@ -1,3 +1,5 @@
+archivesBaseName = rootProject.name + "-" + project.name
+
loom {
accessWidener = gradle.rootProject.project("fabric").file("src/main/resources/roughlyenoughitems.accessWidener")
}
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/displays/anvil/AnvilRecipe.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/displays/anvil/AnvilRecipe.java
new file mode 100644
index 000000000..550199a62
--- /dev/null
+++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/displays/anvil/AnvilRecipe.java
@@ -0,0 +1,40 @@
+/*
+ * This file is licensed under the MIT License, part of Roughly Enough Items.
+ * Copyright (c) 2018, 2019, 2020, 2021 shedaniel
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package me.shedaniel.rei.plugin.common.displays.anvil;
+
+import net.minecraft.world.item.ItemStack;
+
+import java.util.List;
+
+public class AnvilRecipe {
+ private final List<ItemStack> leftInput;
+ private final List<ItemStack> rightInputs;
+ private final List<ItemStack> outputs;
+
+ public AnvilRecipe(List<ItemStack> leftInput, List<ItemStack> rightInputs, List<ItemStack> outputs) {
+ this.leftInput = leftInput;
+ this.rightInputs = rightInputs;
+ this.outputs = outputs;
+ }
+}
diff --git a/fabric/src/main/java/me/shedaniel/rei/fabric/RoughlyEnoughItemsInitializerImpl.java b/fabric/src/main/java/me/shedaniel/rei/fabric/RoughlyEnoughItemsInitializerImpl.java
index d7200f47c..47f671dc0 100644
--- a/fabric/src/main/java/me/shedaniel/rei/fabric/RoughlyEnoughItemsInitializerImpl.java
+++ b/fabric/src/main/java/me/shedaniel/rei/fabric/RoughlyEnoughItemsInitializerImpl.java
@@ -57,6 +57,9 @@ public class RoughlyEnoughItemsInitializerImpl {
break;
}
}
+ if (!FabricLoader.getInstance().isModLoaded("architectury")) {
+ RoughlyEnoughItemsState.error("Architectury API is not installed!", "https://www.curseforge.com/minecraft/mc-mods/architectury-fabric/files/all");
+ }
if (isClient()) {
try {
if (!FabricLoader.getInstance().isModLoaded("cloth-config2")) {
@@ -69,4 +72,8 @@ public class RoughlyEnoughItemsInitializerImpl {
}
}
}
+
+ public static boolean isDev() {
+ return FabricLoader.getInstance().isDevelopmentEnvironment();
+ }
}
diff --git a/fabric/src/main/java/me/shedaniel/rei/impl/client/fabric/ErrorDisplayerImpl.java b/fabric/src/main/java/me/shedaniel/rei/impl/client/fabric/ErrorDisplayerImpl.java
new file mode 100644
index 000000000..ae6a0f9f3
--- /dev/null
+++ b/fabric/src/main/java/me/shedaniel/rei/impl/client/fabric/ErrorDisplayerImpl.java
@@ -0,0 +1,38 @@
+/*
+ * This file is licensed under the MIT License, part of Roughly Enough Items.
+ * Copyright (c) 2018, 2019, 2020, 2021 shedaniel
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package me.shedaniel.rei.impl.client.fabric;
+
+import net.minecraft.client.gui.screens.Screen;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.function.Consumer;
+
+public class ErrorDisplayerImpl {
+ public static List<Consumer<Screen>> consumerList = new ArrayList<>();
+
+ public static void registerGuiInit(Consumer<Screen> consumer) {
+ consumerList.add(consumer);
+ }
+}
diff --git a/fabric/src/main/java/me/shedaniel/rei/mixin/fabric/MixinScreen.java b/fabric/src/main/java/me/shedaniel/rei/mixin/fabric/MixinScreen.java
new file mode 100644
index 000000000..a14577a7f
--- /dev/null
+++ b/fabric/src/main/java/me/shedaniel/rei/mixin/fabric/MixinScreen.java
@@ -0,0 +1,44 @@
+/*
+ * This file is licensed under the MIT License, part of Roughly Enough Items.
+ * Copyright (c) 2018, 2019, 2020, 2021 shedaniel
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package me.shedaniel.rei.mixin.fabric;
+
+import me.shedaniel.rei.impl.client.fabric.ErrorDisplayerImpl;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.screens.Screen;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+import java.util.function.Consumer;
+
+@Mixin(Screen.class)
+public class MixinScreen {
+ @Inject(method = "init(Lnet/minecraft/client/Minecraft;II)V", at = @At("HEAD"))
+ private void init(Minecraft minecraft, int i, int j, CallbackInfo ci) {
+ for (Consumer<Screen> consumer : ErrorDisplayerImpl.consumerList) {
+ consumer.accept((Screen) (Object) this);
+ }
+ }
+}
diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json
index bf7bf3d6b..3f1c179a0 100644
--- a/fabric/src/main/resources/fabric.mod.json
+++ b/fabric/src/main/resources/fabric.mod.json
@@ -29,6 +29,9 @@
]
},
"accessWidener": "roughlyenoughitems.accessWidener",
+ "mixins": [
+ "rei.mixins.json"
+ ],
"custom": {
"rei:translators": {
"English": ["shedaniel"],
diff --git a/fabric/src/main/resources/rei.mixins.json b/fabric/src/main/resources/rei.mixins.json
new file mode 100644
index 000000000..b7d1e7c81
--- /dev/null
+++ b/fabric/src/main/resources/rei.mixins.json
@@ -0,0 +1,14 @@
+{
+ "required": true,
+ "package": "me.shedaniel.rei.mixin.fabric",
+ "compatibilityLevel": "JAVA_8",
+ "client": [
+ "MixinScreen"
+ ],
+ "mixins": [
+ ],
+ "injectors": {
+ "maxShiftBy": 5,
+ "defaultRequire": 1
+ }
+}
diff --git a/forge/build.gradle b/forge/build.gradle
index c7ccec31c..dd119678f 100644
--- a/forge/build.gradle
+++ b/forge/build.gradle
@@ -57,6 +57,8 @@ dependencies {
modRuntime("appeng:appliedenergistics2:8.2.0")
modRuntime("curse.maven:tcon-74072:3273213")
modRuntime("curse.maven:mantle-74924:3273201")
+ modRuntime("curse.maven:jer-240630:3066754")
+ modRuntime("curse.maven:jep-417645:3198370")
}
shadowJar {
diff --git a/forge/src/main/java/me/shedaniel/rei/forge/JEIStub.java b/forge/src/main/java/me/shedaniel/rei/forge/JEIStub.java
new file mode 100644
index 000000000..de0c34314
--- /dev/null
+++ b/forge/src/main/java/me/shedaniel/rei/forge/JEIStub.java
@@ -0,0 +1,31 @@
+/*
+ * This file is licensed under the MIT License, part of Roughly Enough Items.
+ * Copyright (c) 2018, 2019, 2020, 2021 shedaniel
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package me.shedaniel.rei.forge;
+
+import net.minecraftforge.fml.common.Mod;
+
+// Hello mods, JEI is present!! Please give in and trust me!
+@Mod("jei")
+public class JEIStub {
+}
diff --git a/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsInitializerImpl.java b/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsInitializerImpl.java
index 45b4e39a7..6baa7fd5c 100644
--- a/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsInitializerImpl.java
+++ b/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsInitializerImpl.java
@@ -23,10 +23,9 @@
package me.shedaniel.rei.forge;
-import me.shedaniel.rei.RoughlyEnoughItemsState;
import net.minecraftforge.api.distmarker.Dist;
-import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.loading.FMLEnvironment;
+import net.minecraftforge.fml.loading.FMLLoader;
public class RoughlyEnoughItemsInitializerImpl {
public static boolean isClient() {
@@ -34,13 +33,9 @@ public class RoughlyEnoughItemsInitializerImpl {
}
public static void checkMods() {
- if (ModList.get().isLoaded("jei")) {
- RoughlyEnoughItemsState.error("JEI is installed! REI is an replacement of JEI, we can't co-exist!");
- }
- if (isClient()) {
- if (!ModList.get().isLoaded("cloth-config")) {
- RoughlyEnoughItemsState.error("Cloth Config is not installed!", "https://www.curseforge.com/minecraft/mc-mods/cloth-config/files/all");
- }
- }
+ }
+
+ public static boolean isDev() {
+ return !FMLLoader.isProduction();
}
}
diff --git a/forge/src/main/java/me/shedaniel/rei/impl/client/forge/ErrorDisplayerImpl.java b/forge/src/main/java/me/shedaniel/rei/impl/client/forge/ErrorDisplayerImpl.java
new file mode 100644
index 000000000..5186c7884
--- /dev/null
+++ b/forge/src/main/java/me/shedaniel/rei/impl/client/forge/ErrorDisplayerImpl.java
@@ -0,0 +1,33 @@
+/*
+ * This file is licensed under the MIT License, part of Roughly Enough Items.
+ * Copyright (c) 2018, 2019, 2020, 2021 shedaniel
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package me.shedaniel.rei.impl.client.forge;
+
+import net.minecraft.client.gui.screens.Screen;
+
+import java.util.function.Consumer;
+
+public class ErrorDisplayerImpl {
+ public static void registerGuiInit(Consumer<Screen> consumer) {
+ }
+}
diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml
index 74fa66012..6aebf09b4 100644
--- a/forge/src/main/resources/META-INF/mods.toml
+++ b/forge/src/main/resources/META-INF/mods.toml
@@ -4,6 +4,7 @@ issueTrackerURL = "https://github.com/shedaniel/RoughlyEnoughItems/issues"
logoFile = "icon.png"
authors = "shedaniel"
license = "MIT"
+
[[mods]]
modId = "roughlyenoughitems"
version = "${version}"
@@ -12,9 +13,24 @@ description = '''
To allow players to view items and recipes.
'''
+[[mods]]
+modId = "jei"
+version = "7.9999"
+displayName = "Roughly Enough Items (JEI Stub)"
+description = '''
+To allow players to view items and recipes.
+'''
+
[[dependencies.roughlyenoughitems]]
modId = "architectury"
mandatory = true
versionRange = "[1.10.139,)"
ordering = "NONE"
side = "BOTH"
+
+[[dependencies.roughlyenoughitems]]
+modId = "cloth-config"
+mandatory = true
+versionRange = "[4.11.18,)"
+ordering = "NONE"
+side = "BOTH"
diff --git a/runtime/build.gradle b/runtime/build.gradle
index 3048fb3b7..4d7034ed3 100644
--- a/runtime/build.gradle
+++ b/runtime/build.gradle
@@ -1,3 +1,5 @@
+archivesBaseName = rootProject.name + "-" + project.name
+
architectury {
common(forgeEnabled.toBoolean())
}
diff --git a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsInitializer.java b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsInitializer.java
index 8ba328334..78f118501 100644
--- a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsInitializer.java
+++ b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsInitializer.java
@@ -24,12 +24,15 @@
package me.shedaniel.rei;
import me.shedaniel.architectury.annotations.ExpectPlatform;
+import net.fabricmc.api.EnvType;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class RoughlyEnoughItemsInitializer {
public static void onInitialize() {
+ RoughlyEnoughItemsState.env = isClient() ? EnvType.CLIENT : EnvType.SERVER;
+ RoughlyEnoughItemsState.isDev = isDev();
checkMods();
if (RoughlyEnoughItemsState.getErrors().isEmpty()) {
@@ -83,6 +86,11 @@ public class RoughlyEnoughItemsInitializer {
}
@ExpectPlatform
+ public static boolean isDev() {
+ throw new AssertionError();
+ }
+
+ @ExpectPlatform
public static void checkMods() {
throw new AssertionError();
}
diff --git a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsState.java b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsState.java
index 468ac0988..7ca37778f 100644
--- a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsState.java
+++ b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsState.java
@@ -23,8 +23,7 @@
package me.shedaniel.rei;
-import me.shedaniel.architectury.platform.Platform;
-import me.shedaniel.architectury.utils.Env;
+import net.fabricmc.api.EnvType;
import net.minecraft.util.Tuple;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -41,6 +40,8 @@ public class RoughlyEnoughItemsState {
public static final Logger LOGGER = LogManager.getFormatterLogger("REI");
+ public static EnvType env;
+ public static boolean isDev;
private static List<Tuple<String, String>> errors = new ArrayList<>();
private static List<Tuple<String, String>> warnings = new ArrayList<>();
private static Set<String> errorSet = new LinkedHashSet<>();
@@ -48,7 +49,7 @@ public class RoughlyEnoughItemsState {
private static List<Runnable> continueCallbacks = new ArrayList<>();
public static void error(String reason) {
- if (Platform.getEnvironment() == Env.SERVER || Platform.isDevelopmentEnvironment())
+ if (env == EnvType.SERVER || isDev)
throw new RuntimeException(reason);
if (RoughlyEnoughItemsState.errorSet.add(reason + " " + null)) {
RoughlyEnoughItemsState.errors.add(new Tuple<>(reason, null));
@@ -57,7 +58,7 @@ public class RoughlyEnoughItemsState {
}
public static void error(String reason, String link) {
- if (Platform.getEnvironment() == Env.SERVER || Platform.isDevelopmentEnvironment())
+ if (env == EnvType.SERVER || isDev)
throw new RuntimeException(reason + " " + link);
if (RoughlyEnoughItemsState.errorSet.add(reason + " " + link)) {
RoughlyEnoughItemsState.errors.add(new Tuple<>(reason, link));
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/ErrorDisplayer.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/ErrorDisplayer.java
index e007f0ec8..b9e512bc9 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/client/ErrorDisplayer.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/ErrorDisplayer.java
@@ -23,15 +23,19 @@
package me.shedaniel.rei.impl.client;
+import me.shedaniel.architectury.annotations.ExpectPlatform;
import me.shedaniel.architectury.event.events.GuiEvent;
import me.shedaniel.rei.RoughlyEnoughItemsState;
import me.shedaniel.rei.impl.client.gui.screen.WarningAndErrorScreen;
import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.screens.Screen;
import net.minecraft.world.InteractionResult;
+import java.util.function.Consumer;
+
public class ErrorDisplayer {
public void onInitializeClient() {
- GuiEvent.INIT_PRE.register((screen, widgets, children) -> {
+ registerGuiInit((screen) -> {
Minecraft minecraft = Minecraft.getInstance();
if ((!RoughlyEnoughItemsState.getErrors().isEmpty() || !RoughlyEnoughItemsState.getWarnings().isEmpty()) && !(screen instanceof WarningAndErrorScreen)) {
WarningAndErrorScreen warningAndErrorScreen = new WarningAndErrorScreen("initialization", RoughlyEnoughItemsState.getWarnings(), RoughlyEnoughItemsState.getErrors(), (parent) -> {
@@ -51,7 +55,11 @@ public class ErrorDisplayer {
minecraft.screen = null;
minecraft.setScreen(warningAndErrorScreen);
}
- return InteractionResult.PASS;
});
}
+
+ @ExpectPlatform
+ public static void registerGuiInit(Consumer<Screen> consumer) {
+ throw new AssertionError();
+ }
}
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java
index 8d2f2b05b..9279a7f51 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java
@@ -383,11 +383,11 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData {
@Override
public boolean isJEICompatibilityLayerEnabled() {
- return Platform.isForge() && advanced.jeiCompatibilityLayer;
+ return Platform.isForge() && advanced.enableJeiCompatibilityLayer;
}
public void setJEICompatibilityLayerEnabled(boolean value) {
- advanced.jeiCompatibilityLayer = value;
+ advanced.enableJeiCompatibilityLayer = value;
}
@Retention(RetentionPolicy.RUNTIME)
@@ -493,7 +493,7 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData {
@ConfigEntry.Gui.CollapsibleObject(startExpanded = true)
public Filtering filtering = new Filtering();
@ConfigEntry.Gui.Excluded
- public boolean jeiCompatibilityLayer = false;
+ public boolean enableJeiCompatibilityLayer = true;
public static class Tooltips {
@Comment("Declares whether REI should append mod names to entries.") private boolean appendModNames = true;
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/AbstractEntryStack.java b/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/AbstractEntryStack.java
index 0a1c57a9a..8c52a7614 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/AbstractEntryStack.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/AbstractEntryStack.java
@@ -156,7 +156,7 @@ public abstract class AbstractEntryStack<A> extends AbstractRenderer implements
public Tooltip getTooltip(Point mouse, boolean appendModName) {
Mutable<Tooltip> tooltip = new MutableObject<>(getRenderer().<A>cast().getTooltip(this, mouse));
if (tooltip.getValue() == null) return null;
- tooltip.getValue().getText().addAll(get(EntryStack.Settings.TOOLTIP_APPEND_EXTRA).apply(this));
+ tooltip.getValue().getText().addAll(get(Settings.TOOLTIP_APPEND_EXTRA).apply(this));
tooltip.setValue(get(Settings.TOOLTIP_PROCESSOR).apply(this, tooltip.getValue()));
if (tooltip.getValue() == null) return null;
if (appendModName) {