diff options
| author | mat <git@matdoes.dev> | 2025-10-30 11:02:50 -0530 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-10-30 11:02:50 -0530 |
| commit | 03a496fc7d952b1136cb717f2e8d1ccfb798ee64 (patch) | |
| tree | e6b4d8052d9e622f741c35c9409e24b2a48436ce /azalea-protocol/src/packets | |
| parent | 818f2d01d49e574946d1a704e1445156afc9c2fb (diff) | |
| download | azalea-drasl-03a496fc7d952b1136cb717f2e8d1ccfb798ee64.tar.xz | |
cleanup some code related to mob effects
Diffstat (limited to 'azalea-protocol/src/packets')
| -rw-r--r-- | azalea-protocol/src/packets/game/c_update_mob_effect.rs | 45 |
1 files changed, 3 insertions, 42 deletions
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<Self, BufReadError> { - 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, } |
