Java throws a java.lang.NullPointerException when I try to use
player.openGui(LotrCraft.Instance, 1, world, x, y, z);
Doing a little stack-following I found it happens when this code is ran:
FMLCommonHandler.instance().showGuiScreen(handler.getClientGuiElement(modGuiId, player, world, x, y, z));
So, presumably, my gui handler is returning null? Here is it's code:
package mymod.common;
import cpw.mods.fml.common.network.IGuiHandler;
import net.minecraft.src.*;
public class GuiHandler implements IGuiHandler {
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world,
int x, int y, int z) {
switch (ID) {
case 1:
return new ContainerSmelter(player.inventory, world, x, y, z);
}
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world,
int x, int y, int z) {
switch (ID) {
case 1:
return new GuiSmelter(player.inventory, world, x, y, z);
}
return null;
}
}
If you need the code for the container and gui, i'll post it.