fix: SpawnPoint waypoint persistence after bed/anchor destruction or obstruction#309
fix: SpawnPoint waypoint persistence after bed/anchor destruction or obstruction#309VadimTotok wants to merge 1 commit into
Conversation
… obstructed respawn - Add block state check to detect removed bed or anchor - Add delayed check for obstructed spawn position after death - Handle respawn anchor charge depletion - Refactor: extract helper methods, improve readability
|
of your check ideas, i think the only the one i would maybe add is to remove the spawn point after the player death-respawns (needs to be distinct from join, teleport, etc) somewhere else than nearby it. vanilla will send a the root issue is the true spawn point is server-side data, and the server does not share that info with players. and the checks here are not even aligned with when the server actually changes the data in vanilla, the spawn point is still set server-side even when a bed is broken or obstructed. it is not unset server-side until the instant you respawn while it was broken/obstructed. meaning a broken/obstructed bed can be replaced or later unobstructed, and you will spawn there. |
The SpawnPoint module originally only tracked when a respawn point was set, but never removed the waypoint when the bed or respawn anchor was destroyed, obstructed, or its anchor charge depleted. This caused the waypoint to remain on the map even though the respawn point was no longer valid.
Block existence check: every tick, if the chunk is loaded, verify that the saved coordinates still contain a bed (or a charged respawn anchor). If not, the waypoint is removed immediately.
Obstructed detection: after respawning, wait 5 ticks for client position sync, then check if the player actually spawned in a valid location near the bed/anchor. If not, the waypoint is removed.
Respawn anchor charge: for nether respawn anchors, the block must also have
CHARGE > 0, otherwise it's treated as invalid.Race condition prevention: added a 3-second timestamp guard after
RespawnPointSetEventto avoid falsely detecting the block as missing before the server updates its state.