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
77#if PROTOCOL_VERSION > 775
103#if PROTOCOL_VERSION < 766
104 output[
"metadata"][
"data_effect_color_id"] = GetDataEffectColorId();
110#if PROTOCOL_VERSION > 498
113#if PROTOCOL_VERSION > 404
124#if PROTOCOL_VERSION > 763
127#if PROTOCOL_VERSION > 765
135#if PROTOCOL_VERSION > 766
143#if PROTOCOL_VERSION > 770
147#if PROTOCOL_VERSION > 774
151#if PROTOCOL_VERSION > 775
186 return std::any_cast<float>(
metadata.at(
"data_health_id"));
189#if PROTOCOL_VERSION < 766
190 int LivingEntity::GetDataEffectColorId()
const
193 return std::any_cast<int>(
metadata.at(
"data_effect_color_id"));
199 return std::any_cast<std::vector<ProtocolCraft::Particle>>(
metadata.at(
"data_effect_particle"));
206 return std::any_cast<bool>(
metadata.at(
"data_effect_ambience_id"));
212 return std::any_cast<int>(
metadata.at(
"data_arrow_count_id"));
215#if PROTOCOL_VERSION > 498
219 return std::any_cast<int>(
metadata.at(
"data_stinger_count_id"));
223#if PROTOCOL_VERSION > 404
235 metadata[
"data_living_entity_flags"] = data_living_entity_flags;
241 metadata[
"data_health_id"] = data_health_id;
244#if PROTOCOL_VERSION < 766
245 void LivingEntity::SetDataEffectColorId(
const int data_effect_color_id)
248 metadata[
"data_effect_color_id"] = data_effect_color_id;
254 metadata[
"data_effect_particles"] = data_effect_particles;
261 metadata[
"data_effect_ambience_id"] = data_effect_ambience_id;
267 metadata[
"data_arrow_count_id"] = data_arrow_count_id;
270#if PROTOCOL_VERSION > 498
274 metadata[
"data_stinger_count_id"] = data_stinger_count_id;
278#if PROTOCOL_VERSION > 404
282 metadata[
"sleeping_pos_id"] = sleeping_pos_id;
293 return std::optional<EntityAttribute>();
305 LOG_WARNING(
"Trying to set attribute base value for " << type <<
" for a " <<
GetName() <<
" but it doesn't have this attribute");
308 it->second.SetBaseValue(value);
332 it->second.ClearModifiers();
381#if PROTOCOL_VERSION > 763
394#if PROTOCOL_VERSION > 765
432#if PROTOCOL_VERSION > 766
470#if PROTOCOL_VERSION > 770
484#if PROTOCOL_VERSION > 774
492#if PROTOCOL_VERSION > 775
531 it->second.RemoveModifier(key);
539 LOG_WARNING(
"Trying to set attribute modifier for " << type <<
" for a " <<
GetName() <<
" but it doesn't have this attribute");
542 it->second.SetModifier(key, modifier);
547 return std::any_cast<char>(
metadata.at(
"data_living_entity_flags"));
550#if PROTOCOL_VERSION > 404
553 return std::any_cast<std::optional<Position>>(
metadata.at(
"sleeping_pos_id"));
557#if PROTOCOL_VERSION > 765
574#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
double GetAttributeFrictionModifierValue() const
char GetDataLivingEntityFlags() const
double GetAttributeStepHeightValueImpl() const
double GetAttributeExplosionKnockbackResistanceValue() const
double GetAttributeNameTagDistanceValue() 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 GetAttributeAirDragModifierValue() const
double GetAttributeStepHeightValue() const
double GetAttributeWaypointTransmitRangeValue() const
double GetAttributeBouncinessValue() 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
double GetAttributeBelowNameDistanceValue() 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...