Commit Graph

13 Commits

Author SHA1 Message Date
Ludovic Marie 002f14ce53 Merge pull request #692 from ludovic111/feat/locator-bar
Locator bar for vanilla clients on Horizon servers (waypoint packets as vanilla sends them)
2026-10-17 14:56:09 +02:00
Ludovic Marie 171fbeb8ac Send vanilla clients the locator bar on dedicated and LAN servers
Port 26.3's ServerWaypointManager for the players of a served world: each
player who receives waypoints gets ClientboundTrackedWaypointPacket for
every other player who transmits one, as a block (in view), a chunk (one
chunk out) or an azimuth (really far), with the update thresholds,
breaking rules and team colours vanilla uses. Crouching, invisibility and
a carved pumpkin or mob head hide a player; spectators see everyone and
are seen by no one; the locator_bar game rule turns it all off and on.

tools/test_locator_bar_parity.py runs vanilla's server and Horizon's with
two vanilla-codec players and compares every waypoint packet each receives.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 10:14:34 +02:00
Ludovic Marie ee0f382bdf Merge branch 'fix/client-server-packets' into feat/client-advancements 2026-10-17 08:58:06 +02:00
Ludovic Marie cc8249d2ce Merge remote-tracking branch 'origin/main' into fix/client-server-packets 2026-10-17 08:50:15 +02:00
Ludovic Marie 56a4989560 Network client: show the server's advancements and statistics
ClientboundUpdateAdvancementsPacket and ClientboundAwardStatsPacket are
new in the protocol crate, and the window applies them as vanilla's client
does:

- ClientAdvancements.update: a reset replaces the tree, added advancements
  join it with their place on the tab (DisplayInfo x, y), removed ones go,
  each changed one takes the progress sent, and one that is done in a
  non-reset update with show set gets its toast. The advancements screen
  lays a server's tree out where the server placed it and shows everything
  it sent.
- handleAwardStats: the counters the server sends, by registry name.
  Opening the statistics screen asks for them (StatsScreen.init's
  REQUEST_STATS).

Joining and leaving a server start from empty advancements and statistics.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 07:05:54 +02:00
LookImEcho-Rick aeaccb0413 Fix multiplayer pause menu and World Options permissions 2026-10-16 23:39:36 -05:00
Ludovic Marie cfcf69f0b9 Network client: apply the block entity data, difficulty, spawn, chunk centre, tick rate, animations and server data the server sends
With single player on its server thread, the window is the server's client
and dropped several packets the in-frame game never needed:

- ClientboundBlockEntityDataPacket and the block entities of chunk packets:
  the block entity of that type loads the tag (signs, spawners), as
  handleBlockEntityData and LevelChunk.replaceWithPacketData do.
- ClientboundChangeDifficultyPacket: the level data's difficulty and lock.
- ClientboundSetDefaultSpawnPositionPacket: the respawn data spawn
  compasses point at.
- ClientboundSetChunkCacheCenterPacket: ClientChunkCache's view centre;
  columns outside the storage (the server's radius + 3) are ignored or
  dropped, as ClientChunkCache.Storage does.
- ClientboundAnimatePacket: wake up, and the critical and magic critical
  hit emitters.
- ClientboundTickingStatePacket / ClientboundTickingStepPacket (new in the
  protocol crate): the level's TickRateManager. A frozen level holds its
  time and non-player entities, and the server's rate only ever slows the
  client timer down (Minecraft.getTickTargetMillis).
- ClientboundServerDataPacket: the server list entry keeps a valid icon
  (ServerList.saveSingleServer); single player has no entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 06:37:36 +02:00
Ludovic Marie 6ae018055d Debug charts: F3+2 frame and tick times, F3+3 ping and bandwidth
DebugScreenOverlay's FpsDebugChart, TpsDebugChart, PingDebugChart and
BandwidthDebugChart with vanilla's scales, colours and places: 240 samples
(LocalSampleLogger), F3+2 and F3+3 toggles that show the overlay and exclude
each other, the overlay's "Debug charts" lines, and the play-state ping
request and pong response packets the ping chart uses on servers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 10:16:02 +02:00
Cosmic 25858f63ae Add the F3+F4 game mode switcher 2026-10-14 22:09:12 -04:00
Ludovic Marie 5cb14ee496 Trade over the network: LAN guests and Horizon as a client
The host hands a trading screen a guest's interaction opens to that guest:
OpenScreen (minecraft:merchant), MerchantOffers when the offers change,
the select trade packet, container clicks run on the merchant menu engine,
the TRADE reputation event and prices for the guest's UUID, the payment back
on close. As a client, Horizon shows a server's trading window from its
MerchantOffers and sends select trade and clicks. Stored enchantments, dyed
colours and map ids now travel in item stacks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 22:44:16 +02:00
Ludovic Marie 8a32850f95 Lay out the player list exactly as vanilla PlayerTabOverlay does
tab_list ports PlayerTabOverlay: the comparator (list order, spectators,
team, name ignoring case), the 80-player limit and 20-row columns, heads
with the default skin by UUID and upside-down names, team and spectator
name styling, ping bars, the list objective as integer scores in their
number format or hearts with their change blink and the hp text fallback,
and the wrapped header and footer. Font::split_lines now follows
StringSplitter.splitLines and Text::resolve_legacy applies legacy codes
inside components. test_tab_list_parity runs vanilla's overlay against
examples/tab_list_fixture: 1,000 cases, 3,476 frames, 844,758 calls match.

The protocol gains the scoreboard, team and world border packets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 15:47:55 +02:00
Ludovic Marie b99de58761 Open worlds to LAN
A world can now be opened to the local network from World Options in the pause menu (LAN on or off, port, command access, forcing the game mode, plus the default and personal game mode, cheats and difficulty), or with horizon-ctl lan open. The hosted world runs a server inside the game that speaks the vanilla 26.3 protocol: server list status, offline-mode login, the configuration phase with the synchronized registries and tags (sent as known-pack references to vanilla clients and in full to clients that know no packs), then the play state with chunks and light, time, weather, the player list, the host and other guests as visible players, mobs and dropped items, block changes, chat and keep-alives. Network I/O runs on its own threads and a world that is not open pays one check per tick. A vanilla 26.3 client and a second Horizon client were verified joining and seeing each other and the terrain.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-09 14:12:31 +02:00
Ludovic Marie fa21ea7688 Add horizon-protocol: the 26.3 network protocol (version 777)
Primitive codecs (VarInt/VarLong, strings, positions, LpVec3, BitSets),
VarInt21 framing, zlib threshold compression, AES/CFB8 encryption, MD5
offline UUIDs, network NBT via horizon-world, item stacks with data
component patches, chunk and light payloads with paletted containers,
synched entity data, and typed packets for every connection state in both
directions with round-trip tests. Packet ids are generated from the data
generator's packets report. The probe example logs into a vanilla 26.3
server and decoded ~8000 packets (329 chunks) without errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 15:13:51 +02:00