8#if PROTOCOL_VERSION > 392
15#if PROTOCOL_VERSION > 754
19#if PROTOCOL_VERSION > 758
23#if PROTOCOL_VERSION > 765
26#if PROTOCOL_VERSION > 767
29#if PROTOCOL_VERSION > 772
34#if PROTOCOL_VERSION > 772
45#if PROTOCOL_VERSION > 765
48#if PROTOCOL_VERSION > 754
51#if PROTOCOL_VERSION > 392
55#if PROTOCOL_VERSION < 393
58#if PROTOCOL_VERSION > 392
61#if PROTOCOL_VERSION > 758
64#if PROTOCOL_VERSION > 758
67#if PROTOCOL_VERSION > 767
70#if PROTOCOL_VERSION > 772
75#if PROTOCOL_VERSION > 772
91#if PROTOCOL_VERSION > 392
93#if PROTOCOL_VERSION < 766
94 "ambient_entity_effect",
97#if PROTOCOL_VERSION < 757
100#if PROTOCOL_VERSION > 754 && PROTOCOL_VERSION < 757
104#if PROTOCOL_VERSION > 756
109#if PROTOCOL_VERSION > 772
116#if PROTOCOL_VERSION > 476
121#if PROTOCOL_VERSION > 476
125#if PROTOCOL_VERSION > 754
126 "dust_color_transition",
136#if PROTOCOL_VERSION > 764
138#if PROTOCOL_VERSION < 766
142#if PROTOCOL_VERSION > 765
144 "gust_emitter_large",
145 "gust_emitter_small",
147#if PROTOCOL_VERSION > 758
154#if PROTOCOL_VERSION > 761 && PROTOCOL_VERSION < 763
155 "dripping_cherry_leaves",
156 "falling_cherry_leaves",
157 "landing_cherry_leaves",
159#if PROTOCOL_VERSION > 765
162#if PROTOCOL_VERSION > 762
165#if PROTOCOL_VERSION > 768
168#if PROTOCOL_VERSION > 769
171#if PROTOCOL_VERSION > 758
176#if PROTOCOL_VERSION > 734
180#if PROTOCOL_VERSION > 476
184#if PROTOCOL_VERSION > 476
190#if PROTOCOL_VERSION > 754
193#if PROTOCOL_VERSION > 767
196#if PROTOCOL_VERSION > 775
201#if PROTOCOL_VERSION > 765
213#if PROTOCOL_VERSION > 764
216#if PROTOCOL_VERSION > 476
231#if PROTOCOL_VERSION > 476
232 "campfire_cosy_smoke",
233 "campfire_signal_smoke",
235#if PROTOCOL_VERSION > 572
241#if PROTOCOL_VERSION > 754
242 "falling_spore_blossom",
244#if PROTOCOL_VERSION > 734
249#if PROTOCOL_VERSION > 754
252#if PROTOCOL_VERSION > 734
253 "dripping_obsidian_tear",
254 "falling_obsidian_tear",
255 "landing_obsidian_tear",
259#if PROTOCOL_VERSION > 754
262 "dripping_dripstone_lava",
263 "falling_dripstone_lava",
264 "dripping_dripstone_water",
265 "falling_dripstone_water",
273#if PROTOCOL_VERSION > 758
276#if PROTOCOL_VERSION > 762
279#if PROTOCOL_VERSION > 764
281#if PROTOCOL_VERSION < 766
284 "trial_spawner_detection",
286#if PROTOCOL_VERSION > 765
287 "trial_spawner_detection_ominous",
294#if PROTOCOL_VERSION > 767
297#if PROTOCOL_VERSION > 769
365 throw std::runtime_error(
"Unable to create particle with id: " + std::to_string(
static_cast<int>(particle_type_)) +
".");
371#if PROTOCOL_VERSION > 392
374#if PROTOCOL_VERSION > 756
377#if PROTOCOL_VERSION > 765
380#if PROTOCOL_VERSION > 767
383 Option = std::make_shared<BlockParticleOption>();
386 Option = std::make_shared<DustParticleOption>();
389 Option = std::make_shared<ItemParticleOption>();
391#if PROTOCOL_VERSION > 754
393 Option = std::make_shared<DustColorTransitionOption>();
396 Option = std::make_shared<VibrationParticleOption>();
399#if PROTOCOL_VERSION > 758
401 Option = std::make_shared<SculkChargeParticleOption>();
404 Option = std::make_shared<ShriekParticleOption>();
407#if PROTOCOL_VERSION > 765
409#if PROTOCOL_VERSION > 769
412#if PROTOCOL_VERSION > 772
415 Option = std::make_shared<ColorParticleOption>();
418#if PROTOCOL_VERSION > 767
420 Option = std::make_shared<TrailParticleOption>();
423#if PROTOCOL_VERSION > 772
425 Option = std::make_shared<PowerParticleOption>();
429 Option = std::make_shared<SpellParticleOption>();
433 case ParticleType::Blockcrack:
434 case ParticleType::Blockdust:
436 Option = std::make_shared<BlockParticleOption>();
438 case ParticleType::Iconcrack:
439 Option = std::make_shared<IconcrackParticleOption>();
443 Option = std::make_shared<EmptyParticleOption>();
449#if PROTOCOL_VERSION < 766
450 void Particle::ReadOption(
ReadIterator& iter,
size_t& length)
452 if (Option !=
nullptr)
454 Option->Read(iter, length);
460 if (Option !=
nullptr)
462 Option->Write(container);
469 ParticleType = ReadData<ProtocolCraft::ParticleType, VarInt>(iter, length);
471 if (Option !=
nullptr)
473 Option->Read(iter, length);
479 WriteData<ProtocolCraft::ParticleType, VarInt>(
ParticleType, container);
480 if (Option !=
nullptr)
482 Option->Write(container);
490 output[std::string(field_name<ParticleType_index>)] =
GetName();
491 output[std::string(field_name<Option_index>)] = Option ==
nullptr ? Json::Object() : Option->
Serialize();
#define DEFINE_NETWORK_TYPE(ClassName)
virtual Json::Value SerializeImpl() const =0
virtual void WriteImpl(WriteContainer &container) const =0
virtual Json::Value Serialize() const
virtual void ReadImpl(ReadIterator &iter, size_t &length)=0
Particle & SetParticleType(const ProtocolCraft::ParticleType particle_type_)
std::string_view GetName() const
std::vector< unsigned char > WriteContainer
std::vector< unsigned char >::const_iterator ReadIterator