1#if PROTOCOL_VERSION < 770
4#if PROTOCOL_VERSION > 765
8#if PROTOCOL_VERSION < 579
14#if PROTOCOL_VERSION < 579
15 const std::array<std::string, ThrownPotionEntity::metadata_count> ThrownPotionEntity::metadata_names{ {
20 ThrownPotionEntity::ThrownPotionEntity()
23#if PROTOCOL_VERSION < 579
26#if PROTOCOL_VERSION > 765
29 default_slot.SetItemId(item_id);
30 default_slot.SetItemCount(1);
31 SetDataItemStack(default_slot);
35 ThrownPotionEntity::~ThrownPotionEntity()
41 std::string ThrownPotionEntity::GetName()
const
48 return EntityType::ThrownPotion;
52 std::string ThrownPotionEntity::GetClassName()
59 return EntityType::ThrownPotion;
63#if PROTOCOL_VERSION < 579
68 output[
"metadata"][
"data_item_stack"] = GetDataItemStack().Serialize();
74 void ThrownPotionEntity::SetMetadataValue(
const int index,
const std::any& value)
76 if (index < hierarchy_metadata_count)
80 else if (index - hierarchy_metadata_count < metadata_count)
82 std::scoped_lock<std::shared_mutex> lock(entity_mutex);
83 metadata[metadata_names[index - hierarchy_metadata_count]] = value;
89 std::shared_lock<std::shared_mutex> lock(entity_mutex);
90 return std::any_cast<ProtocolCraft::Slot>(metadata.at(
"data_item_stack"));
96 std::scoped_lock<std::shared_mutex> lock(entity_mutex);
97 metadata[
"data_item_stack"] = data_item_stack;
102 double ThrownPotionEntity::GetWidthImpl()
const
107 double ThrownPotionEntity::GetHeightImpl()
const
static AssetsManager & getInstance()
ItemId GetItemID(const std::string &item_name) const
virtual ProtocolCraft::Json::Value Serialize() const
virtual void SetMetadataValue(const int index, const std::any &value)
Main class, basically a JsonVariant with extra utility functions it doesn't inherit JsonVariant direc...