1use azalea_block::BlockState;
2use azalea_buf::AzBuf;
3use azalea_core::{color::RgbColor, entity_id::MinecraftEntityId, position::BlockPos};
4use azalea_inventory::ItemStack;
5use azalea_registry::builtin::ParticleKind;
6
7#[cfg_attr(feature = "bevy_ecs", derive(bevy_ecs::component::Component))]
12#[derive(AzBuf, Clone, Debug, PartialEq)]
13pub enum Particle {
14 AngryVillager,
15 Block(BlockParticle),
16 BlockMarker(BlockParticle),
17 Bubble,
18 Cloud,
19 CopperFireFlame,
20 Crit,
21 DamageIndicator,
22 DragonBreath,
23 DrippingLava,
24 FallingLava,
25 LandingLava,
26 DrippingWater,
27 FallingWater,
28 Dust(DustParticle),
29 DustColorTransition(DustColorTransitionParticle),
30 Effect,
31 ElderGuardian,
32 EnchantedHit,
33 Enchant,
34 EndRod,
35 EntityEffect(ColorParticle),
36 ExplosionEmitter,
37 Explosion,
38 Gust,
39 SmallGust,
40 GustEmitterLarge,
41 GustEmitterSmall,
42 SonicBoom,
43 FallingDust(BlockParticle),
44 Firework,
45 Fishing,
46 Flame,
47 Infested,
48 CherryLeaves,
49 PaleOakLeaves,
50 TintedLeaves,
51 SculkSoul,
52 SculkCharge(SculkChargeParticle),
53 SculkChargePop,
54 SoulFireFlame,
55 Soul,
56 Flash,
57 HappyVillager,
58 Composter,
59 Heart,
60 InstantEffect,
61 Item(ItemParticle),
62 Vibration(Box<VibrationParticle>),
63 Trail,
64 PauseMobGrowth,
65 ResetMobGrowth,
66 ItemSlime,
67 ItemCobweb,
68 ItemSnowball,
69 LargeSmoke,
70 Lava,
71 Mycelium,
72 Note,
73 Poof,
74 Portal,
75 Rain,
76 Smoke,
77 WhiteSmoke,
78 Sneeze,
79 Spit,
80 SquidInk,
81 SweepAttack,
82 TotemOfUndying,
83 Underwater,
84 Splash,
85 Witch,
86 BubblePop,
87 CurrentDown,
88 BubbleColumnUp,
89 Nautilus,
90 Dolphin,
91 CampfireCosySmoke,
92 CampfireSignalSmoke,
93 DrippingHoney,
94 FallingHoney,
95 LandingHoney,
96 FallingNectar,
97 FallingSporeBlossom,
98 Ash,
99 CrimsonSpore,
100 WarpedSpore,
101 SporeBlossomAir,
102 DrippingObsidianTear,
103 FallingObsidianTear,
104 LandingObsidianTear,
105 ReversePortal,
106 WhiteAsh,
107 SmallFlame,
108 Snowflake,
109 DrippingDripstoneLava,
110 FallingDripstoneLava,
111 DrippingDripstoneWater,
112 FallingDripstoneWater,
113 GlowSquidInk,
114 Glow,
115 WaxOn,
116 WaxOff,
117 ElectricSpark,
118 Scrape,
119 Shriek(ShriekParticle),
120 EggCrack,
121 DustPlume,
122 TrialSpawnerDetection,
123 TrialSpawnerDetectionOminous,
124 VaultConnection,
125 DustPillar,
126 OminousSpawning,
127 RaidOmen,
128 TrialOmen,
129 BlockCrumble,
130 Firefly,
131 SulfurBubbles,
132 NoxiousGas,
133 Geyser(GeyserParticle),
134 GeyserBase(GeyserBaseParticle),
135 GeyserPoof(GeyserBaseParticle),
136 GeyserPlume(GeyserParticle),
137 SulfurCubeGoo,
138}
139
140impl From<ParticleKind> for Particle {
141 fn from(kind: ParticleKind) -> Self {
146 match kind {
149 ParticleKind::AngryVillager => Self::AngryVillager,
150 ParticleKind::Block => Self::Block(BlockParticle::default()),
151 ParticleKind::BlockMarker => Self::BlockMarker(BlockParticle::default()),
152 ParticleKind::Bubble => Self::Bubble,
153 ParticleKind::Cloud => Self::Cloud,
154 ParticleKind::Crit => Self::Crit,
155 ParticleKind::DamageIndicator => Self::DamageIndicator,
156 ParticleKind::DragonBreath => Self::DragonBreath,
157 ParticleKind::DrippingLava => Self::DrippingLava,
158 ParticleKind::FallingLava => Self::FallingLava,
159 ParticleKind::LandingLava => Self::LandingLava,
160 ParticleKind::DrippingWater => Self::DrippingWater,
161 ParticleKind::FallingWater => Self::FallingWater,
162 ParticleKind::Dust => Self::Dust(DustParticle::default()),
163 ParticleKind::DustColorTransition => {
164 Self::DustColorTransition(DustColorTransitionParticle::default())
165 }
166 ParticleKind::Effect => Self::Effect,
167 ParticleKind::ElderGuardian => Self::ElderGuardian,
168 ParticleKind::EnchantedHit => Self::EnchantedHit,
169 ParticleKind::Enchant => Self::Enchant,
170 ParticleKind::EndRod => Self::EndRod,
171 ParticleKind::EntityEffect => Self::EntityEffect(ColorParticle::default()),
172 ParticleKind::ExplosionEmitter => Self::ExplosionEmitter,
173 ParticleKind::Explosion => Self::Explosion,
174 ParticleKind::Gust => Self::Gust,
175 ParticleKind::SonicBoom => Self::SonicBoom,
176 ParticleKind::FallingDust => Self::FallingDust(BlockParticle::default()),
177 ParticleKind::Firework => Self::Firework,
178 ParticleKind::Fishing => Self::Fishing,
179 ParticleKind::Flame => Self::Flame,
180 ParticleKind::CherryLeaves => Self::CherryLeaves,
181 ParticleKind::PaleOakLeaves => Self::PaleOakLeaves,
182 ParticleKind::TintedLeaves => Self::TintedLeaves,
183 ParticleKind::SculkSoul => Self::SculkSoul,
184 ParticleKind::SculkCharge => Self::SculkCharge(SculkChargeParticle::default()),
185 ParticleKind::SculkChargePop => Self::SculkChargePop,
186 ParticleKind::SoulFireFlame => Self::SoulFireFlame,
187 ParticleKind::Soul => Self::Soul,
188 ParticleKind::Flash => Self::Flash,
189 ParticleKind::HappyVillager => Self::HappyVillager,
190 ParticleKind::Composter => Self::Composter,
191 ParticleKind::Heart => Self::Heart,
192 ParticleKind::InstantEffect => Self::InstantEffect,
193 ParticleKind::Item => Self::Item(ItemParticle::default()),
194 ParticleKind::Vibration => Self::Vibration(Default::default()),
195 ParticleKind::ItemSlime => Self::ItemSlime,
196 ParticleKind::ItemSnowball => Self::ItemSnowball,
197 ParticleKind::LargeSmoke => Self::LargeSmoke,
198 ParticleKind::Lava => Self::Lava,
199 ParticleKind::Mycelium => Self::Mycelium,
200 ParticleKind::Note => Self::Note,
201 ParticleKind::Poof => Self::Poof,
202 ParticleKind::Portal => Self::Portal,
203 ParticleKind::Rain => Self::Rain,
204 ParticleKind::Smoke => Self::Smoke,
205 ParticleKind::WhiteSmoke => Self::WhiteSmoke,
206 ParticleKind::Sneeze => Self::Sneeze,
207 ParticleKind::Spit => Self::Spit,
208 ParticleKind::SquidInk => Self::SquidInk,
209 ParticleKind::SweepAttack => Self::SweepAttack,
210 ParticleKind::TotemOfUndying => Self::TotemOfUndying,
211 ParticleKind::Underwater => Self::Underwater,
212 ParticleKind::Splash => Self::Splash,
213 ParticleKind::Witch => Self::Witch,
214 ParticleKind::BubblePop => Self::BubblePop,
215 ParticleKind::CurrentDown => Self::CurrentDown,
216 ParticleKind::BubbleColumnUp => Self::BubbleColumnUp,
217 ParticleKind::Nautilus => Self::Nautilus,
218 ParticleKind::Dolphin => Self::Dolphin,
219 ParticleKind::CampfireCosySmoke => Self::CampfireCosySmoke,
220 ParticleKind::CampfireSignalSmoke => Self::CampfireSignalSmoke,
221 ParticleKind::DrippingHoney => Self::DrippingHoney,
222 ParticleKind::FallingHoney => Self::FallingHoney,
223 ParticleKind::LandingHoney => Self::LandingHoney,
224 ParticleKind::FallingNectar => Self::FallingNectar,
225 ParticleKind::FallingSporeBlossom => Self::FallingSporeBlossom,
226 ParticleKind::Ash => Self::Ash,
227 ParticleKind::CrimsonSpore => Self::CrimsonSpore,
228 ParticleKind::WarpedSpore => Self::WarpedSpore,
229 ParticleKind::SporeBlossomAir => Self::SporeBlossomAir,
230 ParticleKind::DrippingObsidianTear => Self::DrippingObsidianTear,
231 ParticleKind::FallingObsidianTear => Self::FallingObsidianTear,
232 ParticleKind::LandingObsidianTear => Self::LandingObsidianTear,
233 ParticleKind::ReversePortal => Self::ReversePortal,
234 ParticleKind::WhiteAsh => Self::WhiteAsh,
235 ParticleKind::SmallFlame => Self::SmallFlame,
236 ParticleKind::Snowflake => Self::Snowflake,
237 ParticleKind::DrippingDripstoneLava => Self::DrippingDripstoneLava,
238 ParticleKind::FallingDripstoneLava => Self::FallingDripstoneLava,
239 ParticleKind::DrippingDripstoneWater => Self::DrippingDripstoneWater,
240 ParticleKind::FallingDripstoneWater => Self::FallingDripstoneWater,
241 ParticleKind::GlowSquidInk => Self::GlowSquidInk,
242 ParticleKind::Glow => Self::Glow,
243 ParticleKind::WaxOn => Self::WaxOn,
244 ParticleKind::WaxOff => Self::WaxOff,
245 ParticleKind::ElectricSpark => Self::ElectricSpark,
246 ParticleKind::Scrape => Self::Scrape,
247 ParticleKind::Shriek => Self::Shriek(ShriekParticle::default()),
248 ParticleKind::EggCrack => Self::EggCrack,
249 ParticleKind::DustPlume => Self::DustPlume,
250 ParticleKind::SmallGust => Self::SmallGust,
251 ParticleKind::GustEmitterLarge => Self::GustEmitterLarge,
252 ParticleKind::GustEmitterSmall => Self::GustEmitterSmall,
253 ParticleKind::Infested => Self::Infested,
254 ParticleKind::ItemCobweb => Self::ItemCobweb,
255 ParticleKind::TrialSpawnerDetection => Self::TrialSpawnerDetection,
256 ParticleKind::TrialSpawnerDetectionOminous => Self::TrialSpawnerDetectionOminous,
257 ParticleKind::VaultConnection => Self::VaultConnection,
258 ParticleKind::DustPillar => Self::DustPillar,
259 ParticleKind::OminousSpawning => Self::OminousSpawning,
260 ParticleKind::RaidOmen => Self::RaidOmen,
261 ParticleKind::TrialOmen => Self::TrialOmen,
262 ParticleKind::Trail => Self::Trail,
263 ParticleKind::BlockCrumble => Self::BlockCrumble,
264 ParticleKind::Firefly => Self::Firefly,
265 ParticleKind::CopperFireFlame => Self::CopperFireFlame,
266 ParticleKind::PauseMobGrowth => Self::PauseMobGrowth,
267 ParticleKind::ResetMobGrowth => Self::ResetMobGrowth,
268 ParticleKind::SulfurBubbles => Self::SulfurBubbles,
269 ParticleKind::NoxiousGas => Self::NoxiousGas,
270 ParticleKind::NoxiousGasCloud => Self::NoxiousGas,
271 ParticleKind::Geyser => Self::Geyser(GeyserParticle::default()),
272 ParticleKind::GeyserBase => Self::GeyserBase(GeyserBaseParticle::default()),
273 ParticleKind::GeyserPoof => Self::GeyserPoof(GeyserBaseParticle::default()),
274 ParticleKind::GeyserPlume => Self::GeyserPlume(GeyserParticle::default()),
275 ParticleKind::SulfurCubeGoo => Self::SulfurCubeGoo,
276 }
277 }
278}
279
280impl Default for Particle {
281 fn default() -> Self {
282 Self::EntityEffect(ColorParticle::default())
283 }
284}
285
286#[derive(AzBuf, Clone, Debug, Default, PartialEq)]
287pub struct BlockParticle {
288 pub block_state: BlockState,
289}
290#[derive(AzBuf, Clone, Debug, Default, PartialEq)]
291pub struct DustParticle {
292 pub color: RgbColor,
293 pub scale: f32,
295}
296
297#[derive(AzBuf, Clone, Debug, Default, PartialEq)]
298pub struct DustColorTransitionParticle {
299 pub from: RgbColor,
300 pub to: RgbColor,
301 pub scale: f32,
303}
304
305#[derive(AzBuf, Clone, Debug, Default, PartialEq)]
306pub struct ColorParticle {
307 pub color: RgbColor,
308}
309
310#[derive(AzBuf, Clone, Debug, Default, PartialEq)]
311pub struct ItemParticle {
312 pub item: ItemStack,
313}
314
315#[derive(AzBuf, Clone, Debug, Default, PartialEq)]
316pub struct VibrationParticle {
317 pub position: PositionSource,
318 #[var]
319 pub ticks: u32,
320}
321
322#[derive(AzBuf, Clone, Debug, PartialEq)]
323pub enum PositionSource {
324 Block(BlockPos),
325 Entity {
326 #[var]
327 id: MinecraftEntityId,
328 y_offset: f32,
329 },
330}
331impl Default for PositionSource {
332 fn default() -> Self {
333 Self::Block(BlockPos::default())
335 }
336}
337
338#[derive(AzBuf, Clone, Debug, Default, PartialEq)]
339pub struct SculkChargeParticle {
340 pub roll: f32,
341}
342
343#[derive(AzBuf, Clone, Debug, Default, PartialEq)]
344pub struct ShriekParticle {
345 #[var]
347 pub delay: i32,
348}
349
350#[derive(AzBuf, Clone, Debug, Default, PartialEq)]
351pub struct GeyserParticle {
352 pub water_blocks: i32,
353}
354
355#[derive(AzBuf, Clone, Debug, Default, PartialEq)]
356pub struct GeyserBaseParticle {
357 pub water_blocks: i32,
358 pub burst_impulse_base: f32,
359}