Jump to content

[1.8][Solved]Tile Entity removed before it can be accessed


FredTargaryen

Recommended Posts

I don't understand this at all. As far as I can tell I'm using the same technique as vanilla tile entity blocks, but I get the following error whenever I break the block:

Cannot get property PropertyDirection{name=facing, clazz=class net.minecraft.util.EnumFacing, values=[north, south, west, east]} as it does not exist in BlockState{block=minecraft:air, properties=[]}

And then nothing happens.

Block breaking code:

@Override
    public void breakBlock(World w, BlockPos pos, IBlockState state)
    {
        TileEntityFireplace tef = (TileEntityFireplace) w.getTileEntity(pos);
        if (tef.getConnected())
        {
            TileEntityFireplace.removeLocation(w, pos);
        }
        w.removeTileEntity(pos);
    }

This code worked in 1.7.10 but not in 1.8. What do I need to change?

Thank you for reading.

Link to comment
Share on other sites

Figured it out:

The problem was to do with the blocks - I thought it was a TE thing because the error happened during a TE method. When breakBlock is called, the block in question has already been set to air. However the previous block is in the state parameter, so instead of using world.getBlockState(pos) (as I did in the removeLocation method), I should have used state.

 

Thanks anyway!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...

Important Information

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