Mohist icon indicating copy to clipboard operation
Mohist copied to clipboard

Block Entities (Tile Entities) do not report being removed after being removed from a Level/World

Open bergerkiller opened this issue 1 year ago • 2 comments

Minecraft Version : 1.12.2

Mohist Version : 321

Operating System : Windows

Logs : Theres no errors or warnings reported / unrelated

Mod list : No mods installed.

Plugin list : BKCommonLib and TrainCarts

Description of issue : I'm relying heavily on the "world is set to null" and "set removed" feature of Tile Entities (Block Entities) to detect whether a tile entity I have is removed from the world or not. This is faster than checking whether it is mapped / stored in a list of the World. As this runs every tick to verify state, speed is important.

public boolean isRemoved() { return instance.y() || !instance.u(); } // Must also validate world isn't null Source to what is checked (This is remapped to the appropriate forge method names at runtime)

The methods it call look like this on spigot/paper:

    public boolean y() {
        return this.d;
    }

    public boolean u() {
        return this.world != null;
    }

Neither method report the block entities have been removed when for example a sign is removed, placed or when using the /blockdata command to edit lines of the sign which re-creates a new block entity.

I'll probably add some workaround for mohist specifically to check against world anyway. But ideally this bug is fixed to get rid of the performance penalty that causes.

I should add: the above works perfectly fine on spigot/paper 1.12.2 and all forks I know of.

bergerkiller avatar Sep 19 '22 16:09 bergerkiller

Hello, thanks for opening this issue!

Before continuing, please understand that Mohist is a free and open source software, made by people in their free time. Know that we are not able to give any eta about when your issue will get answered or fixed.

Our team will first check if your issue isn't duplicated. If it's the case, we will close your issue, giving your the number of the other issue so that you can follow its progress. If you are able to do it, please check that your issue isn't duplicated, this would help us a lot.

Thank you for your patience, and have a nice day (or night)!

MohistBOT avatar Sep 19 '22 16:09 MohistBOT

Mohist 1.16.5 and beyond do not appear to be affected by this bug. Given, its probably a single line of code missing somewhere that marks it as removed (sets world null)

bergerkiller avatar Sep 19 '22 16:09 bergerkiller