Add 1.13.2+ protocol parsing Particle packet variant. Fixes #104
Pre-1.13.2 particle packet: https://wiki.vg/index.php?title=Protocol&oldid=14204#Particle_2 1.13.2 and later: https://wiki.vg/Protocol#Particle_2 + https://wiki.vg/Protocol#Particle Split into Particle_Data (1.13.2+) and Particle_VarIntArray (pre-1.13.2) Fixes crash when landing when dropping from creative flight, among other crashes when a particle packet is sent.
This commit is contained in:
parent
1aaf8292ba
commit
7624b89292
|
@ -1010,7 +1010,7 @@ state_packets!(
|
|||
}
|
||||
/// Particle spawns particles at the target location with the various
|
||||
/// modifiers.
|
||||
packet Particle {
|
||||
packet Particle_Data {
|
||||
field particle_id: i32 =,
|
||||
field long_distance: bool =,
|
||||
field x: f32 =,
|
||||
|
@ -1021,8 +1021,26 @@ state_packets!(
|
|||
field offset_z: f32 =,
|
||||
field speed: f32 =,
|
||||
field count: i32 =,
|
||||
field data1: VarInt = when(|p: &Particle| p.particle_id == 36 || p.particle_id == 37 || p.particle_id == 38 || p.particle_id == 46),
|
||||
field data2: VarInt = when(|p: &Particle| p.particle_id == 36),
|
||||
field block_state: VarInt = when(|p: &Particle_Data| p.particle_id == 3 || p.particle_id == 20),
|
||||
field red: f32 = when(|p: &Particle_Data| p.particle_id == 11),
|
||||
field green: f32 = when(|p: &Particle_Data| p.particle_id == 11),
|
||||
field blue: f32 = when(|p: &Particle_Data| p.particle_id == 11),
|
||||
field scale: f32 = when(|p: &Particle_Data| p.particle_id == 11),
|
||||
field item: Option<nbt::NamedTag> = when(|p: &Particle_Data| p.particle_id == 27),
|
||||
}
|
||||
packet Particle_VarIntArray {
|
||||
field particle_id: i32 =,
|
||||
field long_distance: bool =,
|
||||
field x: f32 =,
|
||||
field y: f32 =,
|
||||
field z: f32 =,
|
||||
field offset_x: f32 =,
|
||||
field offset_y: f32 =,
|
||||
field offset_z: f32 =,
|
||||
field speed: f32 =,
|
||||
field count: i32 =,
|
||||
field data1: VarInt = when(|p: &Particle_VarIntArray| p.particle_id == 36 || p.particle_id == 37 || p.particle_id == 38 || p.particle_id == 46),
|
||||
field data2: VarInt = when(|p: &Particle_VarIntArray| p.particle_id == 36),
|
||||
}
|
||||
packet Particle_Named {
|
||||
field particle_id: String =,
|
||||
|
|
|
@ -71,7 +71,7 @@ protocol_packet_ids!(
|
|||
0x1f => KeepAliveClientbound_VarInt
|
||||
0x20 => ChunkData_NoEntities
|
||||
0x21 => Effect
|
||||
0x22 => Particle
|
||||
0x22 => Particle_VarIntArray
|
||||
0x23 => NamedSoundEffect_u8_NoCategory
|
||||
0x24 => JoinGame_i8
|
||||
0x25 => Maps
|
||||
|
|
|
@ -89,7 +89,7 @@ protocol_packet_ids!(
|
|||
0x21 => KeepAliveClientbound_i64
|
||||
0x22 => ChunkData_HeightMap
|
||||
0x23 => Effect
|
||||
0x24 => Particle
|
||||
0x24 => Particle_VarIntArray
|
||||
0x25 => JoinGame_i32
|
||||
0x26 => Maps
|
||||
0x27 => Entity
|
||||
|
|
|
@ -89,7 +89,7 @@ protocol_packet_ids!(
|
|||
0x21 => KeepAliveClientbound_i64
|
||||
0x22 => ChunkData_HeightMap
|
||||
0x23 => Effect
|
||||
0x24 => Particle
|
||||
0x24 => Particle_Data
|
||||
0x25 => JoinGame_i32
|
||||
0x26 => Maps
|
||||
0x27 => Entity
|
||||
|
|
|
@ -74,7 +74,7 @@ protocol_packet_ids!(
|
|||
0x1f => KeepAliveClientbound_VarInt
|
||||
0x20 => ChunkData
|
||||
0x21 => Effect
|
||||
0x22 => Particle
|
||||
0x22 => Particle_VarIntArray
|
||||
0x23 => JoinGame_i32
|
||||
0x24 => Maps
|
||||
0x25 => EntityMove_i16
|
||||
|
|
|
@ -74,7 +74,7 @@ protocol_packet_ids!(
|
|||
0x1f => KeepAliveClientbound_VarInt
|
||||
0x20 => ChunkData
|
||||
0x21 => Effect
|
||||
0x22 => Particle
|
||||
0x22 => Particle_VarIntArray
|
||||
0x23 => JoinGame_i32
|
||||
0x24 => Maps
|
||||
0x25 => EntityMove_i16
|
||||
|
|
|
@ -77,7 +77,7 @@ protocol_packet_ids!(
|
|||
0x1f => KeepAliveClientbound_i64
|
||||
0x20 => ChunkData
|
||||
0x21 => Effect
|
||||
0x22 => Particle
|
||||
0x22 => Particle_VarIntArray
|
||||
0x23 => JoinGame_i32
|
||||
0x24 => Maps
|
||||
0x25 => Entity
|
||||
|
|
|
@ -89,7 +89,7 @@ protocol_packet_ids!(
|
|||
0x21 => KeepAliveClientbound_i64
|
||||
0x22 => ChunkData
|
||||
0x23 => Effect
|
||||
0x24 => Particle
|
||||
0x24 => Particle_Data
|
||||
0x25 => JoinGame_i32
|
||||
0x26 => Maps
|
||||
0x27 => Entity
|
||||
|
|
|
@ -78,7 +78,7 @@ protocol_packet_ids!(
|
|||
0x27 => Explosion
|
||||
0x28 => Effect
|
||||
0x29 => NamedSoundEffect_u8_NoCategory
|
||||
0x2a => Particle
|
||||
0x2a => Particle_VarIntArray
|
||||
0x2b => ChangeGameState
|
||||
0x2c => SpawnGlobalEntity_i32
|
||||
0x2d => WindowOpen
|
||||
|
|
|
@ -74,7 +74,7 @@ protocol_packet_ids!(
|
|||
0x1f => KeepAliveClientbound_VarInt
|
||||
0x20 => ChunkData_NoEntities
|
||||
0x21 => Effect
|
||||
0x22 => Particle
|
||||
0x22 => Particle_VarIntArray
|
||||
0x23 => JoinGame_i8
|
||||
0x24 => Maps
|
||||
0x25 => EntityMove_i16
|
||||
|
|
|
@ -74,7 +74,7 @@ protocol_packet_ids!(
|
|||
0x1f => KeepAliveClientbound_VarInt
|
||||
0x20 => ChunkData_NoEntities
|
||||
0x21 => Effect
|
||||
0x22 => Particle
|
||||
0x22 => Particle_VarIntArray
|
||||
0x23 => JoinGame_i32
|
||||
0x24 => Maps
|
||||
0x25 => EntityMove_i16
|
||||
|
|
Loading…
Reference in New Issue