Decode 26.3 container and chat packets

This commit is contained in:
Tanner committed 2026-11-04 19:20:15 +00:00
1 parent f92d3a09bf
commit 03b15a400d
1 file changed
+31 -2
+31 -2
View File
@@ -671,6 +671,16 @@ def read_item_stack(file_object, context=None):
return stack return stack
class ContainerOpenPacket(Packet):
id = 0x3C
packet_name = "container open"
def read(self, file_object):
self.window_id = VarInt.read(file_object)
self.inventory_type = VarInt.read(file_object)
self.title = AnonymousNBT.read(file_object)
class ContainerSetContentPacket(Packet): class ContainerSetContentPacket(Packet):
id = 0x12 id = 0x12
packet_name = "container set content" packet_name = "container set content"
@@ -929,6 +939,24 @@ class ClientboundPlayerChatPacket(Packet):
if Boolean.read(file_object): if Boolean.read(file_object):
file_object.read(256) file_object.read(256)
self.message = String.read(file_object) self.message = String.read(file_object)
self.timestamp = Long.read(file_object)
self.salt = Long.read(file_object)
for _ in range(VarInt.read(file_object)):
if VarInt.read(file_object) == 0:
file_object.read(256)
self.unsigned_content = (
AnonymousNBT.read(file_object)
if Boolean.read(file_object) else None)
self.filter_type = VarInt.read(file_object)
if self.filter_type == 2:
for _ in range(VarInt.read(file_object)):
Long.read(file_object)
self.chat_type_id = VarInt.read(file_object)
self.network_name = AnonymousNBT.read(file_object)
self.network_target_name_present = Boolean.read(file_object)
self.network_target_name = (
AnonymousNBT.read(file_object)
if self.network_target_name_present else None)
class ServerboundChatPacket(Packet): class ServerboundChatPacket(Packet):
@@ -1097,8 +1125,9 @@ class ModernPlayingReactor(PacketReactor):
MoveEntityPositionPacket, MoveEntityPositionPacket,
MoveEntityPositionRotationPacket, MoveEntityRotationPacket, MoveEntityPositionRotationPacket, MoveEntityRotationPacket,
EntityPositionSyncPacket, PlayerInfoUpdatePacket, EntityPositionSyncPacket, PlayerInfoUpdatePacket,
PlayerInfoRemovePacket, ContainerSetContentPacket, PlayerInfoRemovePacket, ContainerOpenPacket,
ContainerSetSlotPacket, SetCursorItemPacket, ContainerSetContentPacket, ContainerSetSlotPacket,
SetCursorItemPacket,
} }
def react(self, packet): def react(self, packet):