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
93#if PROTOCOL_VERSION < 766
94 output[
"metadata"][
"data_effect_color_id"] = GetDataEffectColorId();
100#if PROTOCOL_VERSION > 498
103#if PROTOCOL_VERSION > 404
114#if PROTOCOL_VERSION > 763
117#if PROTOCOL_VERSION > 765
125#if PROTOCOL_VERSION > 766
133#if PROTOCOL_VERSION > 770
164 return std::any_cast<float>(
metadata.at(
"data_health_id"));
167#if PROTOCOL_VERSION < 766
168 int LivingEntity::GetDataEffectColorId()
const
171 return std::any_cast<int>(
metadata.at(
"data_effect_color_id"));
177 return std::any_cast<std::vector<ProtocolCraft::Particle>>(
metadata.at(
"data_effect_particle"));
184 return std::any_cast<bool>(
metadata.at(
"data_effect_ambience_id"));
190 return std::any_cast<int>(
metadata.at(
"data_arrow_count_id"));
193#if PROTOCOL_VERSION > 498
197 return std::any_cast<int>(
metadata.at(
"data_stinger_count_id"));
201#if PROTOCOL_VERSION > 404
213 metadata[
"data_living_entity_flags"] = data_living_entity_flags;
219 metadata[
"data_health_id"] = data_health_id;
222#if PROTOCOL_VERSION < 766
223 void LivingEntity::SetDataEffectColorId(
const int data_effect_color_id)
226 metadata[
"data_effect_color_id"] = data_effect_color_id;
232 metadata[
"data_effect_particles"] = data_effect_particles;
239 metadata[
"data_effect_ambience_id"] = data_effect_ambience_id;
245 metadata[
"data_arrow_count_id"] = data_arrow_count_id;
248#if PROTOCOL_VERSION > 498
252 metadata[
"data_stinger_count_id"] = data_stinger_count_id;
256#if PROTOCOL_VERSION > 404
260 metadata[
"sleeping_pos_id"] = sleeping_pos_id;
271 return std::optional<EntityAttribute>();
283 LOG_WARNING(
"Trying to set attribute base value for " << type <<
" for a " <<
GetName() <<
" but it doesn't have this attribute");
286 it->second.SetBaseValue(value);
310 it->second.ClearModifiers();
359#if PROTOCOL_VERSION > 763
372#if PROTOCOL_VERSION > 765
410#if PROTOCOL_VERSION > 766
448#if PROTOCOL_VERSION > 770
469 it->second.RemoveModifier(key);
477 LOG_WARNING(
"Trying to set attribute modifier for " << type <<
" for a " <<
GetName() <<
" but it doesn't have this attribute");
480 it->second.SetModifier(key, modifier);
485 return std::any_cast<char>(
metadata.at(
"data_living_entity_flags"));
488#if PROTOCOL_VERSION > 404
491 return std::any_cast<std::optional<Position>>(
metadata.at(
"sleeping_pos_id"));
495#if PROTOCOL_VERSION > 765
512#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 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...