9 "data_living_entity_flags",
11#if PROTOCOL_VERSION < 766
12 "data_effect_color_id",
14 "data_effect_particles",
16 "data_effect_ambience_id",
17 "data_arrow_count_id",
18#if PROTOCOL_VERSION > 498
19 "data_stinger_count_id",
21#if PROTOCOL_VERSION > 404
31#if PROTOCOL_VERSION < 766
32 SetDataEffectColorId(0);
38#if PROTOCOL_VERSION > 498
41#if PROTOCOL_VERSION > 404
51#if PROTOCOL_VERSION > 763
54#if PROTOCOL_VERSION > 765
62#if PROTOCOL_VERSION > 766
70#if PROTOCOL_VERSION > 770
74#if PROTOCOL_VERSION > 774
96#if PROTOCOL_VERSION < 766
97 output[
"metadata"][
"data_effect_color_id"] = GetDataEffectColorId();
103#if PROTOCOL_VERSION > 498
106#if PROTOCOL_VERSION > 404
117#if PROTOCOL_VERSION > 763
120#if PROTOCOL_VERSION > 765
128#if PROTOCOL_VERSION > 766
136#if PROTOCOL_VERSION > 770
140#if PROTOCOL_VERSION > 774
170 return std::any_cast<float>(
metadata.at(
"data_health_id"));
173#if PROTOCOL_VERSION < 766
174 int LivingEntity::GetDataEffectColorId()
const
177 return std::any_cast<int>(
metadata.at(
"data_effect_color_id"));
183 return std::any_cast<std::vector<ProtocolCraft::Particle>>(
metadata.at(
"data_effect_particle"));
190 return std::any_cast<bool>(
metadata.at(
"data_effect_ambience_id"));
196 return std::any_cast<int>(
metadata.at(
"data_arrow_count_id"));
199#if PROTOCOL_VERSION > 498
203 return std::any_cast<int>(
metadata.at(
"data_stinger_count_id"));
207#if PROTOCOL_VERSION > 404
219 metadata[
"data_living_entity_flags"] = data_living_entity_flags;
225 metadata[
"data_health_id"] = data_health_id;
228#if PROTOCOL_VERSION < 766
229 void LivingEntity::SetDataEffectColorId(
const int data_effect_color_id)
232 metadata[
"data_effect_color_id"] = data_effect_color_id;
238 metadata[
"data_effect_particles"] = data_effect_particles;
245 metadata[
"data_effect_ambience_id"] = data_effect_ambience_id;
251 metadata[
"data_arrow_count_id"] = data_arrow_count_id;
254#if PROTOCOL_VERSION > 498
258 metadata[
"data_stinger_count_id"] = data_stinger_count_id;
262#if PROTOCOL_VERSION > 404
266 metadata[
"sleeping_pos_id"] = sleeping_pos_id;
277 return std::optional<EntityAttribute>();
289 LOG_WARNING(
"Trying to set attribute base value for " << type <<
" for a " <<
GetName() <<
" but it doesn't have this attribute");
292 it->second.SetBaseValue(value);
316 it->second.ClearModifiers();
365#if PROTOCOL_VERSION > 763
378#if PROTOCOL_VERSION > 765
416#if PROTOCOL_VERSION > 766
454#if PROTOCOL_VERSION > 770
468#if PROTOCOL_VERSION > 774
483 it->second.RemoveModifier(key);
491 LOG_WARNING(
"Trying to set attribute modifier for " << type <<
" for a " <<
GetName() <<
" but it doesn't have this attribute");
494 it->second.SetModifier(key, modifier);
499 return std::any_cast<char>(
metadata.at(
"data_living_entity_flags"));
502#if PROTOCOL_VERSION > 404
505 return std::any_cast<std::optional<Position>>(
metadata.at(
"sleeping_pos_id"));
509#if PROTOCOL_VERSION > 765
526#if PROTOCOL_VERSION > 766
#define LOG_WARNING(osstream)
@ ExplosionKnockbackResistance
@ WaterMovementEfficiency
virtual ProtocolCraft::Json::Value Serialize() const
virtual void SetMetadataValue(const int index, const std::any &value)
std::shared_mutex entity_mutex
virtual std::string GetName() const =0
std::map< std::string, std::any > metadata
double GetAttributeGravityValueImpl() const
double GetAttributeMovementEfficiencyValueImpl() const
char GetDataLivingEntityFlags() const
double GetAttributeStepHeightValueImpl() const
double GetAttributeExplosionKnockbackResistanceValue() const
double GetAttributeScaleValue() const
bool GetDataEffectAmbienceId() const
void RemoveAttributeModifier(const EntityAttribute::Type type, const EntityAttribute::ModifierKey &key)
double GetAttributeJumpStrengthValueImpl() const
void SetDataStingerCountId(const int data_stinger_count_id)
double GetAttributeMaxHealthValue() const
std::optional< Position > GetSleepingPosId() const
void SetAttributeModifierImpl(const EntityAttribute::Type type, const EntityAttribute::ModifierKey &key, const EntityAttribute::Modifier &modifier)
virtual bool IsLivingEntity() const override
double GetAttributeSafeFallDistanceValue() const
double GetAttributeOxygenBonusValue() const
void SetDataArrowCountId(const int data_arrow_count_id)
void ClearModifiers(const EntityAttribute::Type type)
static const std::array< std::string, metadata_count > metadata_names
double GetAttributeMaxAbsorptionValue() const
std::optional< Position > GetSleepingPosIdImpl() const
static constexpr int hierarchy_metadata_count
void SetAttributeModifier(const EntityAttribute::Type type, const EntityAttribute::ModifierKey &key, const EntityAttribute::Modifier &modifier)
void SetDataEffectAmbienceId(const bool data_effect_ambience_id)
int GetDataStingerCountId() const
std::map< EntityAttribute::Type, EntityAttribute > attributes
void SetDataLivingEntityFlags(const char data_living_entity_flags)
void RemoveAttributeModifierImpl(const EntityAttribute::Type type, const EntityAttribute::ModifierKey &key)
double GetAttributeJumpStrengthValue() const
void SetDataEffectParticles(const std::vector< ProtocolCraft::Particle > &data_effect_particles)
double GetAttributeMovementSpeedValueImpl() const
double GetAttributeMovementSpeedValue() const
void SetDataHealthId(const float data_health_id)
double GetAttributeWaterMovementEfficiencyValueImpl() const
double GetAttributeArmorToughnessValue() const
virtual ProtocolCraft::Json::Value Serialize() const override
static constexpr int metadata_count
double GetAttributeBurningTimeValue() const
char GetDataLivingEntityFlagsImpl() const
double GetAttributeGravityValue() const
int GetDataArrowCountId() const
double GetAttributeEntityInteractionRangeValue() const
double GetAttributeCameraDistanceValue() const
double GetAttributeArmorValue() const
double GetAttributeStepHeightValue() const
double GetAttributeWaypointTransmitRangeValue() const
void SetSleepingPosId(const std::optional< Position > &sleeping_pos_id)
double GetAttributeAttackKnockbackValue() const
double GetAttributeFallDamageMultiplierValue() const
double GetAttributeKnockbackResistanceValue() const
virtual void SetMetadataValue(const int index, const std::any &value) override
void AddAttribute(const EntityAttribute &attribute)
double GetAttributeMovementEfficiencyValue() const
float GetDataHealthId() const
void SetAttributeBaseValue(const EntityAttribute::Type type, const double value)
std::vector< ProtocolCraft::Particle > GetDataEffectParticles() const
double GetAttributeWaterMovementEfficiencyValue() const
std::optional< EntityAttribute > GetAttribute(const EntityAttribute::Type type) const
Main class, basically a JsonVariant with extra utility functions it doesn't inherit JsonVariant direc...