Skip to content

fix: SpawnPoint waypoint persistence after bed/anchor destruction or obstruction#309

Open
VadimTotok wants to merge 1 commit into
rfresh2:1.20.1from
VadimTotok:1.20.1
Open

fix: SpawnPoint waypoint persistence after bed/anchor destruction or obstruction#309
VadimTotok wants to merge 1 commit into
rfresh2:1.20.1from
VadimTotok:1.20.1

Conversation

@VadimTotok

Copy link
Copy Markdown

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 RespawnPointSetEvent to avoid falsely detecting the block as missing before the server updates its state.

… 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
@rfresh2

rfresh2 commented Jun 20, 2026

Copy link
Copy Markdown
Owner

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 ClientboundGameEventPacket that makes the client display You have no home bed or charged respawn anchor, or it was obstructed. a hook on the client packet listener class could catch that and post an event.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants