Structure Editor v1.4.2
Fix: save_structures was silently dropping entities from cold chunks even when the structure's bounds fit entirely inside the SB's own chunk.
The v1.4.1 fix force-loaded every chunk that overlapped the structure's bounds. That got block chunks resident, but not entity chunks: on 1.17+ entities live in a separate per-chunk store managed by PersistentEntitySectionManager and loaded asynchronously, independent of block sections. world.getChunk doesn't touch it, and vanilla saveStructure then iterated entities from a store that hadn't loaded yet — templates came back with zero entities, block counts byte-identical to the correct save.
The 1x4x1 anchor case that reproduces it (single chunk, entity inside the SB's own chunk) ruled out any bounds-computation issue.
Fix: save_structures now runs in two phases:
- Server thread — enumerate every SB in scope, force-load block chunks, and iterate entities in each SB's AABB via
getOtherEntitiesto kick the async entity-section load. - Wait 300ms (~6 ticks) so
PersistentEntitySectionManagerfinishes deserialising the entity files. - Server thread — re-fetch each SB and call
saveStructure.
Safety net: the response now includes entities_captured per SB — the entity count in the bounds at save time. Callers can spot a zero-that-should-not-be-zero (e.g., re-saving an anchor known to hold a mob) and retry rather than silently overwriting a shipped template.
Per Finn's report this bug hit 22 of 261 pieces in a region-wide save before it was caught by diffing entity counts against previously shipped NBTs.