127#if PROTOCOL_VERSION < 766
134#if PROTOCOL_VERSION < 393
135 const std::string enchantment_key =
"ench";
137 const std::string enchantment_key =
"Enchantments";
139 if (!item_nbt.
contains(enchantment_key) ||
147 if (!enchantment_tag.contains(
"id") ||
148 !enchantment_tag.contains(
"lvl") ||
149#if PROTOCOL_VERSION < 393
152 !enchantment_tag[
"id"].is<NBT::TagString>() ||
154 (!enchantment_tag[
"lvl"].is<
NBT::TagShort>() && !enchantment_tag[
"lvl"].is<NBT::TagInt>()))
159#if PROTOCOL_VERSION < 393
160 if (enchantment_tag[
"id"].get<NBT::TagInt>() ==
static_cast<int>(enchantment))
165 if (enchantment_tag[
"lvl"].is<NBT::TagShort>())
169 else if (enchantment_tag[
"lvl"].is<NBT::TagInt>())
178 const auto& components = item.GetComponents().GetMap();
179 auto c = components.find(Components::DataComponentTypes::Enchantments);
180 if (c == components.end())
185 const std::map<int, int>& enchantments = std::static_pointer_cast<Components::DataComponentTypeItemEnchantments>(c->second)->GetEnchantments();
187 auto it = enchantments.find(
static_cast<int>(enchantment));
188 if (it == enchantments.end())