Jump to content

[1.7.10] [Solved] Cannot be cast to net.minecraft.inventory.Container?


Ms_Raven

Recommended Posts

First of all, I have 12 GUI's that work perfectly fine.

I made a new GUI that's just a copy of one of the ones that work and added lots of stuff to it.

However, even though its structure is basically the same and it's registered the same way, it gives the error in the title when trying to open it from an item.

I can't figure out for the life of me what the problem is.

 

GUI that crashes:

 

public class GuiShopTravellerOver extends GuiContainer

{

 

private GuiTextField amount1;

private GuiTextField amount2;

private GuiTextField amount3;

private GuiTextField amount4;

 

private String text_amount1 = "";

private String text_amount2 = "";

private String text_amount3 = "";

private String text_amount4 = "";

 

private int final_amount1=0;

private int final_amount2=0;

private int final_amount3=0;

private int final_amount4=0;

 

private int paid1 = 0;

private int paid2 = 0;

private int paid3 = 0;

private int paid4 = 0;

 

private int totalPrice = 0;

 

 

public GuiShopTravellerOver(World world, int i, int j, int k, EntityPlayer entity)

{

super(new FCGuiContainer((EntityPlayer)entity));

}

 

private static final ResourceLocation texture = new ResourceLocation(Main.modid + ":textures/gui/stretchedIcons/" + "guiShop.png");

 

protected void drawGuiContainerBackgroundLayer(float f, int x, int y)

{

 

int posX = (this.width) /2;

int posY = (this.height) /2;

 

GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

 

this.mc.renderEngine.bindTexture(texture);

this.xSize=128;

this.ySize=128;

int k = (this.width - this.xSize) / 2;

int l = (this.height - this.ySize) / 2;

this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);

 

 

 

}

 

protected void mouseClicked(int par1, int par2, int par3)

{

super.mouseClicked(par1, par2, par3);

this.amount1.mouseClicked(par1, par2, par3);

this.amount2.mouseClicked(par1, par2, par3);

this.amount3.mouseClicked(par1, par2, par3);

this.amount4.mouseClicked(par1, par2, par3);

 

}

 

public void updateScreen()

{

int posX = (this.width) /2;

int posY = (this.height) /2;

 

this.amount1.updateCursorCounter();

this.amount2.updateCursorCounter();

this.amount3.updateCursorCounter();

this.amount4.updateCursorCounter();

}

 

protected void keyTyped(char par1, int par2)

{

 

this.amount1.textboxKeyTyped(par1, par2);

this.amount2.textboxKeyTyped(par1, par2);

this.amount3.textboxKeyTyped(par1, par2);

this.amount4.textboxKeyTyped(par1, par2);

 

if (par2 != 28 && par2 != 156)

{

if (par2 == 1)

{

this.mc.displayGuiScreen((GuiScreen)null);

}

}

 

}

 

protected void drawGuiContainerForegroundLayer(int par1, int par2)

{

int posX = (this.width) /2;

int posY = (this.height) /2;

 

this.fontRendererObj.drawString("Halo of the Sun", posX+(-60), posY+(-55), 0xfff000);

this.fontRendererObj.drawString("Throwing Knife", posX+(-60), posY+(-27), 0xfff000);

this.fontRendererObj.drawString("Mining Helmet", posX+(-60), posY+(1), 0xfff000);

this.fontRendererObj.drawString("Backpack", posX+(-60), posY+(29), 0xfff000);

 

this.amount1.drawTextBox();

this.amount2.drawTextBox();

this.amount3.drawTextBox();

this.amount4.drawTextBox();

}

 

public void onGuiClosed()

{

Keyboard.enableRepeatEvents(false);

}

 

public void initGui(){

Keyboard.enableRepeatEvents(true);

this.buttonList.clear();

int posX = (this.width) / 2;

int posY = (this.height) / 2;

 

this.buttonList.add(new GuiButton(0, posX+(-16), posY+(70), 36, 20, "Buy"));

 

this.amount1 = new GuiTextField(this.fontRendererObj, posX+(30), posY+(-59), 28, 20);

this.amount1.setMaxStringLength(2);

 

this.amount1.setText("0");

 

this.amount2 = new GuiTextField(this.fontRendererObj, posX+(30), posY+(-31), 28, 20);

this.amount2.setMaxStringLength(2);

 

this.amount2.setText("0");

 

this.amount3 = new GuiTextField(this.fontRendererObj, posX+(30), posY+(-3), 28, 20);

this.amount3.setMaxStringLength(2);

 

this.amount3.setText("0");

 

this.amount4 = new GuiTextField(this.fontRendererObj, posX+(30), posY+(25), 28, 20);

this.amount4.setMaxStringLength(2);

 

this.amount4.setText("0");

}

 

protected void actionPerformed(GuiButton button)

{

MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();

World world = server.worldServers[0];

EntityPlayer player = Minecraft.getMinecraft().thePlayer;

int i = (int)player.posX;

int j = (int)player.posY;

int k = (int)player.posZ;

 

if (button.id == 0)

{

if(player instanceof EntityPlayer)((EntityPlayer)player).openGui(Main.instance, Main.FGuidePage1, world, i, j, k);

 

}

}

 

 

 

public void checkout(EntityPlayer player)

{

ExtendedPlayer props = ExtendedPlayer.get(player);

int posX = (this.width) /2;

int posY = (this.height) /2;

 

correctValues();

fixValues();

convertToInteger();

 

totalPrice = (paid1+paid2+paid3+paid4);

 

if(inventoryHasRoom(player))

{

if(props.getMoney() >= (totalPrice))

{

if(final_amount1>0)player.inventory.addItemStackToInventory(new ItemStack(HorrorReg.haloOfTheSun, final_amount1));

if(final_amount2>0)player.inventory.addItemStackToInventory(new ItemStack(Main.bomb, final_amount2));

if(final_amount3>0)player.inventory.addItemStackToInventory(new ItemStack(Main.miningHelmet, final_amount3));

if(final_amount4>0)player.inventory.addItemStackToInventory(new ItemStack(HorrorReg.backpack, final_amount4));

props.spendMoney(totalPrice);

this.fontRendererObj.drawString("Purchased!", posX+(82), posY+(40), 0xfff000);

}

else

{

this.fontRendererObj.drawString("You can't afford that.", posX+(70), posY+(40), 0xfff000);

 

}

}

else

{

this.fontRendererObj.drawString("You don't have enough room.", posX+(76), posY+(40), 0xfff000);

 

}

}

public boolean inventoryHasRoom(EntityPlayer player)

{

int emptySlots = 0;

int neededSlots = (final_amount1+final_amount2+final_amount3+final_amount4);

for(int i = 0; i <35; i++)

{

if(player.inventory.getStackInSlot(i) != null)

{

emptySlots++;

}

}

if(emptySlots > neededSlots)

{

return true;

}

else return false;

}

 

public void toMoney()

{

paid1 = final_amount1 * 1500;

paid2 = final_amount2 * 50;

paid3 = final_amount3 * 500;

paid4 = final_amount4 * 750;

 

}

 

public void checkValues()

{

int stacks = 0;

if(final_amount1>0){stacks++;};

if(final_amount2>0){stacks++;};

if(final_amount3>0){stacks++;};

if(final_amount4>0){stacks++;};

if(final_amount1>64){final_amount1=64;};

if(final_amount2>64){final_amount2=64;};

if(final_amount3>64){final_amount3=64;};

if(final_amount4>64){final_amount4=64;};

 

}

public void correctValues()

{

text_amount1 = amount1.getText();

text_amount2 = amount2.getText();

text_amount3 = amount3.getText();

text_amount4 = amount4.getText();

 

if(amount1.getText().isEmpty())

{

text_amount1 = "0";

}

if(amount2.getText().isEmpty())

{

text_amount2 = "0";

}

if(amount3.getText().isEmpty())

{

text_amount3 = "0";

}

if(amount4.getText().isEmpty())

{

text_amount4 = "0";

}

}

 

public void convertToInteger()

{

final_amount1 = Integer.getInteger(text_amount1);

final_amount2 = Integer.getInteger(text_amount2);

final_amount3 = Integer.getInteger(text_amount3);

final_amount4 = Integer.getInteger(text_amount4);

}

 

public void fixValues()

{

Tools.println("Original string: " + text_amount1 + " becomes: " + text_amount1.replaceAll("\\D", ""));

text_amount1 = text_amount1.replaceAll("\\D", "");

Tools.println("Original string: " + text_amount2 + " becomes: " + text_amount2.replaceAll("\\D", ""));

text_amount2 = text_amount2.replaceAll("\\D", "");

Tools.println("Original string: " + text_amount3 + " becomes: " + text_amount3.replaceAll("\\D", ""));

text_amount3 = text_amount3.replaceAll("\\D", "");

Tools.println("Original string: " + text_amount4 + " becomes: " + text_amount4.replaceAll("\\D", ""));

text_amount4 = text_amount4.replaceAll("\\D", "");

}

 

public boolean doesGuiPauseGame()

{

return false;

}

 

}

 

 

GUI that works fine:

 

public class FCGuidePage2 extends GuiContainer

{

public FCGuidePage2(World world, int i, int j, int k, EntityPlayer entity)

{

super(new FCGuiContainer((EntityPlayer)entity));

}

 

private static final ResourceLocation texture = new ResourceLocation(Main.modid + ":textures/gui/stretchedIcons/" + "backgroundFCGuide.png");

 

protected void drawGuiContainerBackgroundLayer(float f, int x, int y)

{

 

int posX = (this.width) /2;

int posY = (this.height) /2;

/*

GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

 

this.mc.renderEngine.bindTexture(texture);

this.xSize=315;

this.ySize=195;

int k = (this.width - this.xSize) / 2;

int l = (this.height - this.ySize) / 2;

this.drawNonStandartTexturedRect(k, l, 0, 0, 315, 195, this.xSize, this.ySize);

*/

 

 

}

 

    public static void drawNonStandartTexturedRect(int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight) {

        float f = 1F / (float) textureWidth;

        float f1 = 1F / (float) textureHeight;

        Tessellator tessellator = Tessellator.instance;

        tessellator.startDrawingQuads();

        tessellator.addVertexWithUV((double) (x), (double) (y + height), 0, (double) ((float) (u) * f), (double) ((float) (v + height) * f1));

        tessellator.addVertexWithUV((double) (x + width), (double) (y + height), 0, (double) ((float) (u + width) * f), (double) ((float) (v + height) * f1));

        tessellator.addVertexWithUV((double) (x + width), (double) (y), 0, (double) ((float) (u + width) * f), (double) ((float) (v) * f1));

        tessellator.addVertexWithUV((double) (x), (double) (y), 0, (double) ((float) (u) * f), (double) ((float) (v) * f1));

        tessellator.draw();

    }

 

protected void mouseClicked(int par1, int par2, int par3)

{

super.mouseClicked(par1, par2, par3);

 

}

 

public void updateScreen()

{

int posX = (this.width) /2;

int posY = (this.height) /2;

 

}

 

protected void keyTyped(char par1, int par2)

{

 

 

if (par2 != 28 && par2 != 156)

{

if (par2 == 1)

{

this.mc.displayGuiScreen((GuiScreen)null);

}

}

 

}

 

protected void drawGuiContainerForegroundLayer(int par1, int par2)

{

int posX = (this.width) /2;

int posY = (this.height) /2;

this.fontRendererObj.drawString("Gates of Hell", posX+(-34), posY+(-60), 0xffffff);

this.fontRendererObj.drawString("--------------------------------------", posX+(-115), posY+(-52), 0xffffff);

this.fontRendererObj.drawString("Will be added in the Middle Earth update.", posX+(-149), posY+(-21), 0xffffff);

this.fontRendererObj.drawString("*The Elder Scrolls*", posX+(-140), posY+(-113), 0xffffff);

 

this.mc.renderEngine.bindTexture(new ResourceLocation(Main.modid + ":textures/gui/stretchedIcons/" + "Triforce2.png"));

this.drawTexturedModalRect(posX+(-19), posY+(-91), 0, 0, 256, 256);

 

this.mc.renderEngine.bindTexture(new ResourceLocation(Main.modid + ":textures/gui/stretchedIcons/" + "sonic2.png"));

this.drawTexturedModalRect(posX+(-53), posY+(-89), 0, 0, 256, 256);

 

this.mc.renderEngine.bindTexture(new ResourceLocation(Main.modid + ":textures/gui/stretchedIcons/" + "HP2.png"));

this.drawTexturedModalRect(posX+(-88), posY+(-90), 0, 0, 256, 256);

 

this.mc.renderEngine.bindTexture(new ResourceLocation(Main.modid + ":textures/gui/stretchedIcons/" + "KH2.png"));

this.drawTexturedModalRect(posX+(13), posY+(-91), 0, 0, 256, 256);

 

this.mc.renderEngine.bindTexture(new ResourceLocation(Main.modid + ":textures/gui/stretchedIcons/" + "FF2.png"));

this.drawTexturedModalRect(posX+(43), posY+(-88), 0, 0, 256, 256);

 

this.mc.renderEngine.bindTexture(new ResourceLocation(Main.modid + ":textures/gui/stretchedIcons/" + "Elder.png"));

this.drawTexturedModalRect(posX+(-120), posY+(-87), 0, 0, 256, 256);

 

this.mc.renderEngine.bindTexture(new ResourceLocation(Main.modid + ":textures/gui/stretchedIcons/" + "Border2.png"));

this.drawTexturedModalRect(posX+(75), posY+(-90), 0, 0, 256, 256);

 

this.mc.renderEngine.bindTexture(new ResourceLocation(Main.modid + ":textures/gui/stretchedIcons/" + "lotr2.png"));

this.drawTexturedModalRect(posX+(113), posY+(-86), 0, 0, 256, 256);

 

this.mc.renderEngine.bindTexture(new ResourceLocation(Main.modid + ":textures/gui/stretchedIcons/" + "doctor2.png"));

this.drawTexturedModalRect(posX+(-150), posY+(-90), 0, 0, 256, 256);

 

}

 

public void onGuiClosed()

{

Keyboard.enableRepeatEvents(false);

}

 

public void initGui(){

Keyboard.enableRepeatEvents(true);

this.buttonList.clear();

int posX = (this.width) / 2;

int posY = (this.height) / 2;

this.buttonList.add(new GuiButton(0, posX+(-169), posY+(-92), 12, 20, "1"));

this.buttonList.add(new GuiButton(1, posX+(-169), posY+(-72), 12, 20, "2"));

this.buttonList.add(new GuiButton(2, posX+(-169), posY+(-52), 12, 20, "3"));

this.buttonList.add(new GuiButton(3, posX+(-169), posY+(-32), 12, 20, "4"));

this.buttonList.add(new GuiButton(4, posX+(-169), posY+(-12), 12, 20, "5"));

this.buttonList.add(new GuiButton(5, posX+(-169), posY+(8), 12, 20, "6"));

this.buttonList.add(new GuiButton(6, posX+(-169), posY+(28), 12, 20, "7"));

this.buttonList.add(new GuiButton(7, posX+(-169), posY+(48), 12, 20, "8"));

this.buttonList.add(new GuiButton(8, posX+(-169), posY+(68), 12, 20, "9"));

this.buttonList.add(new GuiButton(9, posX+(169), posY+(-92), 12, 20, "?"));

 

}

 

protected void actionPerformed(GuiButton button)

{

MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();

World world = server.worldServers[0];

EntityPlayer player = Minecraft.getMinecraft().thePlayer;

int i = (int)player.posX;

int j = (int)player.posY;

int k = (int)player.posZ;

 

if (button.id == 0)

{

if(player instanceof EntityPlayer)((EntityPlayer)player).openGui(Main.instance, Main.FGuidePage1, world, i, j, k);

 

}

if (button.id == 1)

{

if(player instanceof EntityPlayer)((EntityPlayer)player).openGui(Main.instance, Main.FGuidePage2, world, i, j, k);

 

}

if (button.id == 2)

{

if(player instanceof EntityPlayer)((EntityPlayer)player).openGui(Main.instance, Main.FGuidePage3, world, i, j, k);

 

}

 

if (button.id == 3)

{

if(player instanceof EntityPlayer)((EntityPlayer)player).openGui(Main.instance, Main.FGuidePage4, world, i, j, k);

 

}

 

if (button.id == 4)

{

if(player instanceof EntityPlayer)((EntityPlayer)player).openGui(Main.instance, Main.FGuidePage5, world, i, j, k);

 

}

 

if (button.id == 5)

{

if(player instanceof EntityPlayer)((EntityPlayer)player).openGui(Main.instance, Main.FGuidePage6, world, i, j, k);

 

}

 

if (button.id == 6)

{

if(player instanceof EntityPlayer)((EntityPlayer)player).openGui(Main.instance, Main.FGuidePage7, world, i, j, k);

 

}

 

if (button.id == 7)

{

if(player instanceof EntityPlayer)((EntityPlayer)player).openGui(Main.instance, Main.FGuidePage8, world, i, j, k);

 

}

 

if (button.id == 8)

{

if(player instanceof EntityPlayer)((EntityPlayer)player).openGui(Main.instance, Main.FGuidePage9, world, i, j, k);

 

}

 

if (button.id == 9)

{

if(player instanceof EntityPlayer)((EntityPlayer)player).openGui(Main.instance, Main.FGuideHome, world, i, j, k);

 

}

 

 

 

}

 

public boolean doesGuiPauseGame()

{

return false;

}

 

}

 

 

Container:

 

public class FCGuiContainer extends Container {

 

        public FCGuiContainer (EntityPlayer player){

        }

 

        @Override

        public boolean canInteractWith(EntityPlayer player) {

                return true;

        }

 

 

        protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) {

        }

 

        @Override

        public ItemStack transferStackInSlot(EntityPlayer player, int slot) {

                return null;

        }

}

 

 

ServerProxy (GuiHandler):

 

public class ServerProxy implements IGuiHandler

{

private static final Map<String, NBTTagCompound> extendedEntityData = new HashMap<String, NBTTagCompound>();

 

public  void init()

{

 

}

public void registerEvents()

{

 

}

public EntityPlayer getPlayerEntity(MessageContext ctx)

{

return ctx.getServerHandler().playerEntity;

}

public static EntityPlayer getServerPlayer(MessageContext ctx)

{

return ctx.getServerHandler().playerEntity;

}

@Override public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)

{

if(id == 0)

{

return new FCGuideHome(world, y, z, z, player);

}

if(id == 1)

{

return new FCGuidePage1(world, y, z, z, player);

}

if(id == 2)

{

return new FCGuidePage2(world, y, z, z, player);

}

if(id == 3)

{

return new FCGuidePage3(world, y, z, z, player);

}

if(id == 4)

{

return new FCGuidePage4(world, y, z, z, player);

}

if(id == 5)

{

return new FCGuidePage5(world, y, z, z, player);

}

if(id == 6)

{

return new FCGuidePage6(world, y, z, z, player);

}

if(id == 7)

{

return new FCGuidePage7(world, y, z, z, player);

}

if(id == 8)

{

return new FCGuidePage8(world, y, z, z, player);

}

if(id == 9)

{

return new FCGuidePage9(world, y, z, z, player);

}

if(id == Main.GuiBackpack)

{

return new ContainerBackpack(player, player.inventory, new InventoryBackpack(player.getHeldItem()));

}

if(id == Main.GuiTravellerOver)

{

return new GuiShopTravellerOver(world, x, y, z, player);

}

return new FCGuiContainer(player);

}

@Override public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)

{

if(id == 0)

{

return new FCGuideHome(world, y, z, z, player);

}

if(id == 1)

{

return new FCGuidePage1(world, y, z, z, player);

}

if(id == 2)

{

return new FCGuidePage2(world, y, z, z, player);

}

if(id == 3)

{

return new FCGuidePage3(world, y, z, z, player);

}

if(id == 4)

{

return new FCGuidePage4(world, y, z, z, player);

}

if(id == 5)

{

return new FCGuidePage5(world, y, z, z, player);

}

if(id == 6)

{

return new FCGuidePage6(world, y, z, z, player);

}

if(id == 7)

{

return new FCGuidePage7(world, y, z, z, player);

}

if(id == 8)

{

return new FCGuidePage8(world, y, z, z, player);

}

if(id == 9)

{

return new FCGuidePage9(world, y, z, z, player);

}

if(id == 12)

{

return new GuiBackpack((ContainerBackpack) new ContainerBackpack(player, player.inventory, new InventoryBackpack(player.getHeldItem())));

}

if(id == 13)

{

return new GuiShopTravellerOver(world, x, y, z, player);

}

return new FCGuiContainer(player);

}

 

public void registerRenderThings()

{

 

}

public void spawnMobs()

{

 

}

public void registerTileEntitySpecialRenderer()

{

 

}

public void registerItemRenderers()

{

 

}

public ModelBiped getArmorModel(int id)

{

return null;

}

 

public static void storeEntityData(String name, NBTTagCompound compound)

{

extendedEntityData.put(name, compound);

}

 

public static NBTTagCompound getEntityData(String name)

{

return extendedEntityData.remove(name);

}

 

}

 

Link to comment
Share on other sites

Well then how is that that all the others work?

Your if-chain (why no switch?) is falling back to this line:

return new FCGuiContainer(player);

, which means not of your if-statements are true, so the ID must be incorrect. Show where you open your gui.

Actually I am stupid. Reading the title helps.

 

Your getServerGuiElement method must always return a Container. This error means you returned something else.

Which always makes me wondering: why does the
getServerGuiElement

allows you to return basically anything (a

Object

), and not an instance of

Container

by just changing the return type to

Container

(same goes for

getClientGuiElement

)?

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

But that still doesn't explain why this is the only one that does not work when it's the same as all the others...

 

This is how I'm opening the gui:

@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
	if (!player.capabilities.isCreativeMode)
	{
		--stack.stackSize;
	}
	if (!world.isRemote)
	{
		int i = (int)player.posX;
		int j = (int)player.posY;
		int k = (int)player.posZ;
		player.openGui(Main.instance, Main.GuiTravellerOver, world, i, j, k);
	}
	return stack;
}

 

And these are the id's in Main, which are all correct...

	public static int FGuideHome= 0;
	public static int FGuidePage1 = 1;
	public static int FGuidePage2 = 2;
	public static int FGuidePage3 = 3;
	public static int FGuidePage4 = 4;
	public static int FGuidePage5 = 5;
	public static int FGuidePage6 = 6;
	public static int FGuidePage7 = 7;
	public static int FGuidePage8 = 8;
	public static int FGuidePage9 = 9;
	//public static int SanityBar = 10;
	//public static int FuelBar = 11;
	public static int GuiBackpack = 12;
	public static int GuiTravellerOver = 13;
	//public static int GuiTravellerOther = 14;
	//public static int GuiTravellerNether = 15;

Link to comment
Share on other sites

GuiShopTravellerOver

does not extend Container, but you still return it in

getServerGuiElement

.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

STILL doesn't explain why that works and all the others don't.....

 

This is the crash:

[17:09:09] [server thread/INFO]: MissApocalypse joined the game

[17:09:12] [Client thread/INFO]: [CHAT] Check for new version at §6http://missapocalypse.wix.com/fandomcraft

[17:09:14] [server thread/ERROR]: Encountered an unexpected exception

net.minecraft.util.ReportedException: Ticking memory connection

at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:198) ~[NetworkSystem.class:?]

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) ~[MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) ~[MinecraftServer.class:?]

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) ~[integratedServer.class:?]

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?]

Caused by: java.lang.ClassCastException: apocalypse.fandomcraft.gui.GuiShopTravellerOver cannot be cast to net.minecraft.inventory.Container

at cpw.mods.fml.common.network.NetworkRegistry.getRemoteGuiContainer(NetworkRegistry.java:241) ~[NetworkRegistry.class:?]

at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:75) ~[FMLNetworkHandler.class:?]

at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2501) ~[EntityPlayer.class:?]

at apocalypse.fandomcraft.horror.Leafy.onItemRightClick(Leafy.java:28) ~[Leafy.class:?]

at net.minecraft.item.ItemStack.useItemRightClick(ItemStack.java:164) ~[itemStack.class:?]

at net.minecraft.server.management.ItemInWorldManager.tryUseItem(ItemInWorldManager.java:345) ~[itemInWorldManager.class:?]

at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:576) ~[NetHandlerPlayServer.class:?]

at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74) ~[C08PacketPlayerBlockPlacement.class:?]

at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122) ~[C08PacketPlayerBlockPlacement.class:?]

at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) ~[NetworkManager.class:?]

at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) ~[NetworkSystem.class:?]

... 5 more

[17:09:14] [server thread/ERROR]: This crash report has been saved to: C:\Users\Avery\Documents\Mods\FandomCraft 2\eclipse\.\crash-reports\crash-2015-04-29_17.09.14-server.txt

[17:09:14] [server thread/INFO]: Stopping server

[17:09:14] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ----

// Everything's going to plan. No, really, that was supposed to happen.

 

Time: 29/04/15 17:09

Description: Ticking memory connection

 

java.lang.ClassCastException: apocalypse.fandomcraft.gui.GuiShopTravellerOver cannot be cast to net.minecraft.inventory.Container

at cpw.mods.fml.common.network.NetworkRegistry.getRemoteGuiContainer(NetworkRegistry.java:241)

at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:75)

at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2501)

at apocalypse.fandomcraft.horror.Leafy.onItemRightClick(Leafy.java:28)

at net.minecraft.item.ItemStack.useItemRightClick(ItemStack.java:164)

at net.minecraft.server.management.ItemInWorldManager.tryUseItem(ItemInWorldManager.java:345)

at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:576)

at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74)

at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122)

at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241)

at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726)

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485)

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)

 

 

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

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at cpw.mods.fml.common.network.NetworkRegistry.getRemoteGuiContainer(NetworkRegistry.java:241)

at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:75)

at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2501)

at apocalypse.fandomcraft.horror.Leafy.onItemRightClick(Leafy.java:28)

at net.minecraft.item.ItemStack.useItemRightClick(ItemStack.java:164)

at net.minecraft.server.management.ItemInWorldManager.tryUseItem(ItemInWorldManager.java:345)

at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:576)

at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74)

at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122)

at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241)

 

-- Ticking connection --

Details:

Connection: net.minecraft.network.NetworkManager@635739a2

Stacktrace:

at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726)

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485)

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)

 

-- System Details --

Details:

Minecraft Version: 1.7.10

Operating System: Windows 8.1 (amd64) version 6.3

Java Version: 1.8.0_40, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 726482096 bytes (692 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 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: 80, allocated: 1, tallocated: 14

FML: MCP v9.05 FML v7.10.85.1291 Minecraft Forge 10.13.2.1291 4 mods loaded, 4 mods active

mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

FML{7.10.85.1291} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Forge{10.13.2.1291} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

fandomcraft{4.1.1} [FandomCraft] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Profiler Position: N/A (disabled)

Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

Player Count: 1 / 8; [EntityPlayerMP['MissApocalypse'/121, l='New World', x=-280.35, y=71.00, z=233.52]]

Type: Integrated Server (map_client.txt)

Is Modded: Definitely; Client brand changed to 'fml,forge'

 

Link to comment
Share on other sites

STILL doesn't explain why that works and all the others don't.....

 

This is the crash:

[17:09:09] [server thread/INFO]: MissApocalypse joined the game

[17:09:12] [Client thread/INFO]: [CHAT] Check for new version at §6http://missapocalypse.wix.com/fandomcraft

[17:09:14] [server thread/ERROR]: Encountered an unexpected exception

net.minecraft.util.ReportedException: Ticking memory connection

at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:198) ~[NetworkSystem.class:?]

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) ~[MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) ~[MinecraftServer.class:?]

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) ~[integratedServer.class:?]

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?]

Caused by: java.lang.ClassCastException: apocalypse.fandomcraft.gui.GuiShopTravellerOver cannot be cast to net.minecraft.inventory.Container

at cpw.mods.fml.common.network.NetworkRegistry.getRemoteGuiContainer(NetworkRegistry.java:241) ~[NetworkRegistry.class:?]

at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:75) ~[FMLNetworkHandler.class:?]

at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2501) ~[EntityPlayer.class:?]

at apocalypse.fandomcraft.horror.Leafy.onItemRightClick(Leafy.java:28) ~[Leafy.class:?]

at net.minecraft.item.ItemStack.useItemRightClick(ItemStack.java:164) ~[itemStack.class:?]

at net.minecraft.server.management.ItemInWorldManager.tryUseItem(ItemInWorldManager.java:345) ~[itemInWorldManager.class:?]

at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:576) ~[NetHandlerPlayServer.class:?]

at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74) ~[C08PacketPlayerBlockPlacement.class:?]

at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122) ~[C08PacketPlayerBlockPlacement.class:?]

at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) ~[NetworkManager.class:?]

at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) ~[NetworkSystem.class:?]

... 5 more

[17:09:14] [server thread/ERROR]: This crash report has been saved to: C:\Users\Avery\Documents\Mods\FandomCraft 2\eclipse\.\crash-reports\crash-2015-04-29_17.09.14-server.txt

[17:09:14] [server thread/INFO]: Stopping server

[17:09:14] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ----

// Everything's going to plan. No, really, that was supposed to happen.

 

Time: 29/04/15 17:09

Description: Ticking memory connection

 

java.lang.ClassCastException: apocalypse.fandomcraft.gui.GuiShopTravellerOver cannot be cast to net.minecraft.inventory.Container

at cpw.mods.fml.common.network.NetworkRegistry.getRemoteGuiContainer(NetworkRegistry.java:241)

at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:75)

at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2501)

at apocalypse.fandomcraft.horror.Leafy.onItemRightClick(Leafy.java:28)

at net.minecraft.item.ItemStack.useItemRightClick(ItemStack.java:164)

at net.minecraft.server.management.ItemInWorldManager.tryUseItem(ItemInWorldManager.java:345)

at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:576)

at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74)

at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122)

at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241)

at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726)

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485)

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)

 

 

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

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at cpw.mods.fml.common.network.NetworkRegistry.getRemoteGuiContainer(NetworkRegistry.java:241)

at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:75)

at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2501)

at apocalypse.fandomcraft.horror.Leafy.onItemRightClick(Leafy.java:28)

at net.minecraft.item.ItemStack.useItemRightClick(ItemStack.java:164)

at net.minecraft.server.management.ItemInWorldManager.tryUseItem(ItemInWorldManager.java:345)

at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:576)

at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74)

at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122)

at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241)

 

-- Ticking connection --

Details:

Connection: net.minecraft.network.NetworkManager@635739a2

Stacktrace:

at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726)

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485)

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)

 

-- System Details --

Details:

Minecraft Version: 1.7.10

Operating System: Windows 8.1 (amd64) version 6.3

Java Version: 1.8.0_40, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 726482096 bytes (692 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 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: 80, allocated: 1, tallocated: 14

FML: MCP v9.05 FML v7.10.85.1291 Minecraft Forge 10.13.2.1291 4 mods loaded, 4 mods active

mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

FML{7.10.85.1291} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Forge{10.13.2.1291} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

fandomcraft{4.1.1} [FandomCraft] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Profiler Position: N/A (disabled)

Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

Player Count: 1 / 8; [EntityPlayerMP['MissApocalypse'/121, l='New World', x=-280.35, y=71.00, z=233.52]]

Type: Integrated Server (map_client.txt)

Is Modded: Definitely; Client brand changed to 'fml,forge'

 

The other work because you actually return the proper thing in the proper method.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

I am kinda lost, why are youu returning FCGuiContainer in both client and server? What's up with those namings anyway?

 

In both server and client you are using FCGuidePage"X" which extends GuiContainer which is NOT Container and is actually only for client (it's GUI).

 

As to you "explanation" - your code will probably crash at some point. :D

 

Container is for SERVER

GuiContainer is for CLIENT

 

You can make gui that is only client-side - then you return gui for client and null for server. You can't really (pointless) do other way around.

1.7.10 is no longer supported by forge, you are on your own.

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.