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
37#if PROTOCOL_VERSION > 765
40#if PROTOCOL_VERSION > 754
43#if PROTOCOL_VERSION > 392
47#if PROTOCOL_VERSION < 393
50#if PROTOCOL_VERSION > 392
53#if PROTOCOL_VERSION > 758
56#if PROTOCOL_VERSION > 758
59#if PROTOCOL_VERSION > 767
75#if PROTOCOL_VERSION > 392
77 #if PROTOCOL_VERSION < 766
78 "ambient_entity_effect",
81 #if PROTOCOL_VERSION < 757
84 #if PROTOCOL_VERSION > 754 && PROTOCOL_VERSION < 757
88 #if PROTOCOL_VERSION > 756
97 #if PROTOCOL_VERSION > 476
102 #if PROTOCOL_VERSION > 476
106 #if PROTOCOL_VERSION > 754
107 "dust_color_transition",
117 #if PROTOCOL_VERSION > 764
119 #if PROTOCOL_VERSION < 766
123 #if PROTOCOL_VERSION > 765
125 "gust_emitter_large",
126 "gust_emitter_small",
128 #if PROTOCOL_VERSION > 758
135 #if PROTOCOL_VERSION > 761 && PROTOCOL_VERSION < 763
136 "dripping_cherry_leaves",
137 "falling_cherry_leaves",
138 "landing_cherry_leaves",
140 #if PROTOCOL_VERSION > 765
143 #if PROTOCOL_VERSION > 762
146 #if PROTOCOL_VERSION > 768
149#if PROTOCOL_VERSION > 769
152 #if PROTOCOL_VERSION > 758
157 #if PROTOCOL_VERSION > 734
161 #if PROTOCOL_VERSION > 476
165 #if PROTOCOL_VERSION > 476
171 #if PROTOCOL_VERSION > 754
174#if PROTOCOL_VERSION > 767
178 #if PROTOCOL_VERSION > 765
190 #if PROTOCOL_VERSION > 764
193 #if PROTOCOL_VERSION > 476
208 #if PROTOCOL_VERSION > 476
209 "campfire_cosy_smoke",
210 "campfire_signal_smoke",
212 #if PROTOCOL_VERSION > 572
218 #if PROTOCOL_VERSION > 754
219 "falling_spore_blossom",
221 #if PROTOCOL_VERSION > 734
226 #if PROTOCOL_VERSION > 754
229 #if PROTOCOL_VERSION > 734
230 "dripping_obsidian_tear",
231 "falling_obsidian_tear",
232 "landing_obsidian_tear",
236 #if PROTOCOL_VERSION > 754
239 "dripping_dripstone_lava",
240 "falling_dripstone_lava",
241 "dripping_dripstone_water",
242 "falling_dripstone_water",
250 #if PROTOCOL_VERSION > 758
253 #if PROTOCOL_VERSION > 762
256 #if PROTOCOL_VERSION > 764
258 #if PROTOCOL_VERSION < 766
261 "trial_spawner_detection",
263 #if PROTOCOL_VERSION > 765
264 "trial_spawner_detection_ominous",
271#if PROTOCOL_VERSION > 767
274#if PROTOCOL_VERSION > 769
342 throw std::runtime_error(
"Unable to create particle with id: " + std::to_string(
static_cast<int>(particle_type_)) +
".");
348#if PROTOCOL_VERSION > 392
351#if PROTOCOL_VERSION > 756
354#if PROTOCOL_VERSION > 765
357#if PROTOCOL_VERSION > 767
360 Options = std::make_shared<BlockParticleOptions>();
363 Options = std::make_shared<DustParticleOptions>();
366 Options = std::make_shared<ItemParticleOptions>();
368#if PROTOCOL_VERSION > 754
370 Options = std::make_shared<DustColorTransitionOptions>();
373 Options = std::make_shared<VibrationParticleOptions>();
376#if PROTOCOL_VERSION > 758
378 Options = std::make_shared<SculkChargeParticleOptions>();
381 Options = std::make_shared<ShriekParticleOptions>();
384#if PROTOCOL_VERSION > 765
386#if PROTOCOL_VERSION > 769
389 Options = std::make_shared<ColorParticleOptions>();
392#if PROTOCOL_VERSION > 767
394 Options = std::make_shared<TrailParticleOptions>();
398 case ParticleType::Blockcrack:
399 case ParticleType::Blockdust:
401 Options = std::make_shared<BlockParticleOptions>();
403 case ParticleType::Iconcrack:
404 Options = std::make_shared<IconcrackParticleOptions>();
408 Options = std::make_shared<EmptyParticleOptions>();
414#if PROTOCOL_VERSION < 766
415 void Particle::ReadOptions(
ReadIterator& iter,
size_t& length)
417 if (Options !=
nullptr)
419 Options->Read(iter, length);
425 if (Options !=
nullptr)
427 Options->Write(container);
434 ParticleType = ReadData<ProtocolCraft::ParticleType, VarInt>(iter, length);
436 if (Options !=
nullptr)
438 Options->Read(iter, length);
444 WriteData<ProtocolCraft::ParticleType, VarInt>(
ParticleType, container);
445 if (Options !=
nullptr)
447 Options->Write(container);
455 output[std::string(field_name<ParticleType_index>)] =
GetName();
456 output[std::string(field_name<Options_index>)] = Options ==
nullptr ? Json::Object() : Options->
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