Jump to content

Recommended Posts

Posted

hello i try to open my custom gui and i get this error

java.lang.ClassCastException: tompinn23.usefulStuff.InventoryGenerator cannot be cast to net.minecraft.client.gui.GuiScreen
at cpw.mods.fml.client.FMLClientHandler.showGuiScreen(FMLClientHandler.java:415)
at cpw.mods.fml.common.FMLCommonHandler.showGuiScreen(FMLCommonHandler.java:288)
at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:94)
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2255)
at tompinn23.usefulStuff.blockGenerator.onBlockActivated(blockGenerator.java:30)
at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:349)
at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1442)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1949)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:953)
at net.minecraft.client.Minecraft.run(Minecraft.java:870)
at net.minecraft.client.main.Main.main(Main.java:103)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

I can see it is a classcast exception but i dont know how to fix it

Posted

hello i dont understand what you mean heres my getClientGuiElement

	public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {

	TileEntity entity = world.getTileEntity(x, y, z);

	if(entity != null){
		switch(ID){
			//case usefulStuff.guiIDSludger:
				//if(entity instanceof TileEntitySludger){
					////return new GuiSludger(player.inventory, (TileEntitySludger) entity);
		case usefulStuff.guiIDGenerator:
			// Create an Object of our TE, so we can give that to our inventory.
            generatorTileEntity tileEntityGeneratorContainer = (generatorTileEntity) world.getTileEntity(x, y, z);
            return new InventoryGenerator(player.inventory, tileEntityGeneratorContainer);	



		}
	}
	return null;
}

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.