Container closing happens too late allowing item duplication
The bug
1.16.2, Mojang names
It appears closing of containers happens too late: Only the next tick instead of directly after the container is destroyed, see also this comment.
Or there should be an additional AbstractContainerMenu.stillValid(Player) before every menu interaction.
Due to net.minecraft.world.Containers.dropContents(Level, double, double, double, Container) not clearing the container this might allow item duplication:
- Player A accesses a container
- In the same tick:
- Another player (or possibly even the same player; modified client might be able to do that) destroys the container, dropping its content
- Player A removes an item from the container
Item duplication
- Now Player A is ticked and AbstractContainerMenu.stillValid(Player) is checked
Check happened too late
Note: This is so far only a theoretical problem and has not been verified yet.
This is related to MC-110498, but not the same issue because shulker boxes collect the items to store in the dropped shulker box in ShulkerBoxBlock.getDrops(BlockState, Builder).