Update particles for 1.19.4 (#313)

## Description

Updated the Particle enum for 1.19.4

## Test Plan

Steps:
1. Run the particles.rs example

---------

Co-authored-by: Ryan <ryanj00a@gmail.com>
This commit is contained in:
vytskalt 2023-04-02 23:22:23 +03:00 committed by GitHub
parent 9c9f672a22
commit cd8a9266ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 149 additions and 128 deletions

View file

@ -69,7 +69,7 @@ fn manage_particles(
mut instances: Query<&mut Instance>, mut instances: Query<&mut Instance>,
mut particle_idx: Local<usize>, mut particle_idx: Local<usize>,
) { ) {
if server.current_tick() % 20 != 0 { if server.current_tick() % 10 != 0 {
return; return;
} }
@ -135,6 +135,9 @@ fn create_particle_vec() -> Vec<Particle> {
Particle::Firework, Particle::Firework,
Particle::Fishing, Particle::Fishing,
Particle::Flame, Particle::Flame,
Particle::DrippingCherryLeaves,
Particle::FallingCherryLeaves,
Particle::LandingCherryLeaves,
Particle::SculkSoul, Particle::SculkSoul,
Particle::SculkCharge { roll: 1.0 }, Particle::SculkCharge { roll: 1.0 },
Particle::SculkChargePop, Particle::SculkChargePop,
@ -207,5 +210,6 @@ fn create_particle_vec() -> Vec<Particle> {
Particle::WaxOff, Particle::WaxOff,
Particle::ElectricSpark, Particle::ElectricSpark,
Particle::Scrape, Particle::Scrape,
Particle::Shriek { delay: 0 },
] ]
} }

View file

@ -57,6 +57,9 @@ pub enum Particle {
Firework, Firework,
Fishing, Fishing,
Flame, Flame,
DrippingCherryLeaves,
FallingCherryLeaves,
LandingCherryLeaves,
SculkSoul, SculkSoul,
SculkCharge { SculkCharge {
roll: f32, roll: f32,
@ -132,6 +135,9 @@ pub enum Particle {
WaxOff, WaxOff,
ElectricSpark, ElectricSpark,
Scrape, Scrape,
Shriek {
delay: i32,
},
} }
impl Particle { impl Particle {
@ -166,70 +172,74 @@ impl Particle {
Particle::Firework => 26, Particle::Firework => 26,
Particle::Fishing => 27, Particle::Fishing => 27,
Particle::Flame => 28, Particle::Flame => 28,
Particle::SculkSoul => 29, Particle::DrippingCherryLeaves => 29,
Particle::SculkCharge { .. } => 30, Particle::FallingCherryLeaves => 30,
Particle::SculkChargePop => 31, Particle::LandingCherryLeaves => 31,
Particle::SoulFireFlame => 32, Particle::SculkSoul => 32,
Particle::Soul => 33, Particle::SculkCharge { .. } => 33,
Particle::Flash => 34, Particle::SculkChargePop => 34,
Particle::HappyVillager => 35, Particle::SoulFireFlame => 35,
Particle::Composter => 36, Particle::Soul => 36,
Particle::Heart => 37, Particle::Flash => 37,
Particle::InstantEffect => 38, Particle::HappyVillager => 38,
Particle::Item(_) => 39, Particle::Composter => 39,
Particle::VibrationBlock { .. } => 40, Particle::Heart => 40,
Particle::VibrationEntity { .. } => 40, Particle::InstantEffect => 41,
Particle::ItemSlime => 41, Particle::Item { .. } => 42,
Particle::ItemSnowball => 42, Particle::VibrationBlock { .. } => 43,
Particle::LargeSmoke => 43, Particle::VibrationEntity { .. } => 43,
Particle::Lava => 44, Particle::ItemSlime => 44,
Particle::Mycelium => 45, Particle::ItemSnowball => 45,
Particle::Note => 46, Particle::LargeSmoke => 46,
Particle::Poof => 47, Particle::Lava => 47,
Particle::Portal => 48, Particle::Mycelium => 48,
Particle::Rain => 49, Particle::Note => 49,
Particle::Smoke => 50, Particle::Poof => 50,
Particle::Sneeze => 51, Particle::Portal => 51,
Particle::Spit => 52, Particle::Rain => 52,
Particle::SquidInk => 53, Particle::Smoke => 53,
Particle::SweepAttack => 54, Particle::Sneeze => 54,
Particle::TotemOfUndying => 55, Particle::Spit => 55,
Particle::Underwater => 56, Particle::SquidInk => 56,
Particle::Splash => 57, Particle::SweepAttack => 57,
Particle::Witch => 58, Particle::TotemOfUndying => 58,
Particle::BubblePop => 59, Particle::Underwater => 59,
Particle::CurrentDown => 60, Particle::Splash => 60,
Particle::BubbleColumnUp => 61, Particle::Witch => 61,
Particle::Nautilus => 62, Particle::BubblePop => 62,
Particle::Dolphin => 63, Particle::CurrentDown => 63,
Particle::CampfireCosySmoke => 64, Particle::BubbleColumnUp => 64,
Particle::CampfireSignalSmoke => 65, Particle::Nautilus => 65,
Particle::DrippingHoney => 66, Particle::Dolphin => 66,
Particle::FallingHoney => 67, Particle::CampfireCosySmoke => 67,
Particle::LandingHoney => 68, Particle::CampfireSignalSmoke => 68,
Particle::FallingNectar => 69, Particle::DrippingHoney => 69,
Particle::FallingSporeBlossom => 70, Particle::FallingHoney => 70,
Particle::Ash => 71, Particle::LandingHoney => 71,
Particle::CrimsonSpore => 72, Particle::FallingNectar => 72,
Particle::WarpedSpore => 73, Particle::FallingSporeBlossom => 73,
Particle::SporeBlossomAir => 74, Particle::Ash => 74,
Particle::DrippingObsidianTear => 75, Particle::CrimsonSpore => 75,
Particle::FallingObsidianTear => 76, Particle::WarpedSpore => 76,
Particle::LandingObsidianTear => 77, Particle::SporeBlossomAir => 77,
Particle::ReversePortal => 78, Particle::DrippingObsidianTear => 78,
Particle::WhiteAsh => 79, Particle::FallingObsidianTear => 79,
Particle::SmallFlame => 80, Particle::LandingObsidianTear => 80,
Particle::Snowflake => 81, Particle::ReversePortal => 81,
Particle::DrippingDripstoneLava => 82, Particle::WhiteAsh => 82,
Particle::FallingDripstoneLava => 83, Particle::SmallFlame => 83,
Particle::DrippingDripstoneWater => 84, Particle::Snowflake => 84,
Particle::FallingDripstoneWater => 85, Particle::DrippingDripstoneLava => 85,
Particle::GlowSquidInk => 86, Particle::FallingDripstoneLava => 86,
Particle::Glow => 87, Particle::DrippingDripstoneWater => 87,
Particle::WaxOn => 88, Particle::FallingDripstoneWater => 88,
Particle::WaxOff => 89, Particle::GlowSquidInk => 89,
Particle::ElectricSpark => 90, Particle::Glow => 90,
Particle::Scrape => 91, Particle::WaxOn => 91,
Particle::WaxOff => 92,
Particle::ElectricSpark => 93,
Particle::Scrape => 94,
Particle::Shriek { .. } => 95,
} }
} }
@ -272,20 +282,23 @@ impl Particle {
26 => Particle::Firework, 26 => Particle::Firework,
27 => Particle::Fishing, 27 => Particle::Fishing,
28 => Particle::Flame, 28 => Particle::Flame,
29 => Particle::SculkSoul, 29 => Particle::DrippingCherryLeaves,
30 => Particle::SculkCharge { 30 => Particle::FallingCherryLeaves,
31 => Particle::LandingCherryLeaves,
32 => Particle::SculkSoul,
33 => Particle::SculkCharge {
roll: f32::decode(r)?, roll: f32::decode(r)?,
}, },
31 => Particle::SculkChargePop, 34 => Particle::SculkChargePop,
32 => Particle::SoulFireFlame, 35 => Particle::SoulFireFlame,
33 => Particle::Soul, 36 => Particle::Soul,
34 => Particle::Flash, 37 => Particle::Flash,
35 => Particle::HappyVillager, 38 => Particle::HappyVillager,
36 => Particle::Composter, 39 => Particle::Composter,
37 => Particle::Heart, 40 => Particle::Heart,
38 => Particle::InstantEffect, 41 => Particle::InstantEffect,
39 => Particle::Item(Decode::decode(r)?), 42 => Particle::Item(Decode::decode(r)?),
40 => match <&str>::decode(r)? { 43 => match <&str>::decode(r)? {
"block" => Particle::VibrationBlock { "block" => Particle::VibrationBlock {
block_pos: BlockPos::decode(r)?, block_pos: BlockPos::decode(r)?,
ticks: VarInt::decode(r)?.0, ticks: VarInt::decode(r)?.0,
@ -297,57 +310,60 @@ impl Particle {
}, },
invalid => bail!("invalid vibration position source of \"{invalid}\""), invalid => bail!("invalid vibration position source of \"{invalid}\""),
}, },
41 => Particle::ItemSlime, 44 => Particle::ItemSlime,
42 => Particle::ItemSnowball, 45 => Particle::ItemSnowball,
43 => Particle::LargeSmoke, 46 => Particle::LargeSmoke,
44 => Particle::Lava, 47 => Particle::Lava,
45 => Particle::Mycelium, 48 => Particle::Mycelium,
46 => Particle::Note, 49 => Particle::Note,
47 => Particle::Poof, 50 => Particle::Poof,
48 => Particle::Portal, 51 => Particle::Portal,
49 => Particle::Rain, 52 => Particle::Rain,
50 => Particle::Smoke, 53 => Particle::Smoke,
51 => Particle::Sneeze, 54 => Particle::Sneeze,
52 => Particle::Spit, 55 => Particle::Spit,
53 => Particle::SquidInk, 56 => Particle::SquidInk,
54 => Particle::SweepAttack, 57 => Particle::SweepAttack,
55 => Particle::TotemOfUndying, 58 => Particle::TotemOfUndying,
56 => Particle::Underwater, 59 => Particle::Underwater,
57 => Particle::Splash, 60 => Particle::Splash,
58 => Particle::Witch, 61 => Particle::Witch,
59 => Particle::BubblePop, 62 => Particle::BubblePop,
60 => Particle::CurrentDown, 63 => Particle::CurrentDown,
61 => Particle::BubbleColumnUp, 64 => Particle::BubbleColumnUp,
62 => Particle::Nautilus, 65 => Particle::Nautilus,
63 => Particle::Dolphin, 66 => Particle::Dolphin,
64 => Particle::CampfireCosySmoke, 67 => Particle::CampfireCosySmoke,
65 => Particle::CampfireSignalSmoke, 68 => Particle::CampfireSignalSmoke,
66 => Particle::DrippingHoney, 69 => Particle::DrippingHoney,
67 => Particle::FallingHoney, 70 => Particle::FallingHoney,
68 => Particle::LandingHoney, 71 => Particle::LandingHoney,
69 => Particle::FallingNectar, 72 => Particle::FallingNectar,
70 => Particle::FallingSporeBlossom, 73 => Particle::FallingSporeBlossom,
71 => Particle::Ash, 74 => Particle::Ash,
72 => Particle::CrimsonSpore, 75 => Particle::CrimsonSpore,
73 => Particle::WarpedSpore, 76 => Particle::WarpedSpore,
74 => Particle::SporeBlossomAir, 77 => Particle::SporeBlossomAir,
75 => Particle::DrippingObsidianTear, 78 => Particle::DrippingObsidianTear,
76 => Particle::FallingObsidianTear, 79 => Particle::FallingObsidianTear,
77 => Particle::LandingObsidianTear, 80 => Particle::LandingObsidianTear,
78 => Particle::ReversePortal, 81 => Particle::ReversePortal,
79 => Particle::WhiteAsh, 82 => Particle::WhiteAsh,
80 => Particle::SmallFlame, 83 => Particle::SmallFlame,
81 => Particle::Snowflake, 84 => Particle::Snowflake,
82 => Particle::DrippingDripstoneLava, 85 => Particle::DrippingDripstoneLava,
83 => Particle::FallingDripstoneLava, 86 => Particle::FallingDripstoneLava,
84 => Particle::DrippingDripstoneWater, 87 => Particle::DrippingDripstoneWater,
85 => Particle::FallingDripstoneWater, 88 => Particle::FallingDripstoneWater,
86 => Particle::GlowSquidInk, 89 => Particle::GlowSquidInk,
87 => Particle::Glow, 90 => Particle::Glow,
88 => Particle::WaxOn, 91 => Particle::WaxOn,
89 => Particle::WaxOff, 92 => Particle::WaxOff,
90 => Particle::ElectricSpark, 93 => Particle::ElectricSpark,
91 => Particle::Scrape, 94 => Particle::Scrape,
95 => Particle::Shriek {
delay: VarInt::decode(r)?.0,
},
id => bail!("invalid particle ID of {id}"), id => bail!("invalid particle ID of {id}"),
}) })
} }
@ -423,6 +439,7 @@ impl Encode for Particle {
entity_eye_height.encode(&mut w)?; entity_eye_height.encode(&mut w)?;
VarInt(*ticks).encode(w) VarInt(*ticks).encode(w)
} }
Particle::Shriek { delay } => VarInt(*delay).encode(w),
_ => Ok(()), _ => Ok(()),
} }
} }