Merge branches 'parity/tooling', 'parity/score-subtitles' and 'parity/block-followups' into parity-base

This commit is contained in:
Ludovic Marie
2026-10-12 17:47:58 +02:00
165 changed files with 23785 additions and 3773 deletions
+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
+91
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
@@ -1288,3 +1324,58 @@ binding. Rendering, transport, full entity lifecycle integration and playable
Linux gameplay remain unfinished. In this pinned version,
`LivingEntity.updateDataBeforeSync` invokes dirty effect synchronization; it is a
separate phase from `tickEffects`.
## Scoreboards, teams and subtitles
`tools/test_scoreboard_parity.py` runs vanilla's own `Scoreboard` (what
`ServerScoreboard` extends) and `horizon_client::scoreboard` on 500 scripted
cases, about 81,000 operations: objectives with every kind of criteria (custom,
team kill, and statistics in every spelling `ObjectiveCriteria.byName` accepts,
which resolve to their canonical names), display names, render types,
auto-updated displays and number formats; scores set, added, read, locked,
given displays and formats, reset, and changed through `forAllObjectives` as the
gameplay criteria change them; display slots; teams with every option, joined,
left, removed and emptied by `Scoreboard.entityRemoved`. Every result must
match, as must each collection in the order vanilla iterates it (objectives,
holders and teams are fastutil open hash maps, each team's members a
`HashSet`; `fastutil_order` keeps the same tables), the
`ScoreboardSaveData.Packed` codec output that `data/minecraft/scoreboard.dat`
holds (fields equal to the codec defaults are left out, components are written
as `ComponentSerialization` writes them), and the data after each side loads
the other's NBT. Only each holder's scores, which vanilla keeps in an
identity-hash map, are compared as a set. `tools/test_save_roundtrip_parity.py`
also builds a scoreboard with every saved field on a vanilla server and requires
the game to save it back unchanged.
`tools/test_team_rules_parity.py` runs vanilla's `Entity.doTeamsAllowDamage`
(friendly fire), `isAlliedTo`, `EntitySelector.pushableBy` (collision rules),
`Entity.isInvisibleTo` (seeing invisible team mates) and
`LivingEntityRenderer.shouldShowName` (name tag visibility, with a stand-in
client) on stand-in entities over 6,000 combinations of two teams' options and
the entities' teams; the game uses the same functions. Mobs on the player's team
never target the player, a creeper's blast spares its team mates when friendly
fire is off, mobs push each other only as their collision rules allow, name tags
show the team's prefix, suffix and colour and the score of the objective
displayed below names, and a team that hides death messages keeps the player's
own death message out of chat. The criteria that follow the player (health,
food, armor, xp, level, air) update as `ServerPlayer.doTick` does, and deaths,
kills, team kills and statistics update their objectives.
`tools/test_subtitle_parity.py` runs vanilla's `SubtitleOverlay` with a
stand-in client on 1,500 scripted cases of sounds reported by the sound engine
(subtitles from sounds.json, positions, ranges, looping) at controlled times,
and frames that render it for a listener transform, the subtitle options (shown
or not, notification display time, text background opacity) and a GUI size.
Every frame's fills and texts, with their pose, must match the overlay in
`hud_overlays`: which captions show and in what order, merging of repeats,
expiry, the fade by age, the direction arrows and the box width. The overlay
listens to the sound engine from the frame that renders it with the option on
until one renders with it off, as vanilla's does.
Not covered yet: the player's air supply (Horizon does not track drowning, so
the `air` criteria stays at 300); displays auto-updated with the player's name
carry the team formatting but not the click, hover and insertion of
`Player.getDisplayName`; there is no attack sweep for allies to be spared from;
scores below other players' names need the multiplayer scoreboard packets,
which the client does not handle yet.