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
197 #if PROTOCOL_VERSION > 765
209 #if PROTOCOL_VERSION > 764
212 #if PROTOCOL_VERSION > 476
227 #if PROTOCOL_VERSION > 476
228 "campfire_cosy_smoke",
229 "campfire_signal_smoke",
231 #if PROTOCOL_VERSION > 572
237 #if PROTOCOL_VERSION > 754
238 "falling_spore_blossom",
240 #if PROTOCOL_VERSION > 734
245 #if PROTOCOL_VERSION > 754
248 #if PROTOCOL_VERSION > 734
249 "dripping_obsidian_tear",
250 "falling_obsidian_tear",
251 "landing_obsidian_tear",
255 #if PROTOCOL_VERSION > 754
258 "dripping_dripstone_lava",
259 "falling_dripstone_lava",
260 "dripping_dripstone_water",
261 "falling_dripstone_water",
269 #if PROTOCOL_VERSION > 758
272 #if PROTOCOL_VERSION > 762
275 #if PROTOCOL_VERSION > 764
277 #if PROTOCOL_VERSION < 766
280 "trial_spawner_detection",
282 #if PROTOCOL_VERSION > 765
283 "trial_spawner_detection_ominous",
290#if PROTOCOL_VERSION > 767
293#if PROTOCOL_VERSION > 769
361 throw std::runtime_error(
"Unable to create particle with id: " + std::to_string(
static_cast<int>(particle_type_)) +
".");
367#if PROTOCOL_VERSION > 392
370#if PROTOCOL_VERSION > 756
373#if PROTOCOL_VERSION > 765
376#if PROTOCOL_VERSION > 767
379 Option = std::make_shared<BlockParticleOption>();
382 Option = std::make_shared<DustParticleOption>();
385 Option = std::make_shared<ItemParticleOption>();
387#if PROTOCOL_VERSION > 754
389 Option = std::make_shared<DustColorTransitionOption>();
392 Option = std::make_shared<VibrationParticleOption>();
395#if PROTOCOL_VERSION > 758
397 Option = std::make_shared<SculkChargeParticleOption>();
400 Option = std::make_shared<ShriekParticleOption>();
403#if PROTOCOL_VERSION > 765
405#if PROTOCOL_VERSION > 769
408#if PROTOCOL_VERSION > 772
411 Option = std::make_shared<ColorParticleOption>();
414#if PROTOCOL_VERSION > 767
416 Option = std::make_shared<TrailParticleOption>();
419#if PROTOCOL_VERSION > 772
421 Option = std::make_shared<PowerParticleOption>();
425 Option = std::make_shared<SpellParticleOption>();
429 case ParticleType::Blockcrack:
430 case ParticleType::Blockdust:
432 Option = std::make_shared<BlockParticleOption>();
434 case ParticleType::Iconcrack:
435 Option = std::make_shared<IconcrackParticleOption>();
439 Option = std::make_shared<EmptyParticleOption>();
445#if PROTOCOL_VERSION < 766
446 void Particle::ReadOption(
ReadIterator& iter,
size_t& length)
448 if (Option !=
nullptr)
450 Option->Read(iter, length);
456 if (Option !=
nullptr)
458 Option->Write(container);
465 ParticleType = ReadData<ProtocolCraft::ParticleType, VarInt>(iter, length);
467 if (Option !=
nullptr)
469 Option->Read(iter, length);
475 WriteData<ProtocolCraft::ParticleType, VarInt>(
ParticleType, container);
476 if (Option !=
nullptr)
478 Option->Write(container);
486 output[std::string(field_name<ParticleType_index>)] =
GetName();
487 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