mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26:04 +00:00
Fix ClientboundLevelParticlesPacket
The particle id is a varint
This commit is contained in:
parent
fcdb6d31ee
commit
405a00c0d1
3 changed files with 9 additions and 8 deletions
|
@ -3,6 +3,6 @@ use packet_macros::{GamePacket, McBuf};
|
||||||
// we can't identify the status in azalea-protocol since they vary depending on the entity
|
// we can't identify the status in azalea-protocol since they vary depending on the entity
|
||||||
#[derive(Clone, Debug, McBuf, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundEntityEventPacket {
|
pub struct ClientboundEntityEventPacket {
|
||||||
pub entity_id: i32,
|
pub entity_id: u32,
|
||||||
pub entity_status: i8,
|
pub event_id: u8,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
use std::io::{Read, Write};
|
use crate::mc_buf::McBufVarReadable;
|
||||||
|
|
||||||
use crate::mc_buf::{McBufReadable, McBufWritable, ParticleData};
|
use crate::mc_buf::{McBufReadable, McBufWritable, ParticleData};
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::GamePacket;
|
||||||
|
use std::io::{Read, Write};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, GamePacket)]
|
||||||
pub struct ClientboundLevelParticlesPacket {
|
pub struct ClientboundLevelParticlesPacket {
|
||||||
|
#[var]
|
||||||
pub particle_id: u32,
|
pub particle_id: u32,
|
||||||
pub override_limiter: bool,
|
pub override_limiter: bool,
|
||||||
pub x: f64,
|
pub x: f64,
|
||||||
|
@ -14,13 +15,13 @@ pub struct ClientboundLevelParticlesPacket {
|
||||||
pub y_dist: f32,
|
pub y_dist: f32,
|
||||||
pub z_dist: f32,
|
pub z_dist: f32,
|
||||||
pub max_speed: f32,
|
pub max_speed: f32,
|
||||||
pub count: i32,
|
pub count: u32,
|
||||||
pub data: ParticleData,
|
pub data: ParticleData,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl McBufReadable for ClientboundLevelParticlesPacket {
|
impl McBufReadable for ClientboundLevelParticlesPacket {
|
||||||
fn read_into(buf: &mut impl Read) -> Result<Self, String> {
|
fn read_into(buf: &mut impl Read) -> Result<Self, String> {
|
||||||
let particle_id = u32::read_into(buf)?;
|
let particle_id = u32::var_read_into(buf)?;
|
||||||
let override_limiter = bool::read_into(buf)?;
|
let override_limiter = bool::read_into(buf)?;
|
||||||
let x = f64::read_into(buf)?;
|
let x = f64::read_into(buf)?;
|
||||||
let y = f64::read_into(buf)?;
|
let y = f64::read_into(buf)?;
|
||||||
|
@ -29,7 +30,7 @@ impl McBufReadable for ClientboundLevelParticlesPacket {
|
||||||
let y_dist = f32::read_into(buf)?;
|
let y_dist = f32::read_into(buf)?;
|
||||||
let z_dist = f32::read_into(buf)?;
|
let z_dist = f32::read_into(buf)?;
|
||||||
let max_speed = f32::read_into(buf)?;
|
let max_speed = f32::read_into(buf)?;
|
||||||
let count = i32::read_into(buf)?;
|
let count = u32::read_into(buf)?;
|
||||||
|
|
||||||
let data = ParticleData::read_from_particle_id(buf, particle_id)?;
|
let data = ParticleData::read_from_particle_id(buf, particle_id)?;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ async fn main() {
|
||||||
println!("Hello, world!");
|
println!("Hello, world!");
|
||||||
|
|
||||||
// let address = "95.111.249.143:10000";
|
// let address = "95.111.249.143:10000";
|
||||||
let address = "localhost:51028";
|
let address = "localhost:61146";
|
||||||
// let response = azalea_client::ping::ping_server(&address.try_into().unwrap())
|
// let response = azalea_client::ping::ping_server(&address.try_into().unwrap())
|
||||||
// .await
|
// .await
|
||||||
// .unwrap();
|
// .unwrap();
|
||||||
|
|
Loading…
Add table
Reference in a new issue