Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement all packets #4

Closed
3 of 4 tasks
Iapetus-11 opened this issue Dec 20, 2020 · 4 comments
Closed
3 of 4 tasks

Implement all packets #4

Iapetus-11 opened this issue Dec 20, 2020 · 4 comments
Assignees
Labels
Enhancement New feature, request, or thing

Comments

@Iapetus-11
Copy link
Member

Iapetus-11 commented Dec 20, 2020

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:
class TestExample(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 packet
  to = 2  # 0=serverbound, 1=clientbound, 2=both be careful when using 2 as many packets are both, but have different IDs

  def __init__(self, dummy_payload: str) -> None:
    super().__init__()

    self.dummy_payload = dummy_payload

  def encode(self) -> bytes:
    return Buffer.pack_string(self.dummy_payload)

  @classmethod
  def decode(cls, buf: Buffer) -> TestExample:
    return cls(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
@Iapetus-11 Iapetus-11 added the Enhancement New feature, request, or thing label Dec 20, 2020
@Iapetus-11 Iapetus-11 self-assigned this Dec 21, 2020
@seven7ty seven7ty assigned MFDGaming and emerald73 and unassigned seven7ty Dec 31, 2020
@seven7ty
Copy link
Contributor

seven7ty commented Dec 31, 2020

oh **** sorry for unassigning, thought this was my meme issue

@Iapetus-11
Copy link
Member Author

All serverbound packets completed! 🎉🎉

@Sh-wayz
Copy link
Member

Sh-wayz commented Feb 22, 2021

So close

@Sh-wayz
Copy link
Member

Sh-wayz commented Feb 18, 2022

Packets have moved to Pymine-Net. Further information can be found there.

@Sh-wayz Sh-wayz closed this as completed Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature, request, or thing
Projects
None yet
Development

No branches or pull requests

5 participants