aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-06-02 10:30:28 +0500
committermat <git@matdoes.dev>2025-06-02 10:30:28 +0500
commitd7cd30505954d841f05d85a4cfd74412739778dd (patch)
treef5ff9bbbba4a1592a06bdefc2987cfd5825fcdc9
parent8da179b221ae4a7bfd02245b3cb6357464adbc43 (diff)
downloadazalea-drasl-d7cd30505954d841f05d85a4cfd74412739778dd.tar.xz
fix VibrationParticle
-rw-r--r--azalea-entity/src/particle.rs23
-rw-r--r--azalea-protocol/src/packets/game/c_level_particles.rs4
2 files changed, 19 insertions, 8 deletions
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();