Jump to content

[1.7.10]When i try open gui on item right click minecraft crashed


U4R4B3Y

Recommended Posts

Hello everyone, I'm still just learning to write minecraft mods and faced with a problem.

Found custom furnace sources and tried to make him the subject of a gui on item, for some reason and when i try open gui on item right click minecraft crashed

Here source:

Main class

 

package ruru.test.main;

import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import ruru.test.brickfurnace.BrickOven;
import ruru.test.brickfurnace.RenderBrickOven;
import ruru.test.brickfurnace.TileEntityBrickOven;
import ruru.test.guihandler.GuiHandler;
import ruru.test.item.BestPickAxe;
import ruru.test.proxies.CommonProxy;


@Mod (modid = "test", name = "test", version = "1.0")
public class Main {
// Client and Server Proxy locations
@SidedProxy(clientSide = "ruru.test.proxies.ClientProxy", serverSide = "ruru.test.proxies.CommonProxy")
public static CommonProxy proxy;
// Mod Instance
@Instance("test")
public static Main instance;

// Brick Furnace Declaration
public static Block brickOven;
public static Block brickOvenActive;


public static Item bestpickaxe;




@EventHandler
public void preLoad(FMLPreInitializationEvent event)
{
	bestpickaxe = new BestPickAxe().setUnlocalizedName("bestpickaxe").setCreativeTab(CreativeTabs.tabRedstone).setTextureName("carrot_golden");
	GameRegistry.registerItem(bestpickaxe, "bestpickaxe");
}
@EventHandler
public void Load(FMLInitializationEvent event)
{
	// Brick Furnace
	brickOven = new BrickOven(false).setHardness(4.5F).setResistance(15.0F).setBlockName("brickOven").setCreativeTab(CreativeTabs.tabRedstone);
	brickOvenActive = new BrickOven(true).setHardness(4.5F).setResistance(15.5F).setBlockName("brickOvenActive");

	GameRegistry.registerBlock(brickOven, "brickOven");
	GameRegistry.registerBlock(brickOvenActive, "brickOvenActive");

	GameRegistry.registerTileEntity(TileEntityBrickOven.class, "tileEntityBrickOven");

	GameRegistry.addRecipe(new ItemStack(brickOven, 1), new Object[] {
		"AAA",
		"A A",
		"AAA",
		'A', Blocks.brick_block
	});

	RenderingRegistry.registerBlockHandler(2108, RenderBrickOven.INSTANCE);

	// Register GuiHandler
	NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
}
@EventHandler
public void postLoad(FMLPostInitializationEvent event)
{
}
}

 

GuiHandler

 

package ruru.test.guihandler;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import ruru.test.brickfurnace.ContainerBrickOven;
import ruru.test.brickfurnace.GuiBrickOven;
import ruru.test.brickfurnace.TileEntityBrickOven;
import ruru.test.item.Containerr;
import ruru.test.item.Gui;
import cpw.mods.fml.common.network.IGuiHandler;

public class GuiHandler implements IGuiHandler
{

@Override
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
{
	TileEntity tile_entity = world.getTileEntity(x, y, z);
	switch(id)
	{
	default: return null;
	case 1: return new Gui(player);
	case 3: return new ContainerBrickOven(player.inventory, (TileEntityBrickOven) tile_entity);


        }
}

@Override
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
{
	TileEntity tile_entity = world.getTileEntity(x, y, z);
	switch(id)
	{
	default: return null;
	case 1: return new Containerr(player);
	case 3: return new GuiBrickOven(player.inventory, (TileEntityBrickOven) tile_entity);


	}
}
}

 

 

BestPickAxe

 

package ruru.test.item;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.world.World;
import ruru.test.main.Main;

public class BestPickAxe extends Item {

    @Override
    public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player)
    {
    	player.openGui(Main.instance, 1, world, (int)player.posX, (int)player.posY, (int)player.posZ);
        return itemStack;
    }


}

 

Containerr

 

package ruru.test.item;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;

public class Containerr extends Container {
public Containerr(EntityPlayer player) {


}
@Override
public boolean canInteractWith(EntityPlayer player) {
	// TODO Auto-generated method stub
	return true;
}

}

 

Gui

 

package ruru.test.item;

import org.lwjgl.opengl.GL11;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.util.ResourceLocation;

public class Gui extends GuiScreen{

ResourceLocation texture = new ResourceLocation("MolecularConverter".toLowerCase(), "assets/minecraft/Gui.png");
public final int textX = 176;
public final int textY = 166;
public Gui(EntityPlayer player)
{

}
@Override
public void drawScreen(int x, int y, float f)
{
	drawDefaultBackground();

	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
	Minecraft.getMinecraft().getTextureManager().bindTexture(texture);

	int posX = (this.width - textX) / 2;
	int posY = (this.height - textY) / 2;

	drawTexturedModalRect(posX, posY, 0, 0, textX, textY);
	super.drawScreen(x, y, f);
}

@Override
public boolean doesGuiPauseGame()
{
	return false;
}
}

 

ClientProxy

 

package ruru.test.proxies;


public class ClientProxy extends CommonProxy {
 @Override
     public void registerRenderers() {
     }
}

 

CommonProxy

 

package ruru.test.proxies;

public class CommonProxy {
        public void registerRenderers() {
        }
}

 

Crash report

 

---- Minecraft Crash Report ----
// Sorry 

Time: 24.12.15 12:04
Description: Unexpected error

java.lang.ClassCastException: ruru.test.item.Containerr cannot be cast to net.minecraft.client.gui.GuiScreen
at cpw.mods.fml.client.FMLClientHandler.showGuiScreen(FMLClientHandler.java:471)
at cpw.mods.fml.common.FMLCommonHandler.showGuiScreen(FMLCommonHandler.java:303)
at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:94)
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2501)
at ruru.test.item.BestPickAxe.onItemRightClick(BestPickAxe.java:16)
at net.minecraft.item.ItemStack.useItemRightClick(ItemStack.java:164)
at net.minecraft.client.multiplayer.PlayerControllerMP.sendUseItem(PlayerControllerMP.java:430)
at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1557)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:2044)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1039)
at net.minecraft.client.Minecraft.run(Minecraft.java:962)
at net.minecraft.client.main.Main.main(Main.java:164)
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:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
at cpw.mods.fml.client.FMLClientHandler.showGuiScreen(FMLClientHandler.java:471)
at cpw.mods.fml.common.FMLCommonHandler.showGuiScreen(FMLCommonHandler.java:303)
at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:94)
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2501)
at ruru.test.item.BestPickAxe.onItemRightClick(BestPickAxe.java:16)
at net.minecraft.item.ItemStack.useItemRightClick(ItemStack.java:164)
at net.minecraft.client.multiplayer.PlayerControllerMP.sendUseItem(PlayerControllerMP.java:430)
at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1557)

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP['Player701'/114, l='MpServer', x=-369,56, y=72,62, z=-15,80]]
Chunk stats: MultiplayerChunkCache: 545, 545
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options: 
Level spawn location: World: (-364,64,-6), Chunk: (at 4,4,10 in -23,-1; contains blocks -368,0,-16 to -353,255,-1), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,0,-512 to -1,255,-1)
Level time: 43115 game time, 43115 day time
Level dimension: 0
Level storage version: 0x00000 - Unknown?
Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
Forced entities: 36 total; [EntityPig['Pig'/64, l='MpServer', x=-408,50, y=67,00, z=-20,69], EntityPig['Pig'/65, l='MpServer', x=-412,00, y=69,00, z=-12,50], EntityPig['Pig'/66, l='MpServer', x=-414,26, y=63,00, z=31,58], EntityPig['Pig'/67, l='MpServer', x=-406,50, y=63,00, z=36,75], EntityBat['Bat'/71, l='MpServer', x=-394,34, y=24,10, z=-71,75], EntityBat['Bat'/72, l='MpServer', x=-387,71, y=30,12, z=-76,64], EntityBat['Bat'/73, l='MpServer', x=-394,44, y=22,31, z=-69,80], EntityBat['Bat'/74, l='MpServer', x=-385,48, y=29,25, z=-81,41], EntityBat['Bat'/75, l='MpServer', x=-386,02, y=28,56, z=-76,70], EntityPig['Pig'/76, l='MpServer', x=-385,53, y=64,00, z=6,16], EntityBat['Bat'/77, l='MpServer', x=-376,45, y=21,11, z=-4,57], EntitySquid['Squid'/78, l='MpServer', x=-364,50, y=51,38, z=-65,50], EntitySquid['Squid'/79, l='MpServer', x=-366,91, y=52,41, z=-77,44], EntitySquid['Squid'/80, l='MpServer', x=-359,50, y=52,00, z=-55,34], EntitySquid['Squid'/81, l='MpServer', x=-370,59, y=52,00, z=-55,06], EntitySquid['Squid'/82, l='MpServer', x=-360,97, y=52,22, z=-56,53], EntityPig['Pig'/83, l='MpServer', x=-360,47, y=63,00, z=-41,30], EntityBat['Bat'/84, l='MpServer', x=-364,59, y=30,10, z=63,66], EntitySquid['Squid'/87, l='MpServer', x=-339,72, y=50,00, z=-22,50], EntityBat['Bat'/88, l='MpServer', x=-339,06, y=19,10, z=16,22], EntitySquid['Squid'/90, l='MpServer', x=-329,66, y=48,22, z=-34,66], EntitySquid['Squid'/91, l='MpServer', x=-328,50, y=47,09, z=-21,50], EntitySquid['Squid'/92, l='MpServer', x=-336,41, y=48,00, z=-26,22], EntityBat['Bat'/94, l='MpServer', x=-311,37, y=11,73, z=-54,98], EntitySquid['Squid'/95, l='MpServer', x=-311,63, y=52,97, z=-35,44], EntityBat['Bat'/96, l='MpServer', x=-317,00, y=12,06, z=60,06], EntityPig['Pig'/49, l='MpServer', x=-447,03, y=65,00, z=-25,50], EntityPig['Pig'/50, l='MpServer', x=-436,43, y=78,00, z=-3,68], EntityPig['Pig'/51, l='MpServer', x=-443,81, y=80,00, z=-1,81], EntityClientPlayerMP['Player701'/114, l='MpServer', x=-369,56, y=72,62, z=-15,80], EntityPig['Pig'/52, l='MpServer', x=-445,25, y=74,00, z=18,50], EntityBat['Bat'/56, l='MpServer', x=-422,09, y=56,10, z=-27,28], EntityBat['Bat'/57, l='MpServer', x=-431,64, y=57,83, z=-36,63], EntityPig['Pig'/58, l='MpServer', x=-424,69, y=66,00, z=31,50], EntityBat['Bat'/61, l='MpServer', x=-412,86, y=22,02, z=-81,31], EntityBat['Bat'/63, l='MpServer', x=-414,25, y=19,52, z=-71,64]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:415)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2566)
at net.minecraft.client.Minecraft.run(Minecraft.java:991)
at net.minecraft.client.main.Main.main(Main.java:164)
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:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)

-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.8.0_65, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 707919368 bytes (675 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 11, tcache: 0, allocated: 13, tallocated: 95
FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1558 4 mods loaded, 4 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCHIJAAAA	mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) 
UCHIJAAAA	FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar) 
UCHIJAAAA	Forge{10.13.4.1558} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar) 
UCHIJAAAA	test{1.0} [test] (bin) 
GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.3.0' Renderer: 'GeForce GT 740M/PCIe/SSE2'
Launched Version: 1.7.10
LWJGL: 2.9.1
OpenGL: GeForce GT 740M/PCIe/SSE2 GL version 4.3.0, NVIDIA Corporation
GL Caps: Using GL 1.3 multitexturing.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Anisotropic filtering is supported and maximum anisotropy is 16.
Shaders are available because OpenGL 2.1 is supported.

Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: []
Current Language: English (US)
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Anisotropic Filtering: Off (1)

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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