Merge the updated stack base (with origin/main) into fix/server-respawn-levels

No conflicts: brings the base branch's merge of origin/main into this stacked branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-22 22:58:17 +02:00
124 changed files with 6637 additions and 717 deletions
+46 -2
View File
@@ -10,7 +10,8 @@ the options scenario reads and sets options.txt values by key; the events scenar
states (wait-for) and reads the event log; the consume scenario eats and drinks consumables (a
golden apple, milk, honey, chorus fruit) and checks their effects, remainders and teleport; the
pick scenario middle-clicks slots (AbstractContainerScreen's cloning): a full stack in creative, from
the hotbar and from an item tab, and nothing in survival.
the hotbar and from an item tab, and nothing in survival; the suggestions scenario checks
slash-command Tab completion on single player's connected client after a fresh launch.
python3 tools/agent_control_e2e.py # both modes
python3 tools/agent_control_e2e.py --mode mcp # one of them
@@ -45,6 +46,7 @@ LOG_KINDS = ['oak_log', 'birch_log', 'spruce_log', 'jungle_log', 'acacia_log', '
'mangrove_log', 'cherry_log']
# Positional arguments of the commands the scenario uses, for the CLI.
POSITIONAL = {
'key': ['key', 'action'],
'goto': ['x', 'y', 'z'], 'break': ['x', 'y', 'z'], 'place': ['x', 'y', 'z'], 'block': ['x', 'y', 'z'],
'find_block': ['block', 'radius'], 'entities': ['radius', 'type'], 'click_slot': ['slot'],
'click_button': ['label'], 'type': ['text'], 'wait': ['ticks'], 'wait_ready': ['seconds'],
@@ -522,8 +524,50 @@ def pick_scenario(d, out):
return {'cloned': shown['item']}
def suggestions_scenario(d, out):
# Start from the title screen: single player's client joins through memory,
# without opening a server world and building its command registries.
d('click', id='singleplayer')
if 'game' not in widgets(d):
d('click', id='create-new-world')
d('type', field='name', replace=True, text='Suggestions')
d('click', id='game-mode') # survival -> hardcore -> creative (commands on)
d('click', id='game-mode')
d('type', field='seed', text='5')
d('click', id='world')
d('click', id='world-type') # superflat: this checks chat, without a spawn search
d('click', id='create-new-world')
d('wait_for', condition='loaded', timeout=400)
d('wait_ready', seconds=400)
cases = [
('/giv', '/give'),
('/fill ^', '/fill ^ ^'),
('/give @s diamond_sw', '/give @s minecraft:diamond_sword'),
('/setblock ~ ~ ~ diamond_blo', '/setblock ~ ~ ~ minecraft:diamond_block'),
('/fill ~ ~ ~ ~1 ~1 ~1 diamond_blo', '/fill ~ ~ ~ ~1 ~1 ~1 minecraft:diamond_block'),
('/setblock ~ ~ ~ oak_stairs[fa', '/setblock ~ ~ ~ oak_stairs[facing='),
('/clear @s diamond_sw', '/clear @s minecraft:diamond_sword'),
('/execute run give @s diamond_sw', '/execute run give @s minecraft:diamond_sword'),
]
for text, expected in cases:
d('key', key='t', action='tap')
d('type', text=text)
if text == '/give @s diamond_sw':
shot = d('screenshot', path=str((out / f'{d.name}-suggestions.png').resolve()))
if '_image' in shot:
(out / f'{d.name}-suggestions.png').write_bytes(shot['_image'])
d('key', key='tab', action='tap')
actual = d('screen')['chat_input']
assert actual == expected, (text, expected, actual)
d('key', key='esc', action='tap')
if d('screen')['screen'] == 'chat': # Escape first dismisses suggestions
d('key', key='esc', action='tap')
return {'completions': len(cases)}
SCENARIOS = {'survival': scenario, 'ui': ui_scenario, 'options': options_scenario, 'events': events_scenario,
'consume': consume_scenario, 'pick': pick_scenario}
'consume': consume_scenario, 'pick': pick_scenario, 'suggestions': suggestions_scenario}
def run(mode, ctl, out, resources, which='survival'):
+87 -4
View File
@@ -121,6 +121,10 @@ address. The script then checks, from both sides, what a guest's game used to ge
server's game time after the guest's game stalls for a few seconds (#848).
- growth: far from the host, the chunks around the guest tick (#890): water placed there flows
and wheat on farmland grows (random ticks), however the host runs its world.
- ladder: the guest climbs down ten blocks of ladder and lands unhurt: the server resets its fall
distance on a ladder every tick, as LivingEntity.handleOnClimbable does (#1255).
- boats: the host (single player, on its server thread with --server-thread) right-clicks a
boat on water and rides it, sneaks out, and breaks it with its fists (#1222).
- flight: a player in creative double-taps jump and flies, stays up, and stops flying in survival:
the guest, and on the server thread the host's window too, take what may fly from the
server's abilities (ClientPacketListener.handlePlayerAbilities).
@@ -162,7 +166,7 @@ ROOT = Path(__file__).resolve().parents[1]
GUEST_NAME = 'Guest'
# The host plays single player on its server thread (--server-thread).
SERVER_THREAD = False
CHECKS = ['tab', 'self', 'armour', 'nametags', 'walls', 'chest', 'crafting', 'sign', 'damage', 'mobs', 'hazards', 'pvp', 'arrows', 'kills', 'hurt', 'respawn', 'containers', 'feedback', 'titles', 'chat', 'commands', 'recipes', 'machines', 'brewing', 'loom', 'stonecutter', 'grindstone', 'anvil', 'smithing', 'enchanting', 'beacon', 'crafter', 'lectern', 'cartography', 'trials', 'clicks', 'sleep', 'predict', 'push', 'eat', 'eating', 'xp', 'objects', 'projectiles', 'worn', 'blast', 'barter', 'deflect', 'fireball', 'light', 'time', 'swings', 'cracks', 'plates', 'effects', 'portals', 'distance', 'growth', 'flight', 'levels']
CHECKS = ['tab', 'self', 'armour', 'nametags', 'walls', 'chest', 'crafting', 'sign', 'damage', 'mobs', 'hazards', 'pvp', 'arrows', 'kills', 'hurt', 'respawn', 'containers', 'feedback', 'titles', 'chat', 'commands', 'recipes', 'machines', 'brewing', 'loom', 'stonecutter', 'grindstone', 'anvil', 'smithing', 'enchanting', 'beacon', 'crafter', 'lectern', 'cartography', 'trials', 'clicks', 'sleep', 'predict', 'push', 'eat', 'eating', 'xp', 'objects', 'projectiles', 'worn', 'blast', 'barter', 'deflect', 'fireball', 'light', 'time', 'swings', 'cracks', 'plates', 'effects', 'portals', 'distance', 'growth', 'flight', 'ladder', 'boats', 'levels']
class Game:
@@ -2573,6 +2577,80 @@ def check_flight(host, guest, out):
return seen
def check_ladder(host, guest, out):
"""#1255: climbing down a ladder doesn't hurt where the guest lands."""
x, y, z = (int(v // 1) for v in pos_of(guest))
lx, lz = x + 6, z
guest('command', command='gamemode survival')
guest('command', command=f'fill {lx - 2} {y} {lz - 2} {lx + 2} {y + 12} {lz + 2} minecraft:air')
guest('command', command=f'fill {lx - 2} {y - 1} {lz - 2} {lx + 2} {y - 1} {lz + 2} minecraft:stone')
guest('command', command=f'fill {lx} {y} {lz + 1} {lx} {y + 10} {lz + 1} minecraft:stone')
guest('command', command=f'fill {lx} {y} {lz} {lx} {y + 10} {lz} minecraft:ladder[facing=north]')
guest.wait(10)
try:
before = remote(guest)['health']
# No input on a ladder: the guest slides down at 0.15 a tick (LivingEntity.handleOnClimbable).
guest('command', command=f'tp @s {lx + 0.5} {y + 10} {lz + 0.4} 0 0')
for _ in range(40):
guest.wait(5)
if pos_of(guest)[1] < y + 0.01:
break
guest.wait(20)
landed, after = pos_of(guest), remote(guest)['health']
assert landed[1] < y + 0.01, f'the guest stayed on the ladder at {landed}'
assert after >= before, f'climbing down ten blocks of ladder took the guest from {before} to {after} health'
return {'landed': landed, 'health': after}
finally:
guest('command', command=f'fill {lx} {y} {lz} {lx} {y + 10} {lz + 1} minecraft:air')
guest('command', command=f'tp @s {x + 0.5} {y} {z + 0.5}')
def check_boats(host, guest, out):
"""#1222: the single player boards a boat on water with a right click, sneaks out, and breaks it."""
x, y, z = (int(v // 1) for v in pos_of(host))
bx = x + 3
host('command', command='gamemode survival')
host('command', command=f'fill {bx - 1} {y} {z - 1} {bx + 1} {y + 3} {z + 1} minecraft:air')
host('command', command=f'fill {bx - 1} {y - 1} {z - 1} {bx + 1} {y - 1} {z + 1} minecraft:water')
host('command', command=f'summon minecraft:oak_boat {bx + 0.5} {y - 0.1} {z + 0.5}')
host.wait(30)
boats = [o for o in host('status')['objects'] if o['kind'].endswith('oak_boat')
and abs(o['position'][0] - (bx + 0.5)) < 2 and abs(o['position'][2] - (z + 0.5)) < 2]
try:
assert boats, 'the host sees no boat on the water'
boat = boats[0]
bp = boat['position']
host.raw('look-at', f'{bp[0]:.2f}', f'{bp[1] + 0.3:.2f}', f'{bp[2]:.2f}')
host.raw('mouse', 'right', 'click')
host.wait(10)
riding = host('status').get('riding')
assert riding == boat['id'], f'right-clicking the boat {boat["id"]}: riding {riding}'
host.raw('key', 'shift', 'down')
host.wait(10)
host.raw('key', 'shift', 'up')
host.wait(10)
riding = host('status').get('riding')
assert riding is None, f'sneaking out of the boat: riding {riding}'
host('command', command=f'tp @s {x + 0.5} {y} {z + 0.5}')
host.wait(5)
gone = False
for _ in range(10):
here = [o for o in host('status')['objects'] if o['id'] == boat['id']]
if not here:
gone = True
break
bp = here[0]['position']
host.raw('look-at', f'{bp[0]:.2f}', f'{bp[1] + 0.3:.2f}', f'{bp[2]:.2f}')
host.raw('mouse', 'left', 'click')
# VehicleEntity.tick takes 1 off the damage every tick: hit fast.
host.wait(2)
assert gone, 'ten hits left the boat in place'
return {'boat': boat['id'], 'rode': True, 'broken': True}
finally:
host('command', command=f'kill @e[type=minecraft:oak_boat,x={bx},y={y},z={z},distance=..6]')
host('command', command=f'fill {bx - 1} {y - 1} {z - 1} {bx + 1} {y - 1} {z + 1} minecraft:stone')
def check_growth(host, guest, out):
"""Block ticks near a guest 1000 blocks from the host: only the guest's tickets tick them."""
x0, y0, z0 = pos_of(guest)
@@ -2885,14 +2963,19 @@ CHECK_FNS = {'tab': check_tab, 'self': check_self, 'armour': check_armour, 'name
'xp': check_xp, 'objects': check_objects, 'projectiles': check_projectiles, 'blast': check_blast,
'light': check_light, 'plates': check_plates,
'swings': check_swings, 'cracks': check_cracks,
'time': check_time, 'growth': check_growth, 'flight': check_flight, 'fireball': check_fireball, 'deflect': check_deflect, 'barter': check_barter, 'worn': check_worn, 'kills': check_kills, 'arrows': check_arrows, 'predict': check_predict,
'time': check_time, 'growth': check_growth, 'flight': check_flight, 'fireball': check_fireball, 'deflect': check_deflect, 'barter': check_barter, 'worn': check_worn, 'kills': check_kills, 'arrows': check_arrows, 'predict': check_predict, 'ladder': check_ladder, 'boats': check_boats,
'levels': check_levels}
def run(ctl, out, resources, checks):
host, guest = Game('host', ctl, resources), Game('guest', ctl, resources)
# Either way explicitly: the game's default is the server thread.
host.d.env['HORIZON_SERVER_THREAD'] = '1' if SERVER_THREAD else '0'
# Without --server-thread the host runs the game's default, the world in the frame, as players
# get it (`boats` fails there if the default goes back to the server thread before it has
# vehicles, #1222).
if SERVER_THREAD:
host.d.env['HORIZON_SERVER_THREAD'] = '1'
else:
host.d.env.pop('HORIZON_SERVER_THREAD', None)
results = {}
try:
host.pid = host('launch', wait=False, offscreen=sys.platform == 'darwin')['pid']
+1 -1
View File
@@ -6,7 +6,7 @@
python3 tools/release_channels.py promote --tag v2026.10.19.03 --force # even if blocked or untested
python3 tools/release_channels.py promote --dry-run # say what would happen, change nothing
Every game release goes out as a beta (a GitHub pre-release): launchers on the Nightly channel install it at once.
Every game release goes out as a beta (a GitHub pre-release): launchers on the Alpha channel install it at once.
Stable moves once a day, at PROMOTE_AT (20:00 UTC). A beta is due for stable when:
- it is newer than the stable release (GitHub's "latest", which launchers and servers install by default),
- it had been out PROMOTE_AFTER (6 hours) at the day's promotion time, so every run until the next one picks the
+2 -2
View File
@@ -37,7 +37,7 @@ import sys
ROOT = Path(__file__).resolve().parents[1]
REPO = os.environ.get("GITHUB_REPOSITORY", "ludovic111/horizon")
# Nightly builds ship constantly: a merge starts a release within minutes, once its wave of merges has settled.
# Alpha builds ship constantly: a merge starts a release within minutes, once its wave of merges has settled.
DEBOUNCE = dt.timedelta(minutes=5)
MAX_WAIT = dt.timedelta(minutes=20)
# Kept as typed in release titles, where the clauses after the first are lowercased.
@@ -72,7 +72,7 @@ LAUNCHER_IGNORED = ["launcher/links.json", "launcher/docs/", "launcher/tests/"]
FOOTER = {
"game": "Install or update it from the Horizon launcher: it installs new versions by itself. "
"New here? Get the launcher at https://playhorizon.dev. You need your own copy of Minecraft: Java Edition.",
"beta": "This is a nightly build: launchers on the Nightly channel (Settings, Updates) install it now; Stable gets it "
"beta": "This is an alpha build: launchers on the Alpha channel (Settings, Updates) install it now; Stable gets it "
"in the next daily update if it holds up.",
"launcher": "Your launcher updates itself. New here? Download the archive for your system below, extract it, "
"and run `horizon-launcher`. Website: https://playhorizon.dev",
+10
View File
@@ -69,6 +69,16 @@ def cases(count):
'history': rng.sample(HISTORY, rng.randint(0, len(HISTORY))), 'autoSuggest': rng.random() < 0.85,
'chatOnly': rng.random() < 0.7, 'opacity': rng.choice([0.0, 0.5, 1.0]), 'actions': actions,
'mouse': list(mouse), 'blink': rng.choice([0, 100, 400, 650])})
# Always exercise registry-backed suggestions and their replacement ranges,
# before and after Tab, including the redirect through execute's root.
for text in ['/give @s diamond_sw', '/setblock ~ ~ ~ sto', '/fill ~ ~ ~ ~1 ~1 ~1 sto',
'/setblock ~ ~ ~ oak_stairs[fa', '/clear @s diamond_sw',
'/execute run give @s diamond_sw', '/fill ']:
for keys in [[], ['tab'], ['tab', 'tab', 'shift+tab']]:
out.append({'width': 640, 'height': 360, 'initial': '', 'history': [], 'autoSuggest': True,
'chatOnly': True, 'opacity': 0.5, 'mouse': [0, 0], 'blink': 0,
'actions': [{'type': 'type', 'text': text}]
+ [{'type': 'key', 'key': key} for key in keys]})
return out
+2 -1
View File
@@ -67,6 +67,7 @@ if __name__ == '__main__':
'firework-tooltip-parity', 'VanillaFireworkTooltipOracle', 'firework_tooltip_fixture', cases,
'Firework rocket and star tooltip lines: flight duration, explosions (counted runs), colours, fade, trail, '
'twinkle, defaults and tooltip_display',
sources=[lab.ROOT / 'crates/horizon-client/src/item_tooltip.rs', lab.ROOT / 'crates/horizon-client/src/item_data.rs',
sources=[lab.ROOT / 'crates/horizon-client/src/enchant.rs',
lab.ROOT / 'crates/horizon-client/src/item_tooltip.rs', lab.ROOT / 'crates/horizon-client/src/item_data.rs',
lab.ROOT / 'crates/horizon-client/src/particles.rs'],
expected_lines=COUNT)
+6
View File
@@ -69,6 +69,12 @@ def block_hit(pos, face=1):
def scenarios():
stone = {TARGETS[0]: 'minecraft:stone', TARGETS[1]: 'minecraft:dirt', TARGETS[2]: 'minecraft:glass'}
# Consecutive instant survival breaks have no destroy delay. Cover both
# zero hardness and a shovel with haste reaching one-tick destroy progress.
for block, main, haste in [('minecraft:short_grass', None, None),
('minecraft:dirt', ['minecraft:diamond_shovel', 1], 9)]:
steps = [step(block_hit(p), ac=int(i == 0), ad=True) for i, p in enumerate(TARGETS)]
yield case(steps + [step()] * 6, main=main, blocks={p: block for p in TARGETS}, haste=haste)
for creative in (False, True):
for main in ITEMS:
# Hold attack on blocks until they break, then on the air behind.
+6 -4
View File
@@ -2,10 +2,12 @@
"""Compare selected-slot drops with Minecraft.handleKeybinds in all four game modes.
The oracle invokes the unmodified native key handler, consuming real drop-key
clicks. Its controlled dropItem callback removes from the real player Inventory;
other keys are idle and execution stops at the following item-use boundary.
clicks, and MultiPlayerGameMode.dropItem's real prediction and swing dispatch.
Other keys are idle and execution stops at the following item-use boundary.
Checks Q/Ctrl+Q, slots 0/8, empty/single/partial/full stacks and repeated drops.
Packet delivery, item entities, swing animation and statistics are outside scope.
Checks swing attempts and drop packet counts, including packets without swings
for empty slots. Packet delivery, animation ticks, item entities and statistics
are outside scope.
"""
import os
import subprocess
@@ -35,7 +37,7 @@ def main():
subprocess.run(['cargo', 'run', '--quiet', '-p', 'horizon-client', '--example',
'held_drop_fixture'], cwd=lab.ROOT, stdout=out, check=True)
matched = base.compare(build / 'vanilla.txt', build / 'rust.txt')
print(f'Held drop parity passed: {matched} selected-stack/drop-count snapshots match vanilla')
print(f'Held drop parity passed: {matched} inventory/drop/swing/packet snapshots match vanilla')
if __name__ == '__main__':
+17 -1
View File
@@ -68,6 +68,22 @@ def generate(resources, count, seed):
return cases
def obstruction_cases(resources):
"""Placement failures must not predict a hand swing.
Exercise BlockItem.canPlace's entity-obstruction gate with the same
otherwise valid placements, including partial shapes and two-block items.
"""
facts = json.loads((resources / 'facts.json').read_text())
states = {s[0]: i for i, s in reversed(list(enumerate(facts['states'])))}
stone = states['minecraft:stone']
for item in ['minecraft:stone', 'minecraft:oak_slab', 'minecraft:oak_stairs',
'minecraft:oak_door', 'minecraft:torch']:
for obstructed in [False, True]:
yield dict(seed=0, item=item, pos=[0, 0, 0], face=1, hit=[0.5, 1.0, 0.5],
yaw=0, pitch=45, sneak=False, cells=[[0, 0, 0, stone]], obstructed=obstructed)
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--count', type=int, default=20000)
@@ -77,7 +93,7 @@ def main():
resources = lab.LOCAL / 'horizon-client' / lock['minecraft']['version']
work = lab.LOCAL / 'level-place-parity'
work.mkdir(parents=True, exist_ok=True)
cases = generate(resources, args.count, args.seed)
cases = list(obstruction_cases(resources)) + generate(resources, args.count, args.seed)
(work / 'cases.jsonl').write_text(''.join(json.dumps(case) + '\n' for case in cases))
classes = work / 'classes'
classes.mkdir(exist_ok=True)