Posted June 17, 201510 yr I am triing to make a custom furnace, which is like the vanilla furnace, just with some additional properties. Since most of the stuff is like vanilla furnaces I created a TE extending TileEntityFurnace, a Block extended BlockFurnace and fixxed my .json files. I am saving the locations of placed furnaces in a TileEntity, called TileEntityBase. At one point I need to sync the placed furnaces between Client and Server Side, so I am using a package. The problem is that it seems that my custom block is creating a TileEntityFurnace, so I am getting a ClassCastException here int i = 0; for(BlockPos location : message.furnaceLocations) { furnaces[i] = (TileEntityBaseFurnace) worldObj.getTileEntity(location); i++; } The locations are beeing send via the message, and these are the correct positions, I checked that. So it seems that at some point minecraft seems to kill my custom TileEntity and replace it with a TileEntityFurnace. But the only place where I can see Minecraft creating a TE is at @Override public TileEntity createNewTileEntity(World worldIn, int meta) { return new TileEntityBaseFurnace(); } Am I missing something?
June 17, 201510 yr Author I do this because like a machine that can access several furnaces. Like an overview of all your furnaces. That why I want to send the data to client so it can display it in the gui
June 17, 201510 yr It is usually bad practice to cast something without checking that it is an instanceof the class you're casting to. So check that worldObj.getTileEntity() instanceof TileEntityBaseFurnace. After that, I think you just need to do standard debug. Put console/logger statements in each of the parts of the code, such as the message processing, to confirm that the information is getting synced as you expect. In the code you posted above, put in statements that print out the location and what block is in that position. You should quickly be able to figure out what is wrong just by following the execution of your code. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
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.