public void init(final FMLInitializationEvent event) { NetworkRegistry.INSTANCE.registerGuiHandler((Object)ExtraUtilsMod.instance, (IGuiHandler)new GuiHandler()); if (Loader.isModLoaded("ForgeMultipart")) { this.FMPRegisterPassThroughInterfaces(); } ExtraUtilsMod.proxy.registerEventHandler(); ExtraUtilsMod.proxy.registerRenderInformation(); if (Loader.isModLoaded("ThermalExpansion")) { TE4IMC.addIntegration(); } if (Loader.isModLoaded("MineFactoryReloaded")) { MFRIntegration.registerMFRIntegration(); } for (final ILoading loader : this.loaders) { loader.init(); } EE3Integration.finalRegister(); }
static private int nextID() { try { Field field = EnderIO.guiHandler.getClass().getDeclaredField("guiHandlers"); field.setAccessible(true); Map<Integer, IGuiHandler> guiHandlers = (Map<Integer, IGuiHandler>) field.get(EnderIO.guiHandler); while (++lastId > 0) { if (!guiHandlers.containsKey(lastId)) { return lastId; } } } catch (Exception e) { throw new RuntimeException(e); } return -1; }
@Override public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { if (id < GuiId.values().length) { switch (GuiId.values()[id]) { case SolderingIronGUI: return new GuiSolderingIron(player.inventory, new SolderingInventory()); default: for (IGuiHandler handler : PluginManager.guiHandlers) { Object element = handler.getClientGuiElement(id, player, world, x, y, z); if (element != null) return element; } return null; } } return null; }
@Override public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { if (id < GuiId.values().length) { switch (GuiId.values()[id]) { case SolderingIronGUI: return new ContainerSolderingIron(player.inventory, new SolderingInventory()); default: for (IGuiHandler handler : PluginManager.guiHandlers) { Object element = handler.getServerGuiElement(id, player, world, x, y, z); if (element != null) return element; } return null; } } return null; }
@Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z){ for(IThirdParty thirdParty : thirdPartyMods) { if(thirdParty instanceof IGuiHandler) { Object obj = ((IGuiHandler)thirdParty).getServerGuiElement(ID, player, world, x, y, z); if(obj != null) return obj; } } return null; }
@Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z){ for(IThirdParty thirdParty : thirdPartyMods) { if(thirdParty instanceof IGuiHandler) { Object obj = ((IGuiHandler)thirdParty).getClientGuiElement(ID, player, world, x, y, z); if(obj != null) return obj; } } return null; }
public static void registerGUI(IGuiHandler handler) { NetworkRegistry.INSTANCE.registerGuiHandler(RorysMod.instance, handler); }
public static void registerGUI(Object mod, IGuiHandler handler) { NetworkRegistry.INSTANCE.registerGuiHandler(mod, handler); }
public int addHandler(IGuiHandler handler) { subHandlers.add(handler); return subHandlers.size() - 1; }
IGuiHandler getHandler() { return guiHandler; }
@Override public IGuiHandler wrapHandler(IGuiHandler modSpecificHandler) { return new ClientGuiHandler(modSpecificHandler); }
@Override public IGuiHandler wrapHandler(IGuiHandler modSpecificHandler) { return new CommonGuiHandler(modSpecificHandler); }
public CommonGuiHandler(IGuiHandler wrappedHandler) { this.wrappedHandler = wrappedHandler; }
public ClientGuiHandler(IGuiHandler wrappedHandler) { super (wrappedHandler); }
@Override public IGuiHandler getGuiHandler() { return new GuiHandlerPipes(); }
@Override public IGuiHandler getGuiHandler() { return new GuiHandlerFarming(); }
@Override public IGuiHandler getGuiHandler() { return new GuiHandlerArboriculture(); }
@Override public IGuiHandler getGuiHandler() { return new GuiHandlerCultivation(); }
@Override public IGuiHandler getGuiHandler() { return new GuiHandlerFood(); }
@Override public IGuiHandler getGuiHandler() { return new GuiHandlerMail(); }
@Override public IGuiHandler getGuiHandler() { return new GuiHandlerFactory(); }
@Override public IGuiHandler getGuiHandler() { return new GuiHandlerApiculture(); }
@Override public IGuiHandler getGuiHandler() { return null; }
@Override public IGuiHandler getGuiHandler() { return new GuiHandlerEnergy(); }
@Override public IGuiHandler getGuiHandler() { return new GuiHandlerStorage(); }
public static void addPlugin(ClassLoader classLoader, String pluginName, String packageName) { if (pluginName.equals("PluginManager.class") || pluginName.equals("PluginInfo.class")) return; String pluginClassName = packageName.replace(".class", ""); try { Class<?> pluginClass = classLoader.loadClass(pluginClassName); if (pluginClass != null) { Class<?> clz = pluginClass; boolean isPlugin = false; do { for(Class<?> i : clz.getInterfaces()) { if(i == IPlugin.class) { isPlugin = true; break; } } clz = clz.getSuperclass(); } while(clz != null && !isPlugin); if(!isPlugin) return; IPlugin plugin = (IPlugin) pluginClass.newInstance(); if (plugin != null) { Proxies.log.fine("Found plugin for " + plugin.getDescription()); plugins.add(plugin); IGuiHandler guiHandler = plugin.getGuiHandler(); if (guiHandler != null) { guiHandlers.add(guiHandler); } IPacketHandler packetHandler = plugin.getPacketHandler(); if (packetHandler != null) { packetHandlers.add(packetHandler); } IPickupHandler pickupHandler = plugin.getPickupHandler(); if (pickupHandler != null) { pickupHandlers.add(pickupHandler); } ISaveEventHandler saveHandler = plugin.getSaveEventHandler(); if (saveHandler != null) { saveEventHandlers.add(saveHandler); } IResupplyHandler resupplyHandler = plugin.getResupplyHandler(); if (resupplyHandler != null) { resupplyHandlers.add(resupplyHandler); } IOreDictionaryHandler dictionaryHandler = plugin.getDictionaryHandler(); if (dictionaryHandler != null) { dictionaryHandlers.add(dictionaryHandler); } } } } catch (Exception ex) { //ex.printStackTrace(); } }
public GuiHandlerWrapper(IGuiHandler handler) { this.handler = handler; }
IGuiHandler wrapHandler(IGuiHandler modSpecificHandler);
public IGuiHandler getGuiHandler();