Phase 4: receive waypoint shares and render JourneyMap/Xaero chat links

DefaultBackendConnection handles the new waypoint_share message and
dispatches it through a WaypointShareListener. WaypointChatFormatter
builds the actual chat text for both formats from publicly documented
wire formats (see THIRD_PARTY_NOTICES.md for sources/attribution) —
neither needs a click-event component, since both client mods
auto-detect the right plain-text shape. Forge1122ChatBridge wires this
into a real broadcast; MCMapperMod registers the listener.

Built test-first per the project's TDD workflow; verified live against
the real backend, including a byte-exact JourneyMap-format chat
message produced from a real WS payload.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015tKdPZt78zbPUZMXWzKEKt
This commit is contained in:
2026-08-08 19:21:30 +02:00
parent 73e10d34e5
commit 41034356ac
7 changed files with 264 additions and 3 deletions
@@ -1,6 +1,7 @@
package com.octoturge.mcmapper.forge1122;
import com.octoturge.mcmapper.common.ChatBridge;
import com.octoturge.mcmapper.common.protocol.WaypointChatFormatter;
import com.octoturge.mcmapper.common.protocol.WaypointShare;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.text.TextComponentString;
@@ -22,8 +23,10 @@ public class Forge1122ChatBridge implements ChatBridge {
@Override
public void injectWaypointShare(WaypointShare waypoint) {
// Marker sharing lands in Phase 4 (needs the JourneyMap/Xaero wire-format research spike
// the plan calls for) — nothing calls this yet.
logger.warn("injectWaypointShare called before Phase 4's waypoint sharing is implemented — ignoring");
// Neither JourneyMap's nor Xaero's chat-waypoint syntax needs a click-event component —
// both client mods auto-detect the right plain-text shape in a normal chat message (see
// WaypointChatFormatter's javadoc for sources), so a broadcast TextComponentString is
// enough, same as injectWebChatMessage above.
server.getPlayerList().sendMessage(new TextComponentString(WaypointChatFormatter.format(waypoint)));
}
}
@@ -92,6 +92,7 @@ public class MCMapperMod {
Forge1122ChatBridge chatBridge = new Forge1122ChatBridge(event.getServer(), LOGGER);
connection.setChatListener(chatBridge::injectWebChatMessage);
connection.setWaypointShareListener(chatBridge::injectWaypointShare);
event.registerServerCommand(new LinkCommand(connection));
MinecraftForge.EVENT_BUS.register(this);