whizvox / Precision-Enchanter

A Minecraft mod that gives greater control over how you enchant.
MIT License
1 stars 2 forks source link

Items with NBT do not work as enchantment crafting ingredients #26

Open whizvox opened 1 month ago

whizvox commented 1 month ago

This was brought up to me by someone trying to make a custom datapack. Apparently, items with NBT (using the forge:partial_nbt ingredient type) do not match at all, resulting in a recipe that is impossible to craft.

Example file:

{
  "conditions": [
    {
      "condition": "mod_loaded",
      "mod_id": "tombstone"
    }
  ],
  "ingredients": [
    {
      "count": 1,
      "ingredient": {
        "type": "forge:partial_nbt",
        "item": "minecraft:enchanted_book",
        "nbt": "{StoredEnchantments:[{id:"tombstone:soulbound",lvl:1}]}"
      }
    },
    {
      "count": 32,
      "ingredient": {
        "item": "minecraft:diamond"
      }
    },
    {
      "count": 1,
      "ingredient": {
        "item": "minecraft:heart_of_the_sea"
      }
    }
  ],
  "result": {
    "enchantment": "tombstone:soulbound",
    "level": 1
  },
  "cost": 10
}
whizvox commented 1 month ago

False alarm. Ingredients with NBT works just fine. The line specifying the NBT needs to read the following for enchantments:

"nbt": "{StoredEnchantments:[{id:\"tombstone:soulbound\",lvl:1s}]}"

Notice the s after the 1. That actually matters.