Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

  • Author

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;
}

  • Author

What the class InventoryGenerator must be GuiScreen like extends it or what

Guest
This topic is now closed to further replies.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.