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

View file

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