Decode 26.3 block entity data packets

This commit is contained in:
Tanner committed 2026-11-05 23:47:05 +00:00
1 parent 46b27f4b94
commit a48b366b09
2 files changed
+46 -2

No files matched your search

+25 -1
View File
@@ -293,6 +293,29 @@ class ChunkDataPacket(Packet):
data_size = VarInt.read(file_object)
self.data = file_object.read(data_size)
self.sections = decode_chunk_sections(self.data)
self.block_entities = []
for _ in range(VarInt.read(file_object)):
packed_xz = UnsignedByte.read(file_object)
y = Short.read(file_object)
block_entity_type = VarInt.read(file_object)
data = nbt_plain(read_anonymous_nbt(file_object))
self.block_entities.append({
'x': self.x * 16 + (packed_xz >> 4),
'y': y,
'z': self.z * 16 + (packed_xz & 0x0F),
'type': block_entity_type,
'data': data,
})
class BlockEntityDataPacket(Packet):
id = 0x06
packet_name = "block entity data"
def read(self, file_object):
self.location = Position.read_with_context(file_object, self.context)
self.block_entity_type = VarInt.read(file_object)
self.data = nbt_plain(read_anonymous_nbt(file_object))
class BlockUpdatePacket(Packet):
@@ -1203,7 +1226,8 @@ class ModernPlayingReactor(PacketReactor):
ClientboundChunkBatchFinished, ClientboundPlayerChatPacket,
EntityAnimationPacket, EntitySwingAnimationPacket,
BlockChangedAckPacket, AddEntityPacket, SetEntityDataPacket,
RemoveEntitiesPacket, MoveEntityPositionPacket,
BlockEntityDataPacket, RemoveEntitiesPacket,
MoveEntityPositionPacket,
MoveEntityPositionRotationPacket, MoveEntityRotationPacket,
EntityPositionSyncPacket, PlayerInfoUpdatePacket,
PlayerInfoRemovePacket, ContainerOpenPacket,