This repository was archived by the owner on Dec 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
This repository was archived by the owner on Dec 12, 2022. It is now read-only.
Implement all packets for protocol 757 #3
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Once base packet class is done, start creating all the packets. These packets should go under pymine_net/packets/757/<state> and should be subclasses of src.types.packet.ServerBoundPacket or src.types.packet.ClientBoundPacket. 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
Naming
- Packets are named by their state and name on wiki.vg
Examples:class PlayUpdateLightorclass HandshakeHandshakeorclass PlayPlayerPosition
Creation
- Packets should have one class attribute (
id), a docstring describing them and any other instance variables, an__init__, and anunpackorpackmethod (or both) - Packets need to subclass
ServerBoundPacketorClientBoundPacketand callsuper().__init__()
Example:
class TestExample(ServerBoundPacket, ClientBoundPacket):
"""This is an example packet, not used at all. (Client <-> Server)
:param str dummy_payload: The payload of the packet.
:attr int id: Unique packet ID.
:attr dummy_payload:
"""
id = 0x00 # ID of the packet, found on wiki.vg in the section where there's info on the packet
def __init__(self, dummy_payload: str):
super().__init__()
self.dummy_payload = dummy_payload
def encode(self) -> Buffer:
return Buffer().write_string(self.dummy_payload)
@classmethod
def decode(cls, buf: Buffer) -> TestExample:
return cls(buf.read_string())Additional Info:
- Packet docstrings should be in the sphinx format, they can be generated via a plugin for atom or vscode.
- 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 add
from __future__ import annotationsto allow for return typehints to be the class itself, and to add an__all__. - Make sure the packet name and ID are correct before commiting, as some have changed since 754.
Progress Checklist (By States)
- handshake packets
- status packets
- login packets
- play packets
Sh-wayzSh-wayz
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request