Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-275486

Enchantable data component doesn't work with items that only have enchantments through a data pack

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 24w34a
    • 24w33a
    • None
    • Confirmed
    • Data Packs, Enchantments
    • Normal
    • Platform

      I'm not sure if this is a bug, or just an incomplete feature, but I feel it is important to make the team aware of this, just in case.
      The backstory: I wanted to make custom enchantments for wolf armor show up in the enchanting table, but when giving myself enchantable wolf armor, nothing shows up. The data component works for all non-enchantable items in vanilla that can be enchanted with books in survival.

      Steps to recreate:

      1. Add the attached datapack (Enchantable test 24w33a.zip) to your world to add the archive:wolf_armor and archive:air_brake enchantments to wolf armor and elytra, respectively. They are defined by wolf_armor.json and air_brake.json
      2. run command
        /give @p minecraft:elytra[enchantable={value:1}]
      3. run command
        /give @p minecraft:wolf_armor[enchantable={value:1}]
      4. attempt to enchant both items in an enchanting table

      Observed result:

      Elytra can be enchanted with both vanilla and custom enchantments. No enchantments show up for the wolf armor, despite it being added to several enchantable item tags and having a functional custom enchant.

      Expected result:

      The expected outcome is that enchantments show up for both items, since the changelog states: "If present, and applicable enchantments are available, items with the component can be enchanted in an enchanting table."

        1. 2024-08-16_23.05.15.png
          2024-08-16_23.05.15.png
          207 kB
        2. 2024-08-16_23.05.37.png
          2024-08-16_23.05.37.png
          192 kB
        3. 2024-08-16_23.05.44.png
          2024-08-16_23.05.44.png
          98 kB
        4. 2024-08-16_23.05.49.png
          2024-08-16_23.05.49.png
          93 kB
        5. 2024-08-16_23.18.12.png
          2024-08-16_23.18.12.png
          63 kB
        6. 2024-08-17_07.39.27.png
          2024-08-17_07.39.27.png
          252 kB
        7. 2024-08-17_07.39.31.png
          2024-08-17_07.39.31.png
          250 kB
        8. Enchantable test 24w33a.zip
          40 kB
        9. Items compatible with enchantable.png
          Items compatible with enchantable.png
          293 kB

            Dat12 [Mojang] etanaratsastaja
            cakeyeater99 cakeyeater99
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: