aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol/src
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-05-07 18:44:00 -0500
committermat <github@matdoes.dev>2022-05-07 18:44:00 -0500
commit1a15d36e6b9bb33340f1422b6b282dd13e9b4840 (patch)
tree2cb7df44cb1605c542db15c59ec59abeff7bab0b /azalea-protocol/src
parentd9e388d8b0d8b3bdcf7a2e21b0cd2daa78d295e7 (diff)
downloadazalea-drasl-1a15d36e6b9bb33340f1422b6b282dd13e9b4840.tar.xz
add health packet
Diffstat (limited to 'azalea-protocol/src')
-rw-r--r--azalea-protocol/src/packets/game/clientbound_container_set_content_packet.rs2
-rw-r--r--azalea-protocol/src/packets/game/clientbound_set_health_packet.rs9
-rwxr-xr-xazalea-protocol/src/packets/game/mod.rs2
3 files changed, 12 insertions, 1 deletions
diff --git a/azalea-protocol/src/packets/game/clientbound_container_set_content_packet.rs b/azalea-protocol/src/packets/game/clientbound_container_set_content_packet.rs
index e46f5af1..aea09e09 100644
--- a/azalea-protocol/src/packets/game/clientbound_container_set_content_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_container_set_content_packet.rs
@@ -5,7 +5,7 @@ use packet_macros::GamePacket;
pub struct ClientboundContainerSetContentPacket {
pub container_id: u8,
#[var]
- pub state_id: i32,
+ pub state_id: u32,
pub items: Vec<Slot>,
pub carried_item: Slot,
}
diff --git a/azalea-protocol/src/packets/game/clientbound_set_health_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_health_packet.rs
new file mode 100644
index 00000000..136ef475
--- /dev/null
+++ b/azalea-protocol/src/packets/game/clientbound_set_health_packet.rs
@@ -0,0 +1,9 @@
+use packet_macros::GamePacket;
+
+#[derive(Clone, Debug, GamePacket)]
+pub struct ClientboundSetHealthPacket {
+ pub health: f32,
+ #[var]
+ pub food: u32,
+ pub saturation: f32,
+}
diff --git a/azalea-protocol/src/packets/game/mod.rs b/azalea-protocol/src/packets/game/mod.rs
index d112f576..776c5d41 100755
--- a/azalea-protocol/src/packets/game/mod.rs
+++ b/azalea-protocol/src/packets/game/mod.rs
@@ -21,6 +21,7 @@ pub mod clientbound_set_chunk_cache_center;
pub mod clientbound_set_default_spawn_position_packet;
pub mod clientbound_set_entity_data_packet;
pub mod clientbound_set_entity_link_packet;
+pub mod clientbound_set_health_packet;
pub mod clientbound_set_time_packet;
pub mod clientbound_update_attributes_packet;
pub mod clientbound_update_recipes_packet;
@@ -60,6 +61,7 @@ declare_state_packets!(
0x4d: clientbound_set_entity_data_packet::ClientboundSetEntityDataPacket,
0x45: clientbound_set_entity_link_packet::ClientboundSetEntityLinkPacket,
0x4f: clientbound_entity_velocity_packet::ClientboundEntityVelocityPacket,
+ 0x52: clientbound_set_health_packet::ClientboundSetHealthPacket,
0x59: clientbound_set_time_packet::ClientboundSetTimePacket,
0x64: clientbound_update_attributes_packet::ClientboundUpdateAttributesPacket,
0x66: clientbound_update_recipes_packet::ClientboundUpdateRecipesPacket,