A remote client (a LAN guest, or the game on its server thread) threw away
the light in each LevelChunkWithLight and relit the column and its
neighbours itself. It now applies the sky and block layers as
ClientPacketListener.applyLightData does, and relights only block changes,
as vanilla's client does.
The hub now sends ClientboundLightUpdatePacket for the light sections that
changed in a column to the players for whom it is on the tracked border
(ChunkHolder.broadcastChanges), so light from blocks a guest doesn't track
reaches it.
horizon-ctl gains 'light X1 Y1 Z1 X2 Y2 Z2', and lan_e2e a 'light' check
comparing the guest's light with the host's.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
IntegratedServer.tickServer: the server takes the window's render and
simulation distances when they change ("Changing view distance to N, from
M"), tells every player (SetChunkCacheRadius, SetSimulationDistance), and
each player's chunks follow, up to what they asked for. The integrated
server no longer clamps the view distance to 32, and a remote client sends
its render distance again when it changes (Options.broadcastOptions),
past 32 too. Fixes#804.
lan_e2e: a distance check (--server-thread), and the guest is found by
name in lan status, where the server thread lists the owner too: the
hazards check read the owner's food (the "no hunger from moving" gap).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A remote client's chat now sends ServerboundCommandSuggestionPacket for an
argument node whose provider is minecraft:ask_server (bossbar ids, data
storage, datapacks, team names, functions...), as ClientSuggestionProvider.customSuggestion
does. The suggestions are done when ClientboundCommandSuggestionsPacket
answers that id; its completions join the local ones (Suggestions.merge).
Replies to older requests are dropped.
The remote tree takes each node's provider from the packet only: a local
provider the server didn't send stood in for the server's before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TitleCommand sends the targeted player ClientboundSetTitleText,
SetSubtitleText, SetActionBarText, SetTitlesAnimation and ClearTitles. A
guest's /title (the window's own player on the server thread too) only
changed the server's HUD; it is now sent to the guest. The remote client
showed titles and action bars as a bare line and ignored subtitles, times
and clearing; it now feeds the HUD's titles as ClientPacketListener does
(the action bar of a SystemChat overlay too) and ticks them (Gui.tick).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The hub held SetHealth back once a guest died, so the guest's health
stayed at its last positive value under the death screen. ServerPlayer
sends it every tick it changes, dead or not, and only when the health or
the food level changes or the saturation reaches or leaves zero: the hub
sent it on every change of saturation too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CommandSourceStack.broadcastToAdmins beyond a guest on a dedicated server:
- The dedicated server's console tells every operator what its commands
did, as `[Server: ...]`, when `broadcast-console-to-ops` is on
(DedicatedServer.shouldInformAdmins). This covers the game's commands
and the dedicated-only ones vanilla broadcasts (op, deop, ban, pardon,
kick, whitelist, save-all, save-on/off, stop).
- In a world open to LAN, the host, an operator when commands are
allowed, hears of its guests' commands, and op guests hear of the
host's.
- A player's name in the line is their display name, with the `/tell`
suggestion, the entity hover and the insertion (Player.getDisplayName).
New harness test_server_ops_feedback_parity: two vanilla-codec
operators' system chat while the console and one of them run commands,
deop and op, toggle send_command_feedback and save, with
broadcast-console-to-ops on and off. LocatorBarClient can record system
chat (`chat on`). lan_e2e's feedback check also asserts the host is told.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Horizon client of a server places what PR #766 sends: primed TNT with
its fuse, falling blocks with their block state and start position,
arrows (critical, in the ground), snowballs, eggs, pearls, fireballs,
wither skulls, wind charges and llama spit, tridents, firework rockets
and end crystals with their beam and base. They interpolate like mobs,
turn with the move packets, and are cleared with the connection, a
respawn or a dimension change.
`status` lists them (`projectiles`), and lan_e2e has a `projectiles`
check: the guest sees the host's primed TNT, end crystal and landed
arrow where the host has them, and a falling block lands on both sides.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ClientPacketListener.handleAddEntity for the objects a server tracks: a
Horizon client of a server (a LAN host, a dedicated server, single
player's server thread) now places the boats, minecarts, armor stands,
item frames and paintings it is sent, where the server says.
- Spawn: carts by kind, boats and rafts by wood (with a chest), armor
stands, frames and paintings at their block with the direction from the
spawn data.
- Entity data: frame items and rotation, painting variants (a registry
holder), armor stand flags and health, boat paddles, vehicle hurt.
- Equipment: what an armor stand wears and holds.
- Moves interpolate like mobs'; rotation and ground state follow.
- They are cleared with the connection, a respawn or a dimension change.
`status` lists them (`objects`), and lan_e2e has an `objects` check: the
host summons them, the guest sees each as the host has it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a LAN world or a server, guests never got experience: orbs followed and
were taken only by the host's own player (none on a dedicated server), and
guests weren't sent orbs at all.
- Each orb follows the nearest living, non-spectator player within 8
blocks, the host or a guest (ExperienceOrb.followNearbyPlayer).
- A guest takes an orb as Player.aiStep does: one of those in its box grown
by 1, 0.5, 1, at random, at most every 2 ticks (takeXpDelay), repairing
with Mending first; the rest goes to the guest's experience (sent with
SetExperience as before), the level-up sound every fifth level.
TakeItemEntity goes to the players around, the pickup sound plays at the
orb.
- Orbs have entity ids and are tracked to guests (AddEntity, DATA_VALUE).
The client shows a server's orbs, moves them with the server's packets and
flies them to their collector.
tools/lan_e2e.py xp: three 7-point orbs near the guest: it sees three and
ends at level 2 (21 points); the host gets none.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A mob's push of a guest went to the guest as SetEntityMotion carrying the
server copy's velocity, which nothing damps: every tick of contact added
to it and replaced what the guest's client was doing. Vanilla pushes
players on their own client only (EntitySelector.pushableBy): the server
no longer sends those pushes, and a server client now pushes its player
away from every living entity it touches (Entity.push, team rules, no
spectators, bats or passengers of the same vehicle).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a LAN world or a server, a guest's clicks that went through the menu
engine (placing a carried stack, quick craft drags, double clicks, number
keys, Q) ran only on the guest's own copy and were never sent: the item
showed in the chest or furnace, the server still had it in the inventory,
and the next menu brought it back.
menu_ops now sends every click of the server's open menu as vanilla's
MultiPlayerGameMode.handleContainerInput does: the engine predicts it on
the client's copy, then a ContainerClick goes out with the slots it changed
and the carried stack after it (a drag is its three kinds of clicks). The
plain inventory and crafting table are predicted too, the Shift double click
sends each QUICK_MOVE, and a prediction no longer drops, crafts or makes maps
on the client (the server does).
tools/lan_e2e.py clicks: real mouse presses put a stack into a chest and a
furnace, drag planks over the crafting grid and craft; the server has each.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A server client sent UseItem and never started the use itself, so food
showed no eating animation or crumbs, and holding right click sent a new
UseItem every 4 ticks. Like MultiPlayerGameMode.useItem, the client now
starts eating (Consumable.startConsuming), counts the use down for the
animation and its particles, and starts no other use until it ends; the
server still eats the item. Looking at another player no longer stops
the item from being used (Player.interactOn passes).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The bed's sleeping state, timer and respawn point were the host's fields,
so a guest clicking a bed put the host to sleep and moved the host's
spawn. as_guest now swaps them with the guest's own; the guest gets its
sleeping pose and bed (entity data 14), wakes on STOP_SLEEPING with the
WAKE_UP animation, and the night skips only once enough players sleep
(players_sleeping_percentage). Guests respawn at their own bed, else the
world spawn. Server clients lie in the bed from the synced position.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a server, single player's server thread included, the inventory
had no recipe book: the window ignored the recipe book packets, and
the server ignored a guest's ServerboundPlaceRecipePacket.
- horizon-protocol decodes the recipe book's packets and the recipe
displays they carry: RecipeBookAdd / Remove / Settings,
PlaceGhostRecipe and the serverbound PlaceRecipe. Every 26.3
`recipe_display` and `slot_display` type is decoded (shaped,
shapeless, furnace, stonecutter and smithing displays; empty,
any_fuel, with_any_potion, only_with_component, item, item_stack,
tag, dyed, smithing_trim, with_remainder and composite slots).
- The remote client keeps the book the server sends (ClientRecipeBook:
added, highlighted, removed, replaced), shows the unlock toast,
applies the open and filter settings, and counts the menu the
server last sent for the craftable filter. Clicking a recipe sends
PlaceRecipe; a ghost recipe from the server fades in.
- The server handles a guest's PlaceRecipe in the inventory grid and
the crafting table (ServerPlaceRecipe on the menu engine, for known
recipes only) and answers with the slots, or a ghost recipe when the
items are missing.
- The screen state reports the recipe book's buttons.
lan_e2e.py gains a `recipes` check: the guest gets oak logs, opens the
book, clicks the planks recipe, and a log lands in the grid.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The window dropped ClientboundCommandsPacket ("argument nodes are not
decoded"), so on a server, single player's server thread included,
the chat was a bare input line without completion, colouring or usage.
- horizon-protocol decodes argument nodes: the 26.3
`command_argument_type` ids and every parser's properties
(ArgumentTypeInfo.deserializeFromNetwork), plus the custom
suggestion provider.
- command::network turns the tree into a Dispatcher. A node at a path
the client's vanilla tree also has takes that node's argument type
and suggestion provider; any other node takes the type its parser
and properties describe.
- On a server the chat is ChatScreen over that tree, so Tab completes,
arguments are coloured, usage and errors show, and Enter sends the
command to the server. Player-name suggestions come from the
server's player list. The old bare input line is gone.
- The screen state reports the chat input (`chat_input`).
lan_e2e.py gains a `commands` check: the guest completes `/gamem` to
`/gamemode` and `/gamemode cr` to `/gamemode creative` with Tab, and
the command runs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a server (the integrated server thread and the dedicated server)
the host has no player of its own, so effects that only touched the
host's player reached nobody; on a LAN world they reached only the
host. Beacons, the warden's and shriekers' darkness, the elder
guardian's mining fatigue, splash and lingering potions' splash and
the raid victory's Hero of the Village now run for each player in
the level, guests through `as_guest`.
The elder guardian's curse sends the guest the GUARDIAN_ELDER_EFFECT
game event, which the remote client now shows (the apparition and
the curse sound).
lan_e2e.py gains an `effects` check: a speed beacon next to both
players must give both of them speed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A server (the dedicated server and single player's server thread) now
holds a level per dimension, like vanilla's `MinecraftServer.levels`. Each
server tick runs every level with players in it, one at a time, by swapping
its fields into place (game/levels.rs), so the world tick code runs
unchanged. Before this, a portal did nothing while two or more players were
online.
- Levels: the parked levels keep the world, streaming, save, block ticks,
entities, block entity state, raids, sculk and creaking scans. The
Overworld stays loaded; another level is saved and closed after 300 ticks
with nobody in it. Saving saves every level.
- Hub: `tick` is split into `poll` (the network, once per tick),
`tick_level` (the packets, chunks, block changes, containers and entities
of the players in the level in place) and `end_tick` (latency). Each guest
has a dimension; time, weather, sounds and events reach only the players
in their level, and the clock and weather last sent are kept per level.
- Travel: every player has their own portal state; a portal moves only that
player into the destination's level (`ServerPlayer.teleport` packets as
before). Respawning brings a player back to the Overworld's level.
- Player data saves and loads each player's dimension, and a returning
player is placed in their own level.
- tools/lan_e2e.py --server-thread --check portals: the guest goes to the
Nether while the host stays, then the host goes to the End while the guest
is in the Nether, and both come back.
The in-frame game keeps its one level that follows its player.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A guest's action runs on the host's game with the guest's state swapped in
(`as_guest`). The swap restored the open screen but not what opening one
does to the window: `capture(false)` released the host's pointer, so the
cursor showed and the camera stopped whenever a guest opened a chest, a
crafting table or any other menu. `keys.clear()` dropped the keys the host
was holding, and a sign, book, command block or mount menu the guest opened
was drawn on the host's screen.
- `capture` leaves the window alone while a guest acts.
- `as_guest` keeps the host's held keys, sign editor, book, command block
screen and mount menu, as it already kept the open screen.
- `state` reports `pointer_grabbed` (mouse movement turns the camera).
- tools/lan_e2e.py: `chest` and `crafting` check that the host keeps its
screen and its mouse look; a new `sign` check places a sign as the guest.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SubmitNodeCollection.submitNameTag: a name that is not discrete is drawn
in full over the world and, faded on its background, again with
RenderPipelines.TEXT_SEE_THROUGH (no depth test) after the rest of the
world; a discrete one (a crouching player) only once, faded, on its
background. The background is ARGB.color(0.25, black): alpha 0x3F.
Part of #435
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PlayerDetector reads level.getPlayers(): the guests count for a trial
spawner's detection and a vault's connected players, and a key a guest
inserts rewards the guest's UUID.
Part of #462
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Feedback about the player (target_name) names the guest a command runs
for. A client reading a server's chat now unwraps NbtOps' {"": value}
wrapper of any bare value, not only strings, so translation arguments that
are numbers show ("Replaced 1 slot(s)", the coordinates). horizon-ctl
messages reads a server's chat too.
Part of #435
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The hub's container menus now say where their slots live (lan::menu::Slots):
one block entity, both halves of a double chest (CompoundContainer, the right
half first) or the guest's own ender inventory (PlayerEnderChestContainer,
saved as EnderItems). The host's ender inventory stays the host's while a
guest acts. A Horizon client shows a server's chest-like menu with the rows
and title the server sent, and keeps its slots off a block that holds no such
container.
Part of #435
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Player.attack on a player: the host hits the guest on its crosshair, a guest
hits the host or another guest. The hit is worked out as the attacker
(Game::melee_damage, shared with attacking mobs) and lands on the victim as a
player_attack (blocking, armour, knockback to the guest's client), when the
pvp game rule allows it (ServerPlayer.canHarmPlayer).
Part of #435
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The host now runs the rest of the server's body tick for each guest:
LivingEntity.baseTick's drowning and lava, fire blocks, suffocation
(isInWall) and the void (checkBelowWorld, 4 a tick, creative too), and per
move handleMovePlayer's jump (ServerPlayer.jumpFromGround's exhaustion) and
checkMovementStatistics (sprinting, swimming). The first move of a tick now
starts from the ground state before it, so take-offs are seen. Hurt sounds
are heard at the guest; lan status lists each guest's health and food.
Part of #435
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since #372 a guest's commands need the world's Allow Commands as well as
the LAN's; the test's survival world had none, so every guest command (tp,
gamemode, setblock) was refused and the checks built on them failed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each mob sees the nearest player (host or guest), as Level.getNearestPlayer
gives it, and keeps a guest it targets or that hurt it in the last 100 ticks.
Its hits, pushes, fire and launches on that player run with the guest swapped
in; mobs' projectiles hit guests too, and knockback reaches the guest's client
(SetEntityMotion on its own entity).
Part of #435
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two Horizon games under horizon-ctl, each with its own scratch home: the
host opens a survival world to LAN with commands, the guest joins by
address, and each check (tab, self, armour, nametags, chest, crafting,
damage) is reported on its own with screenshots of both sides.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>