Commit Graph

3685 Commits

Author SHA1 Message Date
Ludovic Marie 22bc86739b Port the villager brain from VillagerGoalPackages
Villagers ran an approximation built from goals. They now run vanilla's
Brain: expiring memories, the nine sensors with their randomly delayed
scan clocks, activities from the villager_activity timeline, and every
package's behaviours (core, work, play, meet, rest, idle, panic, pre-raid,
raid, hide), started and ticked in Brain.availableBehaviorsByPriority's
order with RunOne's shuffles, the level random for behaviour timing and
POI scans, and Villager.refreshBrain when the profession changes.

The mob AI probe prints the activities and memories as the oracle does,
and the harness's three villager scenarios now match: 34/34.
Sleeping villagers take LivingEntity.SLEEPING_DIMENSIONS instead of being
frozen in travel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 13:37:39 +02:00
Ludovic Marie b0527b4818 Check a shulker box's lid room before opening and tick animations only while the world runs
ShulkerBoxBlock.canOpen: a closed box opens only when the half-open lid
box is free of collisions. Bells gather and test entities by their real
bounding boxes and liveness. Client block-entity tickers run with
ClientLevel.tickBlockEntities, which Minecraft.tick skips while paused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 13:32:58 +02:00
Ludovic Marie d48017ab70 Build the player's attack strength model with its tests
Player.attackStrengthTicker and itemSwapTicker: both advance each tick, a
different main-hand item resets them, and getAttackStrengthScale divides
by the ATTACK_SPEED delay. The game does not drive it yet; the attack
indicator still shows full strength until combat uses the cooldown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 13:29:20 +02:00
Ludovic Marie 5b201965af Compare the chat with vanilla's ChatComponent
The chat cases add messages (with the system and error tags) at given Hud
ticks and draw ChatComponent in background mode: wrapping, the 200-tick
fade, scale, width, height, spacing and opacity options. Horizon's chat now
wraps like StringSplitter.splitLines and ComponentRenderUtils.wrapComponents
(the indent on wrapped lines, breaks at the last space, a dropped newline
or space), keeps the options as doubles and draws through a layout with
vanilla's fills and text offsets. A component list whose first part has
empty text now still passes its style to the rest. The harness runs 200
cases per kind.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 13:28:05 +02:00
Ludovic Marie e2b3f7b4e9 Keep unsimulated entities' UUIDs across saves and save player equipment as vanilla
save_entities forgot the UUID and compound of entities Horizon keeps but
does not simulate, so the save on quit gave them new UUIDs. The player's
equipment is written as LivingEntity does: omitted when empty, where
PlayerEquipment.isEmpty also counts the selected hotbar item.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 13:26:18 +02:00
Ludovic Marie ef0c6604a5 Compare camera overlays and the sleep overlay with vanilla's Hud
The overlays cases run Hud.extractCameraOverlays and extractSleepOverlay:
the vignette with its brightness and world border warning, the spyglass
scope and its scopeScale easing (read back and compared), equipment
camera overlays, powder snow, the nether portal sprite and the nausea
swirl. The game feeds its full-screen camera overlays from the same
layout (the vignette option and first person now count), draws the
spyglass with vanilla's unclamped easing and the sleep fade at vanilla's
opacity under the sidebar, titles and chat.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 13:19:38 +02:00
Ludovic Marie 51d4598632 Draw End portals and gateways with vanilla's end portal shader
The entity shader gains rendertype_end_portal as layers 9 (15 portal
layers) and 10 (16 for gateways): end_sky and the rotating, scrolling
layers of end_portal.png projected from the screen, repeated inside their
atlas sprites, with vanilla's GameTime uniform. The world-space
approximation and its portal block scan are gone; the block-entity
renderer draws both blocks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 13:16:32 +02:00
Ludovic Marie 5b53d37e30 Compare item decorations with GuiGraphicsExtractor.itemDecorations
The decor cases run vanilla's itemDecorations on stacks with counts,
durability (Item.getBarWidth/getBarColor), unbreakable stacks and item
cooldowns ticked through ItemCooldowns. Horizon's item drawing now uses
the same layout: the bar rounds and colours like vanilla's and the count
sits at vanilla's offsets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 13:13:12 +02:00
Ludovic Marie 6bc85d48c6 Tick chest lids and enchanting books as vanilla and drive the renderer with it
block_entity_anim now also ports ChestLidController (chests, trapped and
copper chests, ender chests: triggerEvent(1, openCount), tickLid,
getOpenness), ChestBlock.opennessCombiner and ChestRenderer's lid curve,
and EnchantingTableBlockEntity.bookAnimationTick with its render state
(nearest non-spectator player by feet position within 3 blocks, Mth.atan2,
the class's shared RANDOM). The renderer pairs a double chest half with its
neighbour only as DoubleBlockCombiner does (same block, other half, same
facing) and reads the book from BlockAnim instead of ticking its own copy.

The game keeps a BlockEntityAnims and runs the client tickers of every
loaded animated block entity each tick: chest lids, books, shulker boxes,
bells (resonance sound, entity-effect particles, raider glow), conduits
(nautilus particles) and dragon/piglin heads. Opening and closing chests,
ender chests and shulker boxes sends the opener-count block event (both
halves of a double chest); a ring's block event reaches the bell through a
new LevelEvent::BlockEntityEvent. The renderer now gets this state instead
of BlockAnim::default(), so shulker lids, bells, conduits and heads move.

block_entity_anim harness: 256/256 cases (new: 48 chest, 36 book).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 13:12:30 +02:00
Ludovic Marie f55b4281e5 Compare boss bars, the jump bar and the scoreboard sidebar with vanilla
The oracle fills a BossHealthOverlay with LerpingBossEvents, runs
JumpableVehicleBar on a jumpable mount and displayScoreboardSidebar on a
real Scoreboard with teams, display names and number formats. The game
collects the dragon, wither, raid and custom bars into one
BossHealthOverlay layout (the backgrounds and notches now draw in vanilla's
order) and draws the sidebar with the text background options and
String.CASE_INSENSITIVE_ORDER.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 13:10:33 +02:00
Ludovic Marie 613702c0a7 Render End portals and End gateways as vanilla's block-entity renderers
TheEndPortalRenderer and TheEndGatewayRenderer: the position-only portal
cube in FaceInfo order (only the vertical faces for portals, the faces
Block.shouldRenderFace leaves for gateways) and the gateway beam through a
shared submitBeaconBeam. The beacon beam now goes through the same
function. The client does not track gateway ages and cooldowns yet, so
gateways in game render settled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 13:05:36 +02:00
Ludovic Marie b7cfe5578c Compare effect icons, titles, the action bar and the selected item name with vanilla's Hud
The HUD harness now draws cases by kind. The oracle runs Hud.extractEffects,
extractTitle, extractOverlayMessage and extractSelectedItemName after
replaying setTitle/setTimes/setOverlayMessage and Hud.tick, and
hud_overlays lays out the same state: MobEffectInstance ordering through
Java's small-array TimSort, the title and action bar fades, the backdrop
from the text background options and the tool highlight timer. The game
draws its effect icons, titles and action bar through these layouts and
now shows the selected item name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 13:05:05 +02:00
Ludovic Marie 06abd528c5 Merge remote-tracking branch 'origin/t3/achieve-full-parity' into parity/rendering-anim 2026-10-12 12:43:27 +02:00
Ludovic Marie c36190dc4d Merge remote-tracking branch 'origin/t3/achieve-full-parity' into parity/rendering-hud 2026-10-12 12:43:16 +02:00
Ludovic Marie 312d5fc7d2 Hide the whole HUD and the hand with F1, as vanilla does
F1 only hid the chat. Hud.extractRenderState hides the camera overlays,
crosshair, hotbar, effects, bars, sidebar, action bar, titles and chat, and
GameRenderer.renderItemInHand skips the hand; the sleep overlay, debug screen
and open screens still draw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 02:47:37 +02:00
Ludovic Marie c7a2fbb182 Match vanilla wither tick order, underwater checks and gravity
The wither's customServerAiStep (charging, side heads, block breaking,
healing) now runs inside serverAiStep, and aiStep draws the heads' smoke
particle offsets after travel as vanilla does; its steering uses the 0.6F
and Mth.atan2 float maths, and its level-event sounds (shoot, spawn, block
break) no longer draw from its random: MobEvent::LevelEventSound lets the
client pick their pitch. Entity.getGravity is zero while isNoGravity, which
the flying move control sets. Drowned swim with isUnderWater (the previous
tick's eye state, Entity.wasEyeInWater), and the eyes count as in water per
26.3's EntityFluidInteraction (between a water block's bottom and its camera
height) rather than the older 0.11 offset.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 19:18:23 +02:00
Ludovic Marie a466af6adc Match vanilla projectile randoms, witch target goal and enderman goal names
Projectiles shot by mobs (arrows, splash potions, snowballs, llama spit,
wind charges, crossbow bolts, tridents) take their spread, and arrows their
base damage, from the new projectile's own random as vanilla does, leaving
the shooter's random alone. The witch's player target goal reports as
NearestAttackableWitchTargetGoal (NearestTarget gains a subclass label), and
the probe names the enderman goals as vanilla's classes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 19:02:46 +02:00
Ludovic Marie feb043fda6 Merge parity/blocks into parity/hud
Block loot keeps one random-sequence path: the blocks side's block_loot
with the generic loot evaluator, and /loot uses the shared loot_sequence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 19:02:13 +02:00
Ludovic Marie d2c91b513b Match vanilla drowned AI, skeleton weapon goals, trader look goals and monster idle time
Drowned register Zombie's goals and then Drowned.addBehaviourGoals (go to
water, trident and melee attacks with okTarget, go to beach, swim up,
RandomStrollGoal) with DrownedMoveControl, Drowned.travelInWater and
AmphibiousPathNavigation. Skeletons get their bow from finalizeSpawn and
pick the bow goal or the AbstractSkeleton$1 melee goal from the held item,
as reassessWeaponGoal does. Monster.aiStep adds 2 to noActionTime in bright
light (raiders always), which stops RandomStrollGoal; LookAtPlayerGoal
supports Mob.class targets and InteractGoal, used by the wandering trader
(with vanilla's AvoidEntityGoal order), illagers, ravagers and vexes.
Entities below the world take 4 damage a tick instead of vanishing, water
travel uses the 0.8F/0.6F/0.3F float constants, and MobWorld carries the
level's sea level.

The oracle refreshes the player's water state after placing it (it is never
ticked, so isInWater kept the previous scenario's value) and keeps its world
under the harness build directory, deleting it before halting instead of
leaving /tmp/horizon-mob-ai* behind. The probe reports KILLED removals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 18:56:36 +02:00
Ludovic Marie d4144d33b4 Match vanilla zombie turtle-egg goal, entity pushing and raider goal order
Zombies (and husks, drowned, zombie villagers, zombified piglins) now
register ZombieAttackTurtleEggGoal first, as vanilla does, so their goal
selector draws the same random numbers. LivingEntity.pushEntities runs in
aiStep against the player and other mobs, with pushes to other mobs applied
at once as Entity.push does (replacing the post-tick push_apart). Spider
target goals check the light before their random interval, LookAtPlayerGoal
uses the non-combat targeting conditions, raiders register the
PatrollingMonster/Raider goals before their own, and the witch runs its
aiStep (heal cooldown, drinking, particle roll) before super.aiStep with
NearestHealableRaiderTargetGoal's nextBoolean.

The mob AI oracle's player is now a fully loaded, hurtable client: its
connection starts with a 60-tick load timer and 26.3 moved the hurt cooldown
to damageCooldownTime, both of which only ServerPlayer.tick counts down, so
whether mobs could hurt the player depended on the scenario order. The probe
reports the player's hurt sound, and an rng-trace feature records the call
sites of Horizon's mob random draws next to the oracle's trace.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 18:24:38 +02:00
Ludovic Marie 7d35a25906 Format and lint the command parity changes
Clippy and rustfmt clean, and the scoreboard test now expects vanilla's
removeObjective, which keeps holders tracked without scores.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 18:00:32 +02:00
Ludovic Marie 4eb2f53ffb Merge branch 'parity-base' into parity/saves
# Conflicts:
#	README.md
2026-10-11 17:51:57 +02:00
Ludovic Marie 2e775aff2f Merge parity-base into parity/hud 2026-10-11 17:51:39 +02:00
Ludovic Marie d0815052cd Merge branch 'parity-base' into parity/blocks 2026-10-11 17:51:37 +02:00
Ludovic Marie 168bc1d0a3 Merge branch 'parity/loot-spawn' into parity-base 2026-10-11 17:36:20 +02:00
Ludovic Marie 2eb688cc6a Decrypt bytes already read when a connection enables encryption
Encrypted bytes that arrived in the same read as the last plain packet
stayed in the buffer undecrypted, and the connection then waited forever
for a frame it could not parse. The loopback test hit this under load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 17:36:20 +02:00
Ludovic Marie a919e44050 Run /locate biome and poi and /place feature, jigsaw and structure as vanilla
/locate biome samples the biome source like BiomeSource.findClosestBiome3d,
/locate poi scans loaded chunks for PoiTypes block states within 256 blocks,
/place feature places the configured feature with the level random,
/place jigsaw assembles pieces with JigsawPlacement.addPieces and places
them into the level, and unknown structures or pools report vanilla's
errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 17:35:55 +02:00
Ludovic Marie d46fa60400 Run /compute as vanilla's ComputeCommand
Context int and float providers (inline or registered) evaluate with
Java's arithmetic, exceptions and rounding, in the default, block or
entity loot context; their codecs report missing fields as
DataFixerUpper does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 17:24:18 +02:00
Ludovic Marie 17b1bcf2ce Destroy blocks for /setblock and /fill destroy as Level.destroyBlock does
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 17:11:05 +02:00
Ludovic Marie debc6e124c Award tick, inventory and recipe advancements and draw block drops as vanilla
PlayerTrigger.TICK fires every tick and InventoryChangeTrigger as the
inventory changes; /recipe counts recipe book displays and fires
RecipeUnlockedTrigger; block drops draw from their loot table's random
sequence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 17:02:09 +02:00
Ludovic Marie ae3f129c8e Format the dispenser parity work
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 16:54:06 +02:00
Ludovic Marie 753b5654b1 Keep errors inside forked execute chains silent, as vanilla
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 16:51:07 +02:00
Ludovic Marie a47f1ec58b Dispense mobs with their jockeys as vanilla's spawn eggs do
A dispensed spawn egg's mob gets the riders finalizeSpawn adds (chicken
jockeys, spider jockeys, strider jockeys). The harness leaves which mob
comes out a baby and rides to the spawning port's finalization draws, as
it already does for the level random of spawning cases. Cases no longer
grow plants out of a dispenser or build a door from mismatched halves,
and the oracle runs every case three times so an unseeded value is
marked even when two runs happen to agree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 16:50:20 +02:00
Ludovic Marie 00371a7f35 Run /test as vanilla does in a world without test instances
Model TestCommand's release tree (ResourceSelectorArgument patterns
included) and its finder, locate, pos, stop and clear outcomes when no
test instance block exists. Compare /help's gamerule alternatives as a
set: GameRuleCommand registers them in identity-hash order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 16:47:42 +02:00
Ludovic Marie d7e4a5a275 List command usages in vanilla's registration order and run the release tree
Brigadier keeps children in registration order and /help prints them
that way; tools/generate_command_order.py records vanilla's order where
Horizon's tree differs. The game now runs the release integrated
server's tree; HORIZON_DEV_COMMANDS restores the development commands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 16:41:43 +02:00
Ludovic Marie 877165a6c9 Read region headers as vanilla's RegionFile does in the region tests
Invalid allocations are dropped rather than refused, overlaps are not
checked, and an empty or truncated file is a region without chunks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 16:41:30 +02:00
Ludovic Marie 3a875c709e Refuse only worlds older than 1.18.2 when opening them
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 16:39:26 +02:00
Ludovic Marie 8490e19ec0 Resolve nbt text components, other dimensions and vanilla's own data as vanilla
/tellraw resolves nbt components; execute in another dimension sees its
chunks unloaded; the built-in pack's predicates load; holders stay
tracked after their objective is removed; new worlds use the offline
profile id of the player.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 16:34:17 +02:00
Ludovic Marie 6605e6cdf1 Run the dispenser fixture in the oracle's plains light and level
The fixture's chunks are plains (empty chunks read as badlands, which has
no bone meal flowers) and carry the case's sky and block light, as the
oracle level does, so grass bone meal places flowers and crops check
their light like vanilla's. The oracle's client sounds include the lava
fizz (1501). Cases build two-block plants whole: a lone lower half is not
a world vanilla makes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 16:32:28 +02:00
Ludovic Marie 2faf5520b3 Match vanilla /spreadplayers, /datapack, /reload, function tags and dialog codecs
/spreadplayers follows SpreadPlayersCommand (safe positions, failure
distance, float centre); /datapack models the built-in, feature and
world packs with their chat links; unknown function tags are empty.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 16:22:06 +02:00
Ludovic Marie 7994c1e8c5 Count natural spawning among the entity checks that match vanilla
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 16:19:49 +02:00
Ludovic Marie 6949ca4455 Target rarer natural spawns in the parity harness
Desert, snowy, swamp and jungle nights, lush, sulfur and dripstone caves,
warm and frozen oceans, crimson forests and slime chunks. A cube mob grown
by finalizeSpawn takes its constructor's head rotation from the entity's
unseeded random (AbstractCubeMob.onSyncedDataUpdated), so that yaw alone is
not compared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 16:14:22 +02:00
Ludovic Marie 36209e7827 Place dispensed shulker boxes only where DirectionalPlaceContext can
A dispenser places a shulker box in the block in front or nowhere, and
only when that block's canBeReplaced accepts it (a snow layer only when
it is a single layer).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 16:10:30 +02:00
Ludovic Marie b2812c55be Choose natural spawns exactly as vanilla's NaturalSpawner does
tools/test_natural_spawn_parity.py compares whole chunk spawn passes,
spawnCategoryForPosition from chosen sites and chunk generation packs
against vanilla's NaturalSpawner on generated box worlds.

Divergences fixed on the way: the reduced water ambient tag is
reduce_water_ambient_spawns, and the room check uses each type's spawn
dimensions scale (4 for slimes and magma cubes, 2 for sulfur cubes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 16:10:12 +02:00
Ludovic Marie e1eabdc781 Pass the save upgrade harness from 1.18.2: block entity data stays empty
A block entity read inside an item stack remembers the map it was read from;
that memory is not part of the value, so an item's block entity tag with
only its id still counts as empty and is dropped, as in vanilla.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 16:07:10 +02:00
Ludovic Marie 8eca39aff1 Equip, saddle and light from dispensers as vanilla does
Villagers, piglins, piglin brutes, allays, dolphins, foxes and pandas can
pick up loot from construction (their constructors call
setCanPickUpLoot), so they take dispensed equipment without spawn
finalization. Nautilus saddles play item.nautilus_saddle_equip. The
oracle level is the overworld, so fire in an obsidian frame lights a
portal there too, and it answers getEntity(id) and level-wide entity
queries, which leash cutting needs. Unseeded item motion is compared
within its full spread (item motion plus a shearing sheep's push).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 16:07:06 +02:00
Ludovic Marie b5d84b138d Match vanilla /clear predicates, /particle results, block entity NBT and /fillbiome checks
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 16:06:17 +02:00
Ludovic Marie c80edcdbf4 Draw /loot from each table's random sequence, as vanilla
LootTable.getRandomItems uses the table's random_sequence, so /loot
results are deterministic per world seed; inline loot tables and tool
components now work too. The oracle ticks its player like the network
listener does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 15:59:56 +02:00
Ludovic Marie 0de0379cc7 Expect an int page in the click event fix test, as createInt writes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 15:53:55 +02:00
Ludovic Marie 894113d7f4 Build golems and withers from dispensers as vanilla does
Golems and the wither come from EntityType.create (no spawn finalization,
no level random), after clearPatternBlocks sets every pattern cell to air
with flags 2 and a destroy event, and updatePatternBlocks follows. A
dispensed pumpkin that completes a golem skips setBlock's neighbour
updates as vanilla's does, and pumpkins and skulls post block_place.
Dispensed skulls face RotationSegment.convertToSegment(facing). Destroy
events for air play no break sound. The dispenser fixture plays on normal
difficulty like the oracle level.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 15:53:37 +02:00