Document block entity removal, immediate drops and copper golems

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-12 17:33:49 +02:00
parent 13102892c4
commit 8f80f8decf
3 changed files with 54 additions and 2 deletions
+2 -2
View File
@@ -42,7 +42,7 @@ round-trip harness has not been rerun.
| Interaction and inventory | 1 | None: menu clicks match over 6,000 click sequences |
| Menus, HUD and chat | 0.75 | Commands parse as vanilla over 39,685 inputs, but /item modify, /spectate, /waypoint and /dialog do not run; no tab list or world border rendering |
| Audio | 0.75 | Sound engine, music and ambience not compared with vanilla |
| Block behaviours and ticking | 0.75 | Block updates, random ticks, redstone and dispensers match vanilla; a container replaced by another block keeps its contents instead of spilling them, and there are no copper golems |
| Block behaviours and ticking | 0.75 | Block updates, random ticks, redstone, dispensers and block entity removal (containers spill, 4,000 cases) match vanilla; the copper golem's chest-sorting AI is not compared |
### Next steps
@@ -50,7 +50,7 @@ round-trip harness has not been rerun.
2. Draw every item through the item model pipeline, and add the resource pack screen.
3. An audio harness: sound engine attenuation, weighted sound events, music and ambience.
4. A mob AI harness, and an oracle for drowned, villagers, traders and the wither.
5. The missing commands, containers spilling when replaced, copper golems, the tab list and world border rendering.
5. The missing commands, the copper golem's brain (chest sorting) in the mob AI harness, the tab list and world border rendering.
6. Test LAN hosting with a vanilla client, and add a dedicated server mode.
```sh
+16
View File
@@ -106,8 +106,24 @@ containers, weather-driven blocks. The library code lives in
- Their screens use the vanilla hopper and dispenser layouts.
- `GameLevel::max_y` is exclusive, as `LevelAccess` documents.
- **Block entity removal** (`level/removal.rs`, `game/spill.rs`):
`LevelChunk.setBlockState` runs `BlockEntity.preRemoveSideEffects` when a
block's block entity goes with it. Containers spill through
`Containers.dropItemStack`, jukeboxes and lecterns pop their item, shulker
boxes keep theirs, copper chests and statues keep theirs across weathering.
`Block.dropResources` draws when the behaviour calls it and awards ore,
sculk and spawner experience; the item entities join the world before the
behaviour returns.
- **Copper golems** (`mobs/copper_golem.rs`, `game/copper_golems.rs`): built
from a pumpkin on a copper block (`CopperChestBlock.getFromCopperBlock`),
sheared and equipped by dispensers, weathering, waxing, statues.
## Verification
- `tools/test_block_removal_parity.py`: 4,000 replacements, destructions and
removals of block entity holders with contents match vanilla. The dispenser
harness builds, shears and equips copper golems (6,000 cases match).
- Unit tests in `crates/horizon-world/src/level/growth_tests.rs` cover:
- every sapling kind, including the 2×2 trees
- azalea and mangrove growth
+36
View File
@@ -445,6 +445,42 @@ The [contained-fluid comparison](world-data.md#contained-fluid-states) adds
and surface/camera height queries. It covers every pinned block state and query
failures; fluid spreading, entity interactions and rendering remain pending.
## Block entity removal, drops and copper golems
`LevelChunk.setBlockState` runs `BlockEntity.preRemoveSideEffects` when a
block with a block entity is replaced by another block (`LevelAccess::remove_block_entity`,
`level/removal.rs`): containers spill every slot through `Containers.dropItemStack`
(chests, barrels, copper chests, hoppers, dispensers, droppers, crafters,
furnaces, brewing stands, chiseled bookshelves, shelves, decorated pots and
campfires, the last four from the block entities kept as loaded), jukeboxes pop
their record, lecterns their book, and shulker boxes keep their contents for the
dropped box. Copper chests and statues keep their block entity across
weathering, and `UPDATE_SKIP_BLOCK_ENTITY_SIDEEFFECTS` skips the spill.
`Block.dropResources` draws its loot and pop spots when the behaviour calls it,
with ore, sculk and spawner experience, and the item entities and orbs the
behaviour makes join the world before it returns, in the same tick. Player
mining, explosions and `/setblock`/`/fill destroy` use the same path in
vanilla's order.
`tools/test_block_removal_parity.py` replaces, destroys and removes every block
entity holder with random contents (4,000 cases) against `VanillaDispenserOracle`
running vanilla's `setBlock`/`destroyBlock`/`removeBlock`, and compares block
changes, contents left, item entities and orbs, events, sounds and the level
random: all cases match. The block update oracle replays the same removal, so
the block update, random tick and redstone harnesses cover it too.
The copper golem is a species: its model, weathered textures and glowing eyes,
keyframe animations (compared by the entity model harness), sounds, weathering,
waxing and scraping, statues, saved `weather_state` and `next_weather_age`, death
loot (entity death loot harness), the poppy iron golems give it, and building it
from a pumpkin on a copper block (the copper block becomes the matching copper
chest). The dispenser harness builds, shears and equips copper golems against
vanilla. Its chest-sorting AI (`CopperGolemAi` with
`TransportItemsBetweenContainers`) still runs as goals that follow vanilla's
behaviour without its brain: porting it onto the brain machinery of
`mobs/villager_brain.rs` and comparing it in the mob AI harness, which needs
container contents in the probe's world, is still to do.
## Overlay feature composition
The Rust overlay feature executes every child placed feature in order and