Jump to content

[1.8] Custom Furnace trouble


Recommended Posts

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


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

public TileEntity createNewTileEntity(World worldIn, int meta) {
  return new TileEntityBaseFurnace();


Am I missing something?


Link to comment
Share on other sites

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/

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.

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.

  • Create New...

Important Information

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