diff options
| author | mat <git@matdoes.dev> | 2025-03-13 20:46:12 +0000 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-03-13 20:46:12 +0000 |
| commit | 65fe07215149ab81d0862ab7edac71d6a8417ef8 (patch) | |
| tree | 9e06778329cbf9a14f87c93d1a3686f6b91f2b4e /azalea-protocol | |
| parent | 7a192acc99358818c2f90cf4e2b8b236f91cfbf7 (diff) | |
| download | azalea-drasl-65fe07215149ab81d0862ab7edac71d6a8417ef8.tar.xz | |
fix wrong Consumable component implementation and add set_equipment test
Diffstat (limited to 'azalea-protocol')
| -rwxr-xr-x | azalea-protocol/src/packets/game/c_set_equipment.rs | 19 | ||||
| -rwxr-xr-x | azalea-protocol/src/packets/game/c_sound.rs | 8 | ||||
| -rwxr-xr-x | azalea-protocol/src/packets/game/c_sound_entity.rs | 3 |
3 files changed, 22 insertions, 8 deletions
diff --git a/azalea-protocol/src/packets/game/c_set_equipment.rs b/azalea-protocol/src/packets/game/c_set_equipment.rs index ad691d66..234de5d9 100755 --- a/azalea-protocol/src/packets/game/c_set_equipment.rs +++ b/azalea-protocol/src/packets/game/c_set_equipment.rs @@ -80,3 +80,22 @@ impl EquipmentSlot { } } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_hypixel_set_equipment() { + let mut cursor = Cursor::new( + [ + 230, 25, 0, 1, 224, 6, 2, 0, 3, 0, 22, 79, 0, 0, 0, 3, 0, 0, 0, 0, 0, + ] + .as_slice(), + ); + + let packet = ClientboundSetEquipment::azalea_read(&mut cursor).unwrap(); + println!("packet {packet:?}"); + assert_eq!(cursor.position(), cursor.get_ref().len() as u64); + } +} diff --git a/azalea-protocol/src/packets/game/c_sound.rs b/azalea-protocol/src/packets/game/c_sound.rs index 8ec028a7..1a54c7c8 100755 --- a/azalea-protocol/src/packets/game/c_sound.rs +++ b/azalea-protocol/src/packets/game/c_sound.rs @@ -1,5 +1,5 @@ use azalea_buf::AzBuf; -use azalea_core::resource_location::ResourceLocation; +use azalea_core::sound::CustomSound; use azalea_protocol_macros::ClientboundGamePacket; use azalea_registry::SoundEvent; @@ -16,12 +16,6 @@ pub struct ClientboundSound { pub seed: u64, } -#[derive(Clone, Debug, AzBuf)] -pub struct CustomSound { - pub location: ResourceLocation, - pub fixed_range: Option<f32>, -} - #[derive(AzBuf, Clone, Copy, Debug)] pub enum SoundSource { Master = 0, diff --git a/azalea-protocol/src/packets/game/c_sound_entity.rs b/azalea-protocol/src/packets/game/c_sound_entity.rs index 37ce1f16..a6d17b72 100755 --- a/azalea-protocol/src/packets/game/c_sound_entity.rs +++ b/azalea-protocol/src/packets/game/c_sound_entity.rs @@ -1,9 +1,10 @@ use azalea_buf::AzBuf; +use azalea_core::sound::CustomSound; use azalea_protocol_macros::ClientboundGamePacket; use azalea_registry::SoundEvent; use azalea_world::MinecraftEntityId; -use super::c_sound::{CustomSound, SoundSource}; +use super::c_sound::SoundSource; #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] pub struct ClientboundSoundEntity { |
