Skip to content

test-entitydead: entity dead/spool fixes - #2

Draft
MLG-SERBUR wants to merge 8 commits into
enum-validatorfrom
test-entitydead
Draft

MLG-SERBUR wants to merge 8 commits into
enum-validatorfrom
test-entitydead

Conversation

@MLG-SERBUR

Copy link
Copy Markdown
Member

Draft PR to review diff of test-entitydead against enum-validator.

Changes so far

  • a334462 fix: load espinner chunk synchronously and retry on ChunkLoadEvent
  • 0f1a947 fix: re-acquire live entity by UUID before declaring dead; add diagnostics
  • 714a445 fix: prevent re-entrant double-spool of espinner
  • b26609b diag: log entity state transitions; drop forced chunk load
  • 44be2ac fix: simplify entity resolution logic in EntitySpinner; remove stale reference handling

⚠️ Note: this PR targets enum-validator, not master.

Return immediately after selfDestruct() and never re-bind a dead instance via Bukkit.getEntity(uuid).
Resolves startup race where Bukkit.getEntity(uuid) returned null because the chunk was not yet materialized after the async chunk load request. Force a synchronous load before lookup, and re-attempt spooling any un-spun entity spinner when its chunk loads.
…stics

The held entity reference goes stale after its chunk unloads/reloads, so entity.isDead() on the stale ref falsely killed the spinner on rejoin. resolveEntity() now re-fetches the live entity by UUID first: only self-destructs if no live entity exists, otherwise pauses while unloaded and rebinds when the chunk reloads. Adds WARNING/debug logging in the spin loop and in spoolEntitySpinner/ChunkLoadEvent to trace spool and dead-detection.
spoolEntitySpinner() calls World.loadChunk(), which fires ChunkLoadEvent synchronously; the new ChunkLoadEvent handler re-entered spoolEntitySpinner for the same UUID before the outer call registered it, producing two spin tasks (only one tracked by taskID, leaking the other). Guard with a spoolingNow set so a UUID mid-spool is skipped.
resolveEntity() now logs a full snapshot whenever the held reference is unhealthy (heldDead/heldValid, liveLookup present/absent, liveDead/liveValid, sameInstance) plus an originalLogicWouldSelfDestruct flag, throttled to state transitions. Removed the forced World.loadChunk() from spoolEntitySpinner: unspun espinners now wait for their natural ChunkLoadEvent instead of force-loading/generating chunks at startup.
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.

1 participant