mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 18:49:39 +00:00
Merge pull request #290 from postyizhan: register inventory tabs after mod loading completes
This commit is contained in:
commit
3193a2bfc3
3 files changed
+25
-8
No files matched your search
@@ -225,6 +225,14 @@ public class CommonProxy implements IGuiHandler {
|
||||
public void buildPackageIndex() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called from the mod's FMLLoadCompleteEvent, after every other mod has finished loading.
|
||||
* Anything that has to observe another mod's registrations belongs here rather than in
|
||||
* load(), and it stays on the proxy so client-only types never reach the server.
|
||||
*/
|
||||
public void loadComplete() {
|
||||
}
|
||||
|
||||
public boolean isScriptingEnabled() {
|
||||
return ConfigScript.ScriptingEnabled;
|
||||
}
|
||||
|
||||
@@ -343,6 +343,10 @@ public class CustomNpcs {
|
||||
|
||||
@EventHandler
|
||||
public void loadComplete(FMLLoadCompleteEvent ev) {
|
||||
// Runs after every other mod has loaded. Kept on the proxy: the client side registers
|
||||
// inventory tabs, and naming those types here would drag client-only GUI classes into
|
||||
// a class the server loads.
|
||||
proxy.loadComplete();
|
||||
proxy.buildPackageIndex();
|
||||
|
||||
// Load built-in animations on the client so they're available for ability preview.
|
||||
|
||||
@@ -384,14 +384,6 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
// Lightning effect rendering system
|
||||
MinecraftForge.EVENT_BUS.register(new LightningHandler());
|
||||
|
||||
if (ConfigClient.InventoryGuiEnabled) {
|
||||
MinecraftForge.EVENT_BUS.register(new TabRegistry());
|
||||
if (TabRegistry.getTabList().isEmpty()) {
|
||||
TabRegistry.registerTab(new InventoryTabVanilla());
|
||||
}
|
||||
TabRegistry.registerTab(new InventoryTabCustomNpc());
|
||||
}
|
||||
}
|
||||
|
||||
public FakePlayer getCommandPlayer(IWorld world) {
|
||||
@@ -862,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());
|
||||
|
||||
Reference in new issue
Block a user