← ClaudeAtlas

minecraft-networkinglisted

Custom packets between client and server in a Minecraft mod, on Fabric or NeoForge. Covers the CustomPacketPayload model, payload registration and stream codecs per loader, the threading rule that handlers must schedule work back onto the main thread, and validating every client-sent packet because the client is an attacker. Use when adding a packet, syncing state to clients, handling a GUI button server-side, or diagnosing a ConcurrentModificationException or a client-triggered exploit.
ibrohim1234567881717/game-dev-ai-skills · ★ 0 · AI & Automation · score 71
Install: claude install-skill ibrohim1234567881717/game-dev-ai-skills
# Minecraft Networking ## Purpose Minecraft is a client-server game even in single player, where an integrated server runs on its own thread. Any state that matters lives on the server; the client holds a copy that is only as correct as what you send it. Custom packets are how a mod moves data across that boundary, and they carry two failure modes that dwarf everything else: **the client is under the player's control, so any client-sent packet is attacker-controlled input**, and **packet handlers run on a network thread, so touching the world from one corrupts it**. This skill covers the payload model on each loader and the two rules that make it safe. ## When to use - Adding any packet: a GUI button that must act server-side, a key bind that triggers a server action, syncing mod state to clients. - A GUI button works in single player and does nothing in multiplayer. - `ConcurrentModificationException`, a corrupt chunk, or a random `NullPointerException` deep in vanilla code after adding a packet. - Reviewing a mod for exploits, or a bug report that a player duplicated items or reached blocks they should not. - Migrating channel-based packet code after a 1.20.2+ or 1.20.5+ version bump. ## When NOT to use - The loader, version and mappings are unresolved. Run `minecraft-project-conventions` first. - Entity state that the vanilla tracked-data system already syncs. Use it instead — see `minecraft-entities-mobs`. - Container/menu field syncing, which has its own