Skip to content

Protocol

Koding edited this page Aug 24, 2020 · 1 revision

âš¡ Protocol

The protocol module provides a simple and robust way to communicate between Minecraft servers and clients. Currently it supports Minecraft 1.7.x - 1.8.x, however will support all versions after the Netty rewrite (1.7).

📦 Package Layout

All protocol packages lie under dev.zerite.craftlib.protocol.

📨 Packets

Each packet has a proper naming scheme which includes the side the packet is bound to and the protocol state. For example, a chat message packet during the play state which is sent from the server would be ServerPlayChatMessagePacket.

These packets should be placed in appropriate packages under dev.zerite.craftlib.protocol.packet. Packet packages are grouped together to indicate what they do on the client/server. Using the previous example of a chat packet, this would be placed under dev.zerite.craftlib.protocol.packet.play.server.display.

💻 Layout

dev.zerite.craftlib.protocol

  • compat.forge: Forge compatibility for the FML handshake.
  • connection: Wrappers for interacting with the raw Netty connections.
    • io: Netty codecs for reading and writing packets.
  • data: Parent for the resources used when parsing packets.
    • entity: Stores the entity metadata wrapper class.
    • other: Miscellaneous structures which don't fit anywhere else.
    • registry: Version-mapped enums which allow for data to be translated when IDs change.
    • world: Used for chunk IO.
  • packet: Houses all the packet classes which are used in the protocol. See here
  • util: Utilities which are used internally across the protocol module.
    • delegate: Used mostly in packets for property delegation.
    • ext: Extension functions.
    • json.factory: JSON type adapters for GSON.
  • version: The root mappings which are used to lookup packet mappers across versions.

👋 Introduction

Clone this wiki locally