From 53e0de06244bd18a45ad940c71d81699e8e81946 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Sat, 19 Jul 2025 02:27:00 +0200 Subject: [PATCH] remove reflection after ismodloaded check (#190) --- .../java/tconstruct/client/tabs/TabRegistry.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/main/java/tconstruct/client/tabs/TabRegistry.java b/src/main/java/tconstruct/client/tabs/TabRegistry.java index 57673298..90c05f41 100644 --- a/src/main/java/tconstruct/client/tabs/TabRegistry.java +++ b/src/main/java/tconstruct/client/tabs/TabRegistry.java @@ -9,6 +9,7 @@ import net.minecraft.network.play.client.C0DPacketCloseWindow; import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.common.MinecraftForge; +import codechicken.nei.NEIClientConfig; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.eventhandler.SubscribeEvent; @@ -65,15 +66,9 @@ public class TabRegistry { if (!mc.thePlayer.getActivePotionEffects().isEmpty()) { if (Loader.isModLoaded("NotEnoughItems")) { try { - // Check whether NEI is hidden and enabled - Class c = Class.forName("codechicken.nei.NEIClientConfig"); - Object hidden = c.getMethod("isHidden").invoke(null); - Object enabled = c.getMethod("isEnabled").invoke(null); - if (hidden instanceof Boolean && enabled instanceof Boolean) { - if ((Boolean) hidden || !((Boolean) enabled)) { - // If NEI is disabled or hidden, offset the tabs by 60 - return 60; - } + if (NEIClientConfig.isHidden() || !NEIClientConfig.isEnabled()) { + // If NEI is disabled or hidden, offset the tabs by 60 + return 60; } } catch (Exception ignored) {} } else { @@ -81,7 +76,6 @@ public class TabRegistry { return 60; } } - // No potions, no offset needed return 0; }