From 03a496fc7d952b1136cb717f2e8d1ccfb798ee64 Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 30 Oct 2025 11:02:50 -0530 Subject: cleanup some code related to mob effects --- .../src/packets/game/c_update_mob_effect.rs | 45 ++-------------------- 1 file changed, 3 insertions(+), 42 deletions(-) (limited to 'azalea-protocol') diff --git a/azalea-protocol/src/packets/game/c_update_mob_effect.rs b/azalea-protocol/src/packets/game/c_update_mob_effect.rs index 896d547b..e9892950 100644 --- a/azalea-protocol/src/packets/game/c_update_mob_effect.rs +++ b/azalea-protocol/src/packets/game/c_update_mob_effect.rs @@ -1,6 +1,5 @@ -use std::io::{Cursor, Write}; - -use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite, BufReadError}; +use azalea_buf::AzBuf; +use azalea_entity::MobEffectData; use azalea_protocol_macros::ClientboundGamePacket; use azalea_registry::MobEffect; use azalea_world::MinecraftEntityId; @@ -10,43 +9,5 @@ pub struct ClientboundUpdateMobEffect { #[var] pub entity_id: MinecraftEntityId, pub mob_effect: MobEffect, - #[var] - pub effect_amplifier: u32, - #[var] - pub effect_duration_ticks: u32, - pub flags: MobEffectFlags, -} - -#[derive(Clone, Debug, Default, PartialEq)] -pub struct MobEffectFlags { - pub ambient: bool, - pub show_particles: bool, - pub show_icon: bool, -} - -impl AzaleaRead for MobEffectFlags { - fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { - let bits = u8::azalea_read(buf)?; - Ok(MobEffectFlags { - ambient: bits & 0x01 != 0, - show_particles: bits & 0x02 != 0, - show_icon: bits & 0x04 != 0, - }) - } -} - -impl AzaleaWrite for MobEffectFlags { - fn azalea_write(&self, buf: &mut impl Write) -> std::io::Result<()> { - let mut bits = 0; - if self.ambient { - bits |= 0x01; - } - if self.show_particles { - bits |= 0x02; - } - if self.show_icon { - bits |= 0x04; - } - bits.azalea_write(buf) - } + pub data: MobEffectData, } -- cgit v1.2.3