mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 06:16:04 +00:00
ClientboundLevelParticlesPacket works
This commit is contained in:
parent
9fc71ab2d1
commit
c16e958d0b
2 changed files with 45 additions and 3 deletions
|
@ -381,6 +381,9 @@ impl Client {
|
|||
GamePacket::ClientboundGameEventPacket(p) => {
|
||||
println!("Got game event packet {:?}", p);
|
||||
}
|
||||
GamePacket::ClientboundLevelParticlesPacket(p) => {
|
||||
println!("Got level particles packet {:?}", p);
|
||||
}
|
||||
_ => panic!("Unexpected packet {:?}", packet),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
use crate::mc_buf::ParticleData;
|
||||
use packet_macros::{GamePacket, McBuf};
|
||||
use std::io::{Read, Write};
|
||||
|
||||
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||
use crate::mc_buf::{McBufReadable, McBufWritable, ParticleData};
|
||||
use packet_macros::GamePacket;
|
||||
|
||||
#[derive(Clone, Debug, GamePacket)]
|
||||
pub struct ClientboundLevelParticlesPacket {
|
||||
pub particle_id: u32,
|
||||
pub override_limiter: bool,
|
||||
|
@ -15,3 +17,40 @@ pub struct ClientboundLevelParticlesPacket {
|
|||
pub count: i32,
|
||||
pub data: ParticleData,
|
||||
}
|
||||
|
||||
impl McBufReadable for ClientboundLevelParticlesPacket {
|
||||
fn read_into(buf: &mut impl Read) -> Result<Self, String> {
|
||||
let particle_id = u32::read_into(buf)?;
|
||||
let override_limiter = bool::read_into(buf)?;
|
||||
let x = f64::read_into(buf)?;
|
||||
let y = f64::read_into(buf)?;
|
||||
let z = f64::read_into(buf)?;
|
||||
let x_dist = f32::read_into(buf)?;
|
||||
let y_dist = f32::read_into(buf)?;
|
||||
let z_dist = f32::read_into(buf)?;
|
||||
let max_speed = f32::read_into(buf)?;
|
||||
let count = i32::read_into(buf)?;
|
||||
|
||||
let data = ParticleData::read_from_particle_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!();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue