Register inventory tabs from the client proxy, not the mod class

Deferring registration to loadComplete is right - TConstruct needs to have
registered first - but naming TabRegistry and the tab classes in CustomNpcs put
client-only GUI types in a class the server loads, which the verifier resolves
at link time regardless of any runtime side check. A proxy hook keeps them in
ClientProxy while still running at the same point.
This commit is contained in:
KAMKEEL committed 2026-08-11 05:56:08 -04:00
1 parent 74511b7449
commit c6e361f8e6
3 files changed
+25 -13

No files matched your search

@@ -854,6 +854,19 @@ public class ClientProxy extends CommonProxy {
return Minecraft.getMinecraft().currentScreen != null;
}
@Override
public void loadComplete() {
// Deferred from load() so TConstruct has registered its own tabs first - registering
// ours before it left the vanilla tab duplicated.
if (ConfigClient.InventoryGuiEnabled) {
MinecraftForge.EVENT_BUS.register(new TabRegistry());
if (TabRegistry.getTabList().isEmpty()) {
TabRegistry.registerTab(new InventoryTabVanilla());
}
TabRegistry.registerTab(new InventoryTabCustomNpc());
}
}
public void buildPackageIndex() {
try {
PackageFinder.init(Thread.currentThread().getContextClassLoader());