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 > 758
154 #if PROTOCOL_VERSION > 734
158 #if PROTOCOL_VERSION > 476
162 #if PROTOCOL_VERSION > 476
168 #if PROTOCOL_VERSION > 754
171#if PROTOCOL_VERSION > 767
175 #if PROTOCOL_VERSION > 765
187 #if PROTOCOL_VERSION > 764
190 #if PROTOCOL_VERSION > 476
205 #if PROTOCOL_VERSION > 476
206 "campfire_cosy_smoke",
207 "campfire_signal_smoke",
209 #if PROTOCOL_VERSION > 572
215 #if PROTOCOL_VERSION > 754
216 "falling_spore_blossom",
218 #if PROTOCOL_VERSION > 734
223 #if PROTOCOL_VERSION > 754
226 #if PROTOCOL_VERSION > 734
227 "dripping_obsidian_tear",
228 "falling_obsidian_tear",
229 "landing_obsidian_tear",
233 #if PROTOCOL_VERSION > 754
236 "dripping_dripstone_lava",
237 "falling_dripstone_lava",
238 "dripping_dripstone_water",
239 "falling_dripstone_water",
247 #if PROTOCOL_VERSION > 758
250 #if PROTOCOL_VERSION > 762
253 #if PROTOCOL_VERSION > 764
255 #if PROTOCOL_VERSION < 766
258 "trial_spawner_detection",
260 #if PROTOCOL_VERSION > 765
261 "trial_spawner_detection_ominous",
268#if PROTOCOL_VERSION > 767
336 throw std::runtime_error(
"Unable to create particle with id: " + std::to_string(
static_cast<int>(particle_type_)) +
".");
342#if PROTOCOL_VERSION > 392
345#if PROTOCOL_VERSION > 756
348#if PROTOCOL_VERSION > 765
351#if PROTOCOL_VERSION > 767
354 Options = std::make_shared<BlockParticleOptions>();
357 Options = std::make_shared<DustParticleOptions>();
360 Options = std::make_shared<ItemParticleOptions>();
362#if PROTOCOL_VERSION > 754
364 Options = std::make_shared<DustColorTransitionOptions>();
367 Options = std::make_shared<VibrationParticleOptions>();
370#if PROTOCOL_VERSION > 758
372 Options = std::make_shared<SculkChargeParticleOptions>();
375 Options = std::make_shared<ShriekParticleOptions>();
378#if PROTOCOL_VERSION > 765
380 Options = std::make_shared<ColorParticleOptions>();
383#if PROTOCOL_VERSION > 767
385 Options = std::make_shared<TrailParticleOptions>();
389 case ParticleType::Blockcrack:
390 case ParticleType::Blockdust:
392 Options = std::make_shared<BlockParticleOptions>();
394 case ParticleType::Iconcrack:
395 Options = std::make_shared<IconcrackParticleOptions>();
399 Options = std::make_shared<EmptyParticleOptions>();
405#if PROTOCOL_VERSION < 766
406 void Particle::ReadOptions(
ReadIterator& iter,
size_t& length)
408 if (Options !=
nullptr)
410 Options->Read(iter, length);
416 if (Options !=
nullptr)
418 Options->Write(container);
425 ParticleType = ReadData<ProtocolCraft::ParticleType, VarInt>(iter, length);
427 if (Options !=
nullptr)
429 Options->Read(iter, length);
435 WriteData<ProtocolCraft::ParticleType, VarInt>(
ParticleType, container);
436 if (Options !=
nullptr)
438 Options->Write(container);
446 output[std::string(field_name<ParticleType_index>)] =
GetName();
447 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