Parcourir la source

Fix filters not applying to modded entries

Signed-off-by: shedaniel <daniel@shedaniel.me>
shedaniel il y a 4 ans
Parent
commit
1a1eb41dc7

+ 11 - 10
RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsInitializer.java

@@ -33,7 +33,7 @@ import net.fabricmc.loader.api.VersionParsingException;
 
 import java.lang.reflect.InvocationTargetException;
 
-public class RoughlyEnoughItemsInitializer implements ModInitializer {
+public class RoughlyEnoughItemsInitializer implements ModInitializer, ClientModInitializer {
     @Override
     public void onInitialize() {
         checkRequiredFabricModules();
@@ -44,17 +44,18 @@ public class RoughlyEnoughItemsInitializer implements ModInitializer {
         
         if (RoughlyEnoughItemsState.getErrors().isEmpty()) {
             initializeEntryPoint("me.shedaniel.rei.RoughlyEnoughItemsNetwork");
-            
-            if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
-                initializeEntryPoint("me.shedaniel.rei.RoughlyEnoughItemsCore");
-                initializeEntryPoint("me.shedaniel.rei.impl.ClientHelperImpl");
-                initializeEntryPoint("me.shedaniel.rei.impl.ScreenHelper");
-            }
         }
-        
-        if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
-            initializeEntryPoint("me.shedaniel.rei.impl.ErrorDisplayer");
+    }
+    
+    @Override
+    public void onInitializeClient() {
+        if (RoughlyEnoughItemsState.getErrors().isEmpty()) {
+            initializeEntryPoint("me.shedaniel.rei.RoughlyEnoughItemsCore");
+            initializeEntryPoint("me.shedaniel.rei.impl.ClientHelperImpl");
+            initializeEntryPoint("me.shedaniel.rei.impl.ScreenHelper");
         }
+        
+        initializeEntryPoint("me.shedaniel.rei.impl.ErrorDisplayer");
     }
     
     public void initializeEntryPoint(String className) {

+ 3 - 0
RoughlyEnoughItems-runtime/src/main/resources/fabric.mod.json

@@ -18,6 +18,9 @@
     "main": [
       "me.shedaniel.rei.RoughlyEnoughItemsInitializer"
     ],
+    "client": [
+      "me.shedaniel.rei.RoughlyEnoughItemsInitializer"
+    ],
     "modmenu": [
       "me.shedaniel.rei.REIModMenuEntryPoint"
     ],