Fixed exception in conjunction with NEI integration server side. Closes #229

This commit is contained in:
SirSengir 2012-09-09 12:10:33 +02:00
parent d24b26d960
commit 585095b0c2
3 changed files with 21 additions and 18 deletions

View file

@ -8,8 +8,6 @@
package buildcraft;
import java.lang.reflect.Method;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
@ -46,7 +44,6 @@ import buildcraft.factory.TilePump;
import buildcraft.factory.TileQuarry;
import buildcraft.factory.TileRefinery;
import buildcraft.factory.TileTank;
import buildcraft.factory.gui.GuiAutoCrafting;
import buildcraft.factory.network.PacketHandlerFactory;
import buildcraft.silicon.TileLaser;
import net.minecraft.src.Block;
@ -78,16 +75,8 @@ public class BuildCraftFactory {
public static BuildCraftFactory instance;
@PostInit
public void postInit(FMLPostInitializationEvent evt)
{
try {
Class<?> neiRenderer = Class.forName("codechicken.nei.DefaultOverlayRenderer");
Method method = neiRenderer.getMethod("registerGuiOverlay", Class.class, String.class, int.class, int.class);
method.invoke(null, GuiAutoCrafting.class, "crafting", 5, 11);
BuildCraftCore.bcLog.fine("NEI detected, adding NEI overlay");
} catch (Exception e) {
BuildCraftCore.bcLog.fine("NEI not detected.");
}
public void postInit(FMLPostInitializationEvent evt) {
FactoryProxy.proxy.initializeNEIIntegration();
}
@Init
public void load(FMLInitializationEvent evt) {

View file

@ -6,9 +6,7 @@ public class FactoryProxy {
@SidedProxy(clientSide = "buildcraft.factory.FactoryProxyClient", serverSide = "buildcraft.factory.FactoryProxy")
public static FactoryProxy proxy;
public void initializeTileEntities() {
}
public void initializeEntityRenders() {
}
public void initializeTileEntities() {}
public void initializeEntityRenders() {}
public void initializeNEIIntegration() {}
}

View file

@ -1,9 +1,13 @@
package buildcraft.factory;
import java.lang.reflect.Method;
import buildcraft.BuildCraftCore;
import buildcraft.BuildCraftFactory;
import buildcraft.core.render.RenderVoid;
import buildcraft.core.render.RenderingEntityBlocks;
import buildcraft.core.render.RenderingEntityBlocks.EntityRenderIndex;
import buildcraft.factory.gui.GuiAutoCrafting;
import buildcraft.factory.render.RenderHopper;
import buildcraft.factory.render.RenderRefinery;
import buildcraft.factory.render.RenderTank;
@ -29,4 +33,16 @@ public class FactoryProxyClient extends FactoryProxy {
public void initializeEntityRenders() {
RenderingRegistry.registerEntityRenderingHandler(EntityMechanicalArm.class, new RenderVoid());
}
@Override
public void initializeNEIIntegration() {
try {
Class<?> neiRenderer = Class.forName("codechicken.nei.DefaultOverlayRenderer");
Method method = neiRenderer.getMethod("registerGuiOverlay", Class.class, String.class, int.class, int.class);
method.invoke(null, GuiAutoCrafting.class, "crafting", 5, 11);
BuildCraftCore.bcLog.fine("NEI detected, adding NEI overlay");
} catch (Exception e) {
BuildCraftCore.bcLog.fine("NEI not detected.");
}
}
}