diff --git a/crates/horizon-client/src/game.rs b/crates/horizon-client/src/game.rs index 1c9b21b49..652b30e32 100644 --- a/crates/horizon-client/src/game.rs +++ b/crates/horizon-client/src/game.rs @@ -273,10 +273,9 @@ struct Options { benchmark: Option, /// `--dev-mod PATH` (repeatable): mods always on and reloaded when rebuilt. dev_mods: Vec, - /// `--server-thread` or `HORIZON_SERVER_THREAD=1`: single player runs on an - /// integrated server thread (game/integrated.rs), as vanilla's does. Off by - /// default again until a server's players can board, ride and hit - /// vehicles (#1222); `--no-server-thread` keeps it off. + /// Single player runs on an integrated server thread (game/integrated.rs), + /// as vanilla's does: the default. `--no-server-thread` or + /// `HORIZON_SERVER_THREAD=0` runs the world in the frame instead. server_thread: bool, /// Set on the integrated server's own options: it draws nothing, so it skips meshing. integrated: bool, @@ -333,7 +332,7 @@ impl Options { dev_mods: Vec::new(), // The command harness (HORIZON_COMMAND_SCRIPT) drives the world // itself, without the event loop: it stays in the frame. - server_thread: std::env::var("HORIZON_SERVER_THREAD").is_ok_and(|v| v == "1") + server_thread: std::env::var("HORIZON_SERVER_THREAD").map_or(true, |v| v != "0") && std::env::var_os("HORIZON_COMMAND_SCRIPT").is_none(), integrated: false, }; @@ -343,7 +342,7 @@ impl Options { match arg.as_str() { "--help" | "-h" => { println!( - "Horizon — Minecraft Java Edition {} in Rust\n\n --resources PATH Prepared resources (horizon-prepare)\n --render-distance N Chunks, 2..64 (default 12)\n --world NAME World folder under saves/ (default \"New World\")\n --seed N World seed for new worlds (default 0)\n --creative Creative mode (default survival)\n --test-terrain Simple test terrain instead of vanilla generation\n --frames N Exit after N frames (testing)\n --world-frames N Exit after N frames drawn in the world (testing)\n --smoke-report PATH Write a JSON report on exit\n --benchmark SCENARIO Run a benchmark (standard, village, forest, ocean, mountain), write its report to benchmarks/ and quit\n --control Accept horizon-ctl commands on a local socket\n --control-socket PATH Control socket path (default $XDG_RUNTIME_DIR/horizon-control.sock)\n --server HOST[:PORT] Join a multiplayer server (offline mode) at start\n --name NAME Player name for multiplayer (default: generated once, kept in horizon-player.txt)\n --session-file PATH Signed-in account from the launcher (read once, then deleted)\n --dev-mod PATH A Horizon mod (.hmod or folder) to develop: always on, reloaded when rebuilt\n --server-thread Run single player's world on its server thread (no vehicles yet)\n\nControls: mouse look, WASD move, Space jump, Left Shift sneak, Left Ctrl sprint,\nleft click break, right click place/use, 1-9/scroll hotbar, E inventory,\nQ drop, F3 debug, Esc pause.", + "Horizon — Minecraft Java Edition {} in Rust\n\n --resources PATH Prepared resources (horizon-prepare)\n --render-distance N Chunks, 2..64 (default 12)\n --world NAME World folder under saves/ (default \"New World\")\n --seed N World seed for new worlds (default 0)\n --creative Creative mode (default survival)\n --test-terrain Simple test terrain instead of vanilla generation\n --frames N Exit after N frames (testing)\n --world-frames N Exit after N frames drawn in the world (testing)\n --smoke-report PATH Write a JSON report on exit\n --benchmark SCENARIO Run a benchmark (standard, village, forest, ocean, mountain), write its report to benchmarks/ and quit\n --control Accept horizon-ctl commands on a local socket\n --control-socket PATH Control socket path (default $XDG_RUNTIME_DIR/horizon-control.sock)\n --server HOST[:PORT] Join a multiplayer server (offline mode) at start\n --name NAME Player name for multiplayer (default: generated once, kept in horizon-player.txt)\n --session-file PATH Signed-in account from the launcher (read once, then deleted)\n --dev-mod PATH A Horizon mod (.hmod or folder) to develop: always on, reloaded when rebuilt\n --no-server-thread Run single player's world in the frame, not on its server thread\n\nControls: mouse look, WASD move, Space jump, Left Shift sneak, Left Ctrl sprint,\nleft click break, right click place/use, 1-9/scroll hotbar, E inventory,\nQ drop, F3 debug, Esc pause.", horizon_core::VANILLA_VERSION ); return Ok(None); diff --git a/crates/horizon-client/src/game/integrated.rs b/crates/horizon-client/src/game/integrated.rs index 1bd3c7696..ef5775174 100644 --- a/crates/horizon-client/src/game/integrated.rs +++ b/crates/horizon-client/src/game/integrated.rs @@ -6,10 +6,9 @@ //! the world's options) with [`Integrated::call`], as vanilla's client calls //! into its `IntegratedServer`. //! -//! Opt-in again (`--server-thread` or `HORIZON_SERVER_THREAD=1`): it was the -//! default for one day, but a server's players can't board, ride or hit -//! boats and minecarts yet (#1222), and single player's window is one of -//! them here. +//! On by default. `--no-server-thread` or `HORIZON_SERVER_THREAD=0` runs +//! the world in the frame instead (the escape hatch while the network +//! player's side catches up with the in-frame one). use super::{ Game, Options, PackResources, Resources, UiResources, lan::{LanSettings, Owner}, diff --git a/tools/lan_e2e.py b/tools/lan_e2e.py index cc1dc9fcf..082a517b1 100755 --- a/tools/lan_e2e.py +++ b/tools/lan_e2e.py @@ -116,8 +116,6 @@ address. The script then checks, from both sides, what a guest's game used to ge 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). @@ -159,7 +157,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', 'ladder', 'boats'] +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'] class Game: @@ -2312,51 +2310,6 @@ def check_ladder(host, guest, out): 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) @@ -2669,18 +2622,13 @@ 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, 'ladder': check_ladder, 'boats': check_boats} + '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} def run(ctl, out, resources, checks): host, guest = Game('host', ctl, resources), Game('guest', ctl, resources) - # 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) + # Either way explicitly: the game's default is the server thread. + host.d.env['HORIZON_SERVER_THREAD'] = '1' if SERVER_THREAD else '0' results = {} try: host.pid = host('launch', wait=False, offscreen=sys.platform == 'darwin')['pid']