Skip to content

fix(multiplayer): add LAN server detection for custom theme#8554

Merged
MukjepScarlet merged 9 commits into
CCBlueX:nextgenfrom
Pro0101-2b2fr:fix/lan-server-discovery
Jul 12, 2026
Merged

fix(multiplayer): add LAN server detection for custom theme#8554
MukjepScarlet merged 9 commits into
CCBlueX:nextgenfrom
Pro0101-2b2fr:fix/lan-server-discovery

Conversation

@Pro0101-2b2fr

@Pro0101-2b2fr Pro0101-2b2fr commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Add LAN world detection to the custom theme multiplayer screen, matching vanilla Minecraft behavior.

Changes

  • Backend (Kotlin): UDP multicast listener on 224.0.2.60:4445 for LAN broadcasts
  • REST endpoint: GET /api/v1/client/servers/lan
  • Frontend (Svelte): Polls every 3 seconds, displays LAN servers with tag

Features

  • LAN servers are pinged like regular servers (shows ping, players, version, icon)
  • Auto-prune stale servers after 15 seconds (TTL)
  • Negative IDs to avoid collision with regular server list
  • Hide Remove/Edit buttons for LAN servers (not user-editable)
  • Disable drag-drop sorting when LAN servers are present
  • Shutdown hook to cleanup socket on client close

Testing

  1. Open a singleplayer world in another MC instance
  2. Click "Open to LAN"
  3. The LAN server should appear automatically in LiquidBounce multiplayer with a "LAN" tag

Here is a screenshot :
image


This PR was developed with AI assistance.

- Add UDP multicast listener (224.0.2.60:4445) for LAN world broadcasts
- REST endpoint GET /api/v1/client/servers/lan
- LAN servers use negative IDs to avoid collision with regular servers
- Auto-prune stale servers after 15 seconds (TTL)
- Frontend polls every 3 seconds with error handling
- Show 'LAN' tag on detected servers
- Hide Remove/Edit buttons for LAN servers (not editable)
- Disable sorting when LAN servers are present
- Shutdown hook to cleanup socket on client close
@Pro0101-2b2fr Pro0101-2b2fr force-pushed the fix/lan-server-discovery branch 2 times, most recently from cfdb529 to ec83b8a Compare June 23, 2026 23:11
- Replace custom UDP multicast implementation with vanilla
  LanServerDetection.LanServerDetector and LanServerList
- Replace Runtime.addShutdownHook with ClientShutdownEvent handler
  to follow LiquidBounce's event system pattern
- Remove redundant imports (DatagramPacket, InetAddress, MulticastSocket)
@Pro0101-2b2fr Pro0101-2b2fr force-pushed the fix/lan-server-discovery branch from ec83b8a to 6c9b56e Compare June 24, 2026 16:00
Replace manual JsonObject construction with interopGson.toJsonTree(serverData)
to use the existing ServerInfoSerializer, as suggested in code review.
…List

- Use call.respond(ActiveServerList.getLanServers()) directly
- Move getLanServers() endpoint before ActiveServerList object, after other endpoints
  as requested in code review
@MukjepScarlet MukjepScarlet added the conflict PR has merge conflicts label Jul 10, 2026
@MukjepScarlet MukjepScarlet removed the conflict PR has merge conflicts label Jul 12, 2026
@MukjepScarlet MukjepScarlet added this to the 0.39.0 milestone Jul 12, 2026
@MukjepScarlet MukjepScarlet merged commit 8601a6d into CCBlueX:nextgen Jul 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants