115#if PROTOCOL_VERSION < 766
122#if PROTOCOL_VERSION < 393
123 const std::string enchantment_key =
"ench";
125 const std::string enchantment_key =
"Enchantments";
127 if (!item_nbt.
contains(enchantment_key) ||
135 if (!enchantment_tag.contains(
"id") ||
136 !enchantment_tag.contains(
"lvl") ||
137#if PROTOCOL_VERSION < 393
140 !enchantment_tag[
"id"].is<NBT::TagString>() ||
142 (!enchantment_tag[
"lvl"].is<
NBT::TagShort>() && !enchantment_tag[
"lvl"].is<NBT::TagInt>()))
147#if PROTOCOL_VERSION < 393
148 if (enchantment_tag[
"id"].get<NBT::TagInt>() ==
static_cast<int>(enchantment))
153 if (enchantment_tag[
"lvl"].is<NBT::TagShort>())
157 else if (enchantment_tag[
"lvl"].is<NBT::TagInt>())
166 const auto& components = item.GetComponents().GetMap();
167 auto c = components.find(Components::DataComponentTypes::Enchantments);
168 if (c == components.end())
173 const std::map<int, int>& enchantments = std::static_pointer_cast<Components::DataComponentTypeItemEnchantments>(c->second)->GetEnchantments();
175 auto it = enchantments.find(
static_cast<int>(enchantment));
176 if (it == enchantments.end())