Skip to content

Minecraft: Java Edition 26.3 rewritten from scratch in Rust, checked against vanilla with 281 differential harnesses. Get it with the Horizon launcher.

Merge origin/main

HrafnaValkyrja2ca605090cb1
diff --cc tools/lan_e2e.py
index 749ed32ef,e2c2d8d44..172bff678
--- a/tools/lan_e2e.py
+++ b/tools/lan_e2e.py
@@@ -11606,45 -11640,72 +11640,112 @@@ CHECKS += ['blast-bystanders'
CHECK_FNS['blast-bystanders'] = check_blast_bystanders
+def check_selector_tags(host, guest, out):
+ """`@e[tag=]` and `/tag` find summoned experience orbs, arrows, thrown items, fireballs and wind
+ charges, and `/data get entity` reads a wind charge (vanilla 26.3, same scene: every kind is found
+ by its summoned Tags; sbs.py selkinds)."""
+ x, y, z = (int(v // 1) for v in pos_of(host))
+ kinds = ['experience_orb', 'arrow', 'snowball', 'egg', 'ender_pearl', 'fireball', 'small_fireball', 'wind_charge']
+ row = (x, y + 8, z + 4)
+ seen = {}
+
+ def marker(i, selector):
+ spot = (row[0] + i, row[1], row[2])
+ host('command', command=f'setblock {spot[0]} {spot[1]} {spot[2]} minecraft:air')
+ host('command', command=f'execute if {selector} run setblock {spot[0]} {spot[1]} {spot[2]} minecraft:gold_block')
+ host.wait(2)
+ return host.raw('block', *spot).get('block') == 'minecraft:gold_block'
+
+ try:
+ host('command', command='gamemode creative')
+ host('command', command='tick freeze')
+ for i, k in enumerate(kinds):
+ host('command', command=f'summon minecraft:{k} {x + 0.5 + i} {y + 20} {z + 0.5} '
+ f'{{NoGravity:1b,Tags:["sel_{k}"],Motion:[0.0d,0.0d,0.0d]}}')
+ host('command', command='summon minecraft:snowball ~ ~20 ~ {NoGravity:1b,Motion:[0.0d,0.0d,0.0d]}')
+ host('command', command='tag @e[type=minecraft:snowball,tag=!sel_snowball] add sel_late')
+ host.wait(4)
+ for i, k in enumerate(kinds):
+ seen[k] = marker(i, f'entity @e[tag=sel_{k}]')
+ seen['late'] = marker(len(kinds), 'entity @e[tag=sel_late]')
+ seen['data'] = marker(len(kinds) + 1, 'data entity @e[type=minecraft:wind_charge,limit=1] Pos')
+ finally:
+ host('command', command='tick unfreeze')
+ host('command', command='kill @e[type=!player]')
+ assert all(seen.values()), f'the selector cannot see these: {[k for k, v in seen.items() if not v]}'
+ return seen
+
+
+CHECKS += ['selector-tags']
+CHECK_FNS['selector-tags'] = check_selector_tags
+
+
+ def check_mining_drop_latency(host, guest, out):
+ """An instant survival break sends its drop in the tick that handles START (#4572).
+
+ Queue the click behind the server barrier, then release it at one TPS. A
+ snapshot taken before tick_guests delays the drop until the next second.
+ Both the integrated owner and a LAN guest must see the first snapshot.
+ """
+ hx, _, hz = pos_of(host)
+ x, y, z = int(hx), 100, int(hz)
+ seen = {}
+ try:
+ host('command', command=f'fill {x-5} {y-1} {z-5} {x+5} {y-1} {z+5} minecraft:stone')
+ host('command', command=f'fill {x-5} {y} {z-5} {x+5} {y+4} {z+5} minecraft:air')
+ for player in (host, guest):
+ player('command', command='clear @s')
+ player('command', command='gamemode survival')
+ for player, other in ((host, guest), (guest, host)):
+ host('command', command='tick rate 20')
+ host('command', command='kill @e[type=minecraft:item]')
+ player('command', command=f'tp @s {x+0.5} {y} {z-3.5}')
+ other('command', command=f'tp @s {x+3.5} {y} {z+0.5}')
+ host('command', command=f'setblock {x} {y} {z} minecraft:torch')
+ player.wait(20)
+ assert all(g.raw('block', x, y, z).get('block') == 'minecraft:torch'
+ for g in (host, guest)), 'torch did not reach both clients'
+ player.raw('look-at', x+0.5, y+0.3, z+0.5)
+ host('command', command='tick rate 1')
+ host.raw('server-hold', 'on')
+ try:
+ player.raw('mouse', 'left', 'click')
+ # The client's input tick also slows to one TPS. Wait for its
+ # prediction while transport runs and the server is still held.
+ deadline = time.monotonic() + 3
+ while player.raw('block', x, y, z).get('block') != 'minecraft:air':
+ assert time.monotonic() < deadline, \
+ f'{player.name}: client did not predict the instant break'
+ time.sleep(0.02)
+ finally:
+ host.raw('server-hold', 'off')
+ started = time.monotonic()
+ arrivals = {}
+ while time.monotonic() - started < 0.75 and len(arrivals) < 2:
+ for viewer in (host, guest):
+ if viewer.name in arrivals:
+ continue
+ entities = viewer.raw('entities', 24, 'minecraft:item')['entities']
+ if any(abs(e['pos'][0] - x - 0.5) < 2
+ and abs(e['pos'][2] - z - 0.5) < 2 for e in entities):
+ arrivals[viewer.name] = round(time.monotonic() - started, 3)
+ time.sleep(0.01)
+ seen[player.name] = arrivals
+ lab.write_json(out / 'mining-drop-latency.json', seen)
+ assert len(arrivals) == 2, \
+ f'{player.name}: drop waited for a second server tick: {seen}'
+ finally:
+ host.raw('server-hold', 'off')
+ host('command', command='tick rate 20')
+ host('command', command='kill @e[type=minecraft:item]')
+ for player in (host, guest):
+ player.raw('release')
+ return seen
+
+
+ CHECKS += ['mining-drop-latency']
+ CHECK_FNS['mining-drop-latency'] = check_mining_drop_latency
+
+
if __name__ == '__main__':
main()