CharsetMC / Charset

The Charset Project for Minecraft.
http://charset.asie.pl/
62 stars 30 forks source link

Fix containers being openable after destroyed #454

Open democat3457 opened 3 years ago

democat3457 commented 3 years ago

Implements the fix stated on https://www.curseforge.com/minecraft/mc-mods/containerfix.

This PR fixes the fact that if you remain in a container's inventory after the container gets destroyed, you don't get booted out of the GUI by adding a check for if the tile entity at that location is still present.

copygirl commented 3 years ago

This doesn't check the distance, does it?

democat3457 commented 3 years ago

no, but I just tested it, and the GUI was uninteractable after moving farther away using a minecart - would the (possibly redundant) distance check still be useful to put in regardless?

asiekierka commented 2 years ago

Shouldn't the container's tile entity be invalidated?

democat3457 commented 2 years ago

Shouldn't the container's tile entity be invalidated?

what do you mean? the method doesnt check anything on containerHandler regarding whether it still exists, and the bug definitely exists before this pull request - and the only null check that exists will still return true if the player is the te owner

asiekierka commented 2 years ago

isOwnerPresent() should be calling the TileEntity's isInvalid() method.

democat3457 commented 2 years ago

Hmm it must be that the TileEntity is never getting invalidate() called when destroyed

asiekierka commented 2 years ago

It might be that it doesn't propagate to the client side.

democat3457 commented 8 months ago

@asiekierka Could this get merged anyway? It theoretically should be redundant if the invalidate() behavior worked properly, but the bug still exists, and this works as a patch in the meantime.