barneygale / quarry

Python library that implements the Minecraft network protocol and data types
Other
527 stars 75 forks source link

quarry.net.protocol.ProtocolError: Packet is too long: chat_message #112

Open hyperpixel34 opened 3 years ago

hyperpixel34 commented 3 years ago

Hello guys, when I'm trying to use the chat logger example on https://quarry.readthedocs.io/en/latest/examples.html, I always get an quarry.net.protocol.ProtocolError My game version is 1.16.5.

Hope you can help me :)

zax2002 commented 3 years ago

For new minecraft versions, use a chat message handler like the one in client_messenger.py

def packet_chat_message(self, buff):
    p_text = buff.unpack_chat().to_string()
    p_position = 0
    p_sender = None

    # 1.8.x+
    if self.protocol_version >= 47:
        p_position = buff.unpack('B')

    # 1.16.x+
    if self.protocol_version >= 736:
        p_sender = buff.unpack_uuid()

    if p_position in (0, 1) and p_text.strip():
        self.stdio_protocol.send_line(p_text)
Daddy-Talpapa commented 2 years ago

I'm still getting this issue on 1.17.1 using the code specified

davidawesome02 commented 2 years ago

Can you send your code? This should work.