diff --git a/README.md b/README.md index c8ae1d65c..9a816e6b2 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docs/parity/blocks.md b/docs/parity/blocks.md index 0ecd1db48..4c5bbfb76 100644 --- a/docs/parity/blocks.md +++ b/docs/parity/blocks.md @@ -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 diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 807b875cb..c5a6a43f5 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -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