Jump to content

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


FredTargaryen
 Share

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.
 Share



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I figured out what was wrong ... you can spot it pretty quick most likely: { "type": "minecraft:smelting", "ingredient": { "item": "minecraft:gold_nugget_ore" }, "result": "minecraft:gold_nugget", "experience": 0.25, "cookingtime": 150 }   ... so, after changing `minecraft` to `foundations` for all the custom items and all the recipes work. Well that's what copy/paste will get you. One last question about recipes, though. What does the following json key/value do in the game? "group": "copper_ingot"  
    • # Copyright (c) 1993-2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # #      102.54.94.97     rhino.acme.com          # source server #       38.25.63.10     x.acme.com              # x client host # localhost name resolution is handled within DNS itself. #    127.0.0.1       localhost #    ::1             localhost ###0.0.0.0 apps.corel.com ###0.0.0.0 mc.corel.com 0.0.0.0 origin-mc.corel.com ###0.0.0.0 iws.corel.com
    • Is there a way to create a custom map marker for a custom structure/biome (same as a vanilla mansion)?
    • I’ve scrounged the Internet for solutions and found absolutely nothing that has worked for me I have posted my code in a GitHub Repository. I bet the culprit is somewhere in the Container or TileEntity classes (Furnace packages are in blocks/coke_furnace or blocks/foundry) PS I know I’m on 1.12.2 and that it’s not supported I don’t want to update my game or my code. Lol It’s my favorite version and the most widely modded. I don’t plan to release the mod, I’m just customizing my game to my will. I’ll send it to friends but that’s it.
    • 1.19.2 With forge 43.2.4   https://mclo.gs/zCAx1MG      
  • Topics

×
×
  • Create New...

Important Information

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