From 12bc14d5ea17f2733d419d30c7fb473b273e2504 Mon Sep 17 00:00:00 2001 From: Pilzinsel64 Date: Wed, 8 Jan 2025 06:49:14 +0100 Subject: [PATCH] only register NeiHandler on client --- src/main/java/com/zerofall/ezstorage/nei/NeiHandler.java | 5 +++++ .../java/com/zerofall/ezstorage/proxy/ClientProxy.java | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/zerofall/ezstorage/nei/NeiHandler.java b/src/main/java/com/zerofall/ezstorage/nei/NeiHandler.java index 5557060..dc4f686 100644 --- a/src/main/java/com/zerofall/ezstorage/nei/NeiHandler.java +++ b/src/main/java/com/zerofall/ezstorage/nei/NeiHandler.java @@ -5,12 +5,17 @@ import com.zerofall.ezstorage.gui.GuiStorageCore; +import codechicken.nei.guihook.GuiContainerManager; import codechicken.nei.guihook.IContainerObjectHandler; import cpw.mods.fml.common.Optional.Interface; @Interface(iface = "codechicken.nei.guihook.IContainerObjectHandler", modid = "NotEnoughItems") public class NeiHandler implements IContainerObjectHandler { + public static void init() { + GuiContainerManager.addObjectHandler(new NeiHandler()); + } + @Override public void guiTick(GuiContainer gui) {} diff --git a/src/main/java/com/zerofall/ezstorage/proxy/ClientProxy.java b/src/main/java/com/zerofall/ezstorage/proxy/ClientProxy.java index 97a47dd..0952a3c 100644 --- a/src/main/java/com/zerofall/ezstorage/proxy/ClientProxy.java +++ b/src/main/java/com/zerofall/ezstorage/proxy/ClientProxy.java @@ -3,7 +3,7 @@ import com.zerofall.ezstorage.EZStorage; import com.zerofall.ezstorage.nei.NeiHandler; -import codechicken.nei.guihook.GuiContainerManager; +import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.event.FMLInitializationEvent; public class ClientProxy extends CommonProxy { @@ -11,6 +11,9 @@ public class ClientProxy extends CommonProxy { @Override public void init(EZStorage instance, FMLInitializationEvent event) { super.init(instance, event); - GuiContainerManager.addObjectHandler(new NeiHandler()); + + if (Loader.isModLoaded("NotEnoughItems")) { + NeiHandler.init(); + } } }