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
89#if PROTOCOL_VERSION < 766
90 output[
"metadata"][
"data_effect_color_id"] = GetDataEffectColorId();
96#if PROTOCOL_VERSION > 498
99#if PROTOCOL_VERSION > 404
110#if PROTOCOL_VERSION > 763
113#if PROTOCOL_VERSION > 765
121#if PROTOCOL_VERSION > 766
156 return std::any_cast<float>(
metadata.at(
"data_health_id"));
159#if PROTOCOL_VERSION < 766
160 int LivingEntity::GetDataEffectColorId()
const
163 return std::any_cast<int>(
metadata.at(
"data_effect_color_id"));
169 return std::any_cast<std::vector<ProtocolCraft::Particle>>(
metadata.at(
"data_effect_particle"));
176 return std::any_cast<bool>(
metadata.at(
"data_effect_ambience_id"));
182 return std::any_cast<int>(
metadata.at(
"data_arrow_count_id"));
185#if PROTOCOL_VERSION > 498
189 return std::any_cast<int>(
metadata.at(
"data_stinger_count_id"));
193#if PROTOCOL_VERSION > 404
205 metadata[
"data_living_entity_flags"] = data_living_entity_flags;
211 metadata[
"data_health_id"] = data_health_id;
214#if PROTOCOL_VERSION < 766
215 void LivingEntity::SetDataEffectColorId(
const int data_effect_color_id)
218 metadata[
"data_effect_color_id"] = data_effect_color_id;
224 metadata[
"data_effect_particles"] = data_effect_particles;
231 metadata[
"data_effect_ambience_id"] = data_effect_ambience_id;
237 metadata[
"data_arrow_count_id"] = data_arrow_count_id;
240#if PROTOCOL_VERSION > 498
244 metadata[
"data_stinger_count_id"] = data_stinger_count_id;
248#if PROTOCOL_VERSION > 404
252 metadata[
"sleeping_pos_id"] = sleeping_pos_id;
263 return std::optional<EntityAttribute>();
275 LOG_WARNING(
"Trying to set attribute base value for " << type <<
" for a " <<
GetName() <<
" but it doesn't have this attribute");
278 it->second.SetBaseValue(value);
302 it->second.ClearModifiers();
351#if PROTOCOL_VERSION > 763
364#if PROTOCOL_VERSION > 765
402#if PROTOCOL_VERSION > 766
447 it->second.RemoveModifier(key);
455 LOG_WARNING(
"Trying to set attribute modifier for " << type <<
" for a " <<
GetName() <<
" but it doesn't have this attribute");
458 it->second.SetModifier(key, modifier);
463 return std::any_cast<char>(
metadata.at(
"data_living_entity_flags"));
466#if PROTOCOL_VERSION > 404
469 return std::any_cast<std::optional<Position>>(
metadata.at(
"sleeping_pos_id"));
473#if PROTOCOL_VERSION > 765
490#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 GetAttributeArmorValue() const
double GetAttributeStepHeightValue() 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...