aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-12-15 11:02:33 +0300
committermat <git@matdoes.dev>2025-12-15 12:08:30 +0400
commit281a810c860a67e8e7957aaec876ea608602831c (patch)
treec467175238cff236e6c8c381cb729cd48a2c4039
parent0569ffd2d85585eb69de9068ab3f62e768bce4e7 (diff)
downloadazalea-drasl-281a810c860a67e8e7957aaec876ea608602831c.tar.xz
change ClientboundAddEntity::data from a u32 to i32
hi shay :3
-rw-r--r--azalea-block/src/block_state.rs8
-rw-r--r--azalea-protocol/src/packets/game/c_add_entity.rs8
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<u32> for BlockState {
}
}
}
+impl TryFrom<i32> for BlockState {
+ type Error = ();
+
+ fn try_from(state_id: i32) -> Result<Self, Self::Error> {
+ Self::try_from(state_id as u32)
+ }
+}
+
impl TryFrom<u16> 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 {