diff --git a/azalea-entity/src/particle.rs b/azalea-entity/src/particle.rs index 6bc1ef6f..212d9668 100644 --- a/azalea-entity/src/particle.rs +++ b/azalea-entity/src/particle.rs @@ -3,6 +3,7 @@ use azalea_buf::AzBuf; use azalea_core::{color::RgbColor, position::BlockPos}; use azalea_inventory::ItemStack; use azalea_registry::ParticleKind; +use azalea_world::MinecraftEntityId; use bevy_ecs::component::Component; // the order of this enum must be kept in sync with ParticleKind, otherwise @@ -290,15 +291,27 @@ pub struct ItemParticle { #[derive(Debug, Clone, AzBuf, Default)] pub struct VibrationParticle { - pub origin: BlockPos, - pub position_type: String, - pub block_position: BlockPos, - #[var] - pub entity_id: u32, + pub position: PositionSource, #[var] pub ticks: u32, } +#[derive(Debug, Clone, AzBuf)] +pub enum PositionSource { + Block(BlockPos), + Entity { + #[var] + id: MinecraftEntityId, + y_offset: f32, + }, +} +impl Default for PositionSource { + fn default() -> Self { + // bad default but hopefully it never gets used anyways + Self::Block(BlockPos::default()) + } +} + #[derive(Debug, Clone, AzBuf, Default)] pub struct SculkChargeParticle { pub roll: f32, diff --git a/azalea-protocol/src/packets/game/c_level_particles.rs b/azalea-protocol/src/packets/game/c_level_particles.rs index d54315ab..3f11bef2 100644 --- a/azalea-protocol/src/packets/game/c_level_particles.rs +++ b/azalea-protocol/src/packets/game/c_level_particles.rs @@ -27,9 +27,7 @@ mod tests { #[test] fn test_c_level_particles_packet() { #[rustfmt::skip] - let slice = [ - 0, 0, 64, 156, 51, 153, 153, 153, 153, 154, 192, 64, 140, 204, 204, 204, 204, 205, 63, 248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 13, 255, 0, 255, 255, 63, 128, 0, 0 - ]; + let slice = [0, 0, 192, 159, 104, 133, 28, 126, 5, 107, 192, 59, 0, 0, 0, 0, 0, 0, 64, 140, 27, 255, 120, 249, 188, 204, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 47, 1, 251, 245, 15, 64, 29, 194, 144, 12]; let mut bytes = Cursor::new(slice.as_slice()); let packet = ClientboundLevelParticles::azalea_read(&mut bytes).unwrap();