Entities turn invisible upon the player's death when on the death screen.
Steps to reproduce
Die when you have items in your inventory
See your items explode everywhere
See your items disappear
Linked issues
is duplicated by 2
relates to 2
Attachments
Comments 18
Related to MC-29375
Does the chunk unload and stop ticking on death? I wonder if that’s why this happens. Still a problem on 1.21.5 and 1.21.6 snapshots.
This is caused because of how LivingEntity handles death events. When an entity is killed and finishes their death animation, RemovalReason “KILLED” is called which removes said entity from chunk tracking. While this works for regular entities, players can still see the world on the death screen, and being “removed” as a player causes a ghost world state where all ticks are frozen, entities stop updating, and block updates are ignored.
Discovered a fix:
In ChunkMap, removeEntity calls broadcastRemoved. Simply remove the call to broadcastRemoved for ServerPlayer in the isDeadOrDying state. This fixes the issue without causing respawn issues.
Similar post but modded. MC-228047