From 281a810c860a67e8e7957aaec876ea608602831c Mon Sep 17 00:00:00 2001 From: mat Date: Mon, 15 Dec 2025 11:02:33 +0300 Subject: change ClientboundAddEntity::data from a u32 to i32 hi shay :3 --- azalea-block/src/block_state.rs | 8 ++++++++ azalea-protocol/src/packets/game/c_add_entity.rs | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/azalea-block/src/block_state.rs b/azalea-block/src/block_state.rs index f7ef9006..08baad2f 100644 --- a/azalea-block/src/block_state.rs +++ b/azalea-block/src/block_state.rs @@ -85,6 +85,14 @@ impl TryFrom for BlockState { } } } +impl TryFrom for BlockState { + type Error = (); + + fn try_from(state_id: i32) -> Result { + Self::try_from(state_id as u32) + } +} + impl TryFrom for BlockState { type Error = (); diff --git a/azalea-protocol/src/packets/game/c_add_entity.rs b/azalea-protocol/src/packets/game/c_add_entity.rs index dc04d078..52a429d5 100644 --- a/azalea-protocol/src/packets/game/c_add_entity.rs +++ b/azalea-protocol/src/packets/game/c_add_entity.rs @@ -20,14 +20,14 @@ pub struct ClientboundAddEntity { pub y_head_rot: i8, /// The entity's "object data". This is unused for most entities. /// - /// Projectiles and fishing hooks treat this as an entity ID, which you're - /// encouraged to use [`MinecraftEntityId::from`] for. Other entities may - /// treat it as a block state or enum variant. + /// Projectiles and fishing hooks treat this like a [`MinecraftEntityId`]. + /// Falling blocks treat it as a [`BlockState`](azalea_block::BlockState). + /// Other entities may treat it as another enum variant. /// /// See [the wiki](https://minecraft.wiki/w/Java_Edition_protocol/Object_data) /// for more information about this field. #[var] - pub data: u32, + pub data: i32, } impl ClientboundAddEntity { -- cgit v1.2.3