mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 06:16:04 +00:00
fix VibrationParticle
This commit is contained in:
parent
8da179b221
commit
d7cd305059
2 changed files with 19 additions and 8 deletions
|
@ -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,
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue