steel_protocol/packets/game/c_block_entity_data.rs
1//! Block entity data packet.
2//!
3//! Sent by the server to update block entity data on the client.
4
5use steel_macros::{ClientPacket, WriteTo};
6use steel_registry::packets::play::C_BLOCK_ENTITY_DATA;
7use steel_utils::BlockPos;
8use steel_utils::serial::OptionalNbt;
9
10/// Packet sent to update a block entity's data on the client.
11///
12/// Used to synchronize block entity data such as sign text, banner patterns, etc.
13#[derive(ClientPacket, WriteTo, Clone, Debug)]
14#[packet_id(Play = C_BLOCK_ENTITY_DATA)]
15pub struct CBlockEntityData {
16 /// Position of the block entity.
17 pub pos: BlockPos,
18 /// Type ID of the block entity (from the block entity type registry).
19 #[write(as = VarInt)]
20 pub block_entity_type: i32,
21 /// NBT data for the block entity (uses `OptionalNbt` format with tag type prefix).
22 pub nbt: OptionalNbt,
23}