1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 14:26:04 +00:00
azalea/azalea-protocol/src/packets/game/clientbound_level_particles_packet.rs
mat 6eee543a33
Pathfinder (#25)
Pathfinding is very much not done, but it works enough and I want to get this merged.
TODO: fast replanning, goals that aren't a single node, falling moves (it should be able to play the dropper), parkour moves
2022-11-12 23:54:05 -06:00

57 lines
1.6 KiB
Rust
Executable file

use azalea_buf::{BufReadError, McBufReadable, McBufVarReadable, McBufWritable};
use azalea_core::ParticleData;
use azalea_protocol_macros::ClientboundGamePacket;
use std::io::{Cursor, Write};
#[derive(Clone, Debug, ClientboundGamePacket)]
pub struct ClientboundLevelParticlesPacket {
#[var]
pub particle_id: u32,
pub override_limiter: bool,
pub x: f64,
pub y: f64,
pub z: f64,
pub x_dist: f32,
pub y_dist: f32,
pub z_dist: f32,
pub max_speed: f32,
pub count: u32,
pub data: ParticleData,
}
impl McBufReadable for ClientboundLevelParticlesPacket {
fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
let particle_id = u32::var_read_from(buf)?;
let override_limiter = bool::read_from(buf)?;
let x = f64::read_from(buf)?;
let y = f64::read_from(buf)?;
let z = f64::read_from(buf)?;
let x_dist = f32::read_from(buf)?;
let y_dist = f32::read_from(buf)?;
let z_dist = f32::read_from(buf)?;
let max_speed = f32::read_from(buf)?;
let count = u32::read_from(buf)?;
let data = ParticleData::read_from_id(buf, particle_id)?;
Ok(Self {
particle_id,
override_limiter,
x,
y,
z,
x_dist,
y_dist,
z_dist,
max_speed,
count,
data,
})
}
}
impl McBufWritable for ClientboundLevelParticlesPacket {
fn write_into(&self, _buf: &mut impl Write) -> Result<(), std::io::Error> {
todo!();
}
}