Chunks disappear on death resulting in longer loading terrain screen
MrKinau opened this issue ยท 3 comments
Bug Description
When dying on a Paper server, the chunks immediately disappear, so you can't see them in the death screen. Additionally, since the chunks are no longer rendered, the loading terrain screen that appears after clicking the Respawn button takes much longer.
Video: https://youtu.be/eYxW55Ov5tg
In the video you can see: First part is played with Sodium 0.5.11 1.21 on a Paper 1.21 server, second part is played without Sodium on the same server.
Reproduction Steps
- Join a Paper server (tested with 1.21, but it should be the same with older versions)
- Kill yourself (e.g.
/damage @s 100 minecraft:generic_kill
) - You are not able to see the world in death screen and respawning takes much longer than without sodium
Log File
Crash Report
This bug appears to be a regression in Sodium for Minecraft 1.21. The chunk tracking code might need to be updated to account for other changes in the game.
This is potentially related to #2586.
This is a bug with Paper. They are sending chunk unload packets immediately after the player dies, which causes Sodium to unload them. This is why the chunks disappear behind the death screen, and why the loading screen is shown after respawning (as it is waiting for chunks to be sent back to the client.)
Fundamentally, there is no good way to fix this on our side. The only reason it works correctly in Minecraft is because the renderer isn't even aware of when chunks get unloaded. So it just never does so until new chunks overwrite the existing chunks (or they are too far away from the camera). This behavior is frankly terrible, and is responsible for many graphical bugs and memory leaks, hence why Sodium does not (and will not) mimic it.
The best thing we can do here is at least try to workaround Paper sending the chunk unload packets too early, so they don't disappear on the death screen. But this will not prevent the player from seeing a (short) loading screen when they spawn in the world again.