You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Once base packet class is done, start creating all the packets. These packets should go under src/types/packets and should be subclasses of src.types.packet.Packet. For a list of all the packets, look here: https://wiki.vg/Protocol(Important: this link displays the most recent versions protocol, to view a specific version go here)
Packet Making Guide v2
Naming
Packets are named by their state and name on wiki.vg
Examples: class PlayUpdateLight or class HandshakeHandshake or class PlayPlayerPosition
Creation
Packets should have two class object attributes (id and to), a docstring describing them, an __init__, and the decode or encode method (or both)
Packets should also subclass a Packet object, and initialize it.
Example:
classTestExample(Packet):
"""This is an example packet, not used at all. (Client -> Server AND Server -> Client) :param str dummy_payload: The payload of the packet. :attr int id: Unique packet ID. :attr int to: Packet direction. :attr dummy_payload: """id=0x00# ID of the packet, found on wiki.vg in the section where there's info on the packetto=2# 0=serverbound, 1=clientbound, 2=both be careful when using 2 as many packets are both, but have different IDsdef__init__(self, dummy_payload: str) ->None:
super().__init__()
self.dummy_payload=dummy_payloaddefencode(self) ->bytes:
returnBuffer.pack_string(self.dummy_payload)
@classmethoddefdecode(cls, buf: Buffer) ->TestExample:
returncls(buf.unpack_string())
Additional Info:
Packet docstrings should be generated via the atom plugin docblock-python or another plugin for another editor. They should be in the sphinx format.
Docstrings, on the first line, should contain the short summary, any additional links/info, and in parentheses the direction(s) of the packet.
Remember to add the name of the packet to the file's __all__ (located near the top of the file, after imports)
If you can't find the right file to place your packet, you can create a new one. Remember to import annotations from __future__ to allow for proper typehints, and to add an __all__.
Progress Checklist (By States)
handshake packets
status packets
login packets
play packets
The text was updated successfully, but these errors were encountered:
Once base packet class is done, start creating all the packets. These packets should go under
src/types/packets
and should be subclasses ofsrc.types.packet.Packet
. For a list of all the packets, look here: https://wiki.vg/Protocol (Important: this link displays the most recent versions protocol, to view a specific version go here)Packet Making Guide v2
Naming
Examples:
class PlayUpdateLight
orclass HandshakeHandshake
orclass PlayPlayerPosition
Creation
id
andto
), a docstring describing them, an__init__
, and the decode or encode method (or both)Example:
Additional Info:
__all__
(located near the top of the file, after imports)__future__
to allow for proper typehints, and to add an__all__
.Progress Checklist (By States)
The text was updated successfully, but these errors were encountered: