docs v0.1.0
MOVED FROM CUBELIB WIKI ON GITLAB
this docs refers to v0.1.0
Internal structure
In library we have 2 types of minecraft packets.
1. Raw packet. cubelib.p.Packet we know only it's id and bound.
2. Packet class. kid of cubelib.p.Night we know it's id,bound,version,state,payload.
Docs
cubelib.readPacketsStream()
readPacketsStream(input_buffer: bytes, compression: bool, bound: cubelib.bound) -> (bool, bool, list, Union[bool, bytes])
Returns:
first_failed, failed, packets, unparsed = readPacketsStream
if first_failed mean no packets parsed and unparsed contains initial buffer
if failed mean we have at least one packet in packets but have and unparsed bytes
packets contains list of sucesfully parsed packets if not first_failed or empty list
unparsed contains buffer of bytes who caused error while parsing if 1st or 2nd True
cubelib.resolvePacket()
Returns:
packet_class is a kid of cubelib.p.Night base class implements protocol packets
cubelib.p.Night
base class implements protocol packets
cubelib.p.Night.build()
you will encounter this method only through decrypted/created packets and not directly
How do i build a packet?
for example we will build simple independent from minecraft version Handshake packet
about the package structure and the name of the modules
All version-independent packets classes in package follow one naming rule:
cubelib.proto.v{proto_version}.bound.state.packet
for example:
cubelib.proto.v47.ClientBound.Login.LoginSuccess
And version-dependent:
cubelib.proto.bound.state.packet
example:
cubelib.proto.ServerBound.Status.Ping()
Last updated