Shovinus / ChopDownUpdated

Realistic Minecraft Tree Chopping
Other
6 stars 3 forks source link

Forestry: tile entities not being moved #6

Closed Shovinus closed 6 years ago

Shovinus commented 6 years ago

ForestryMC/ForestryMC#2118

Shovinus commented 6 years ago

@Nedelosk I take it I would have to update the tile entities position when it finishes falling?

Nedelosk commented 6 years ago

You don't realy have to move the tile entity. You only have to transfer the data the tile had before you felled it. You can do that with writeToNBT and readFromNBT. Never use setWorld or setPos only vanila should call them.

Shovinus commented 6 years ago
public static class EntityFallingBlock extends net.minecraft.entity.item.EntityFallingBlock {

        EntityFallingBlock(World worldIn, double x, double y, double z, IBlockState fallingBlockState,TileEntity tile) {            
            super(worldIn, x, y, z, fallingBlockState);
            super.readFromNBT(tile.getTileData());
        }

would that in theory work then if I passed the tile in (will add exceptions for not existing)

Shovinus commented 6 years ago

Nope, the leaves disappear in that scenario

Nedelosk commented 6 years ago

You can't use getTileData you have to use tile.writeToNBT and it is tileEntityData = tile.writeToNBT(new NBTTagCompound()) and not super.readFromNBT(tile.getTileData()).

Shovinus commented 6 years ago

Ffs can't debug on 1.10.2 with forestry for some reason, even tried reinstalling the enviroment: https://pastebin.com/Wke7dZS5

Shovinus commented 6 years ago

OK well got it to work on 1.12.2 and that works :) the falling entity changes to the default texture while it falls but when it lands it corrects itself. I wonder if I could maybe lookup the texture from a mapping if a forestry tree. https://imgur.com/a/dQ0xVi7

Shovinus commented 6 years ago

Thank you for your help Nedelosk :)

Shovinus commented 6 years ago

bb8825c2635793783d75b2c885a71b05eb88740e fixes most of the issue but not textures on falling