GTNewHorizons / GT-New-Horizons-Modpack

New Modpack with Gregtech, Thaumcraft and Witchery
https://www.gtnewhorizons.com/
Other
986 stars 299 forks source link

Heart containers are lost if server is restarted while player is in respawn screen #17611

Open leumasme opened 1 week ago

leumasme commented 1 week ago

Your GTNH Discord Username

leumasme

Your Pack Version

2.6.1

Your Server

Tested SP and private server

Java Version

Java 21

Type of Server

Vanilla Forge

Your Expectation

Tinkers Construct Heart containers, when placed in their dedicated slots, are (already) not lost on death. This should work consistently.

The Reality

If the server is restarted while the player is on the respawn screen (In SP, a game relaunch is required. Just exiting to main menu does not seem to trigger the bug), all heart containers are lost upon joining and respawning. This also happens if the player leaves the server while on the respawn screen, and then the server restarts before the player rejoins and respawns.

Your Proposal

Make heart containers be properly saved even for dead players on server restart.

Final Checklist

leumasme commented 1 week ago

It seems like TPlayerStats holds the data about the thinkers extra slots. On respawn, this TPlayerStats data is restored; loaded from a class member variable playerData https://github.com/GTNewHorizons/TinkersConstruct/blob/master/src/main/java/tconstruct/armor/player/TPlayerHandler.java#L188-L194 The data in this map is set on death and restored to the player on respawn. If the server is restarted in between death and respawn, the player data is absent from the map so it can't restored on respawn, thus the heart canisters are lost.