Commit Graph

3 Commits

Author SHA1 Message Date
Ludovic Marie d271176f23 Tools and harnesses start the game in scratch folders, not a player's
The game logs into HORIZON_HOME and falls back to the player's own game folder when it is unset. Harnesses
that set only HORIZON_NO_AUDIO (and test_native_client, which set nothing) wrote logs, and on a world run
advancements, into ~/Library/Application Support/horizon.

lab.game_env gives every game a fresh HORIZON_HOME, HORIZON_LAUNCHER_HOME, XDG_DATA_HOME and XDG_CONFIG_HOME,
no audio and no launcher self-update; a folder the caller passes is kept. Every launcher of the game uses it,
parity.py gives each harness its own HORIZON_HOME, and tests/test_game_home.py fails for a script in tools/
that starts the game without it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 18:34:32 +02:00
Ludovic Marie 62cacfa607 Mining: the block-removal harness mines blocks as a survival player
test_block_removal_parity gains a "mine" removal: VanillaDispenserOracle
calls the real ServerPlayerGameMode.destroyBlock for a survival player holding
a pickaxe, axe, shovel, sword, shears, a mace or nothing, and Horizon's
dispense fixture calls break_block, the path every player's mining takes (the
single player game, the server thread and LAN guests). It compares the drops,
the spilled contents, experience, sounds, events, statistics and the held
stack. On main it shows every mined container losing its contents (#844, fixed
by #855) and three gaps of Horizon's own, fixed here:

- ItemStack.mineBlock: an item with a tool component counts as used, and wears
  its damage_per_block (2 for swords, the mace and the trident), also the mace
  and trident, whose tool component has no rules. Shears wear on every block
  but fire (ShearsItem.mineBlock).
- DecoratedPotBlock.playerWillDestroy: a pot mined with an item in
  breaks_decorated_pots, unless an enchantment prevents it, cracks first and
  shatters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 16:10:10 +02:00
Ludovic Marie 4490ff75fc Spill block entity contents when their block is replaced, as vanilla does
LevelChunk.setBlockState now runs BlockEntity.preRemoveSideEffects and
removes the block entity when a block with one is replaced by another
block (copper chests and copper golem statues keep theirs across
weathering; UPDATE_SKIP_BLOCK_ENTITY_SIDEEFFECTS skips the side effects).
Containers spill every slot through Containers.dropItemStack (spot and
pieces of 10 to 30 with triangular motions from the level random, empty
slots still drawing their spot), jukeboxes pop their record, lecterns
their book; shulker boxes keep their contents for the dropped box.
Campfires, decorated pots, chiseled bookshelves and shelves, which Horizon
keeps as loaded, spill too.

Block.dropResources now draws its loot and pop spots when the behaviour
calls it, not after it returns, and spawnAfterBreak awards ore, sculk and
spawner experience. Item entities and orbs the behaviour makes are added
before it returns to the game, in the same tick. Player mining follows
ServerPlayerGameMode.destroyBlock's order (removal and spill, tool wear,
then the drops); explosions let the removal spill the contents.
ExperienceOrb.award draws the merge id from the level random and moves
the orb with its own random. Decorated pots copy their decorations and
drop their sherds when cracked (loot tables' dynamic entries).

The block update oracle replays preRemoveSideEffects too, and the new
block removal harness (tools/test_block_removal_parity.py) compares
setBlock/destroyBlock/removeBlock on every block entity holder with
contents against vanilla: 2000/2000 cases match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 16:49:20 +02:00