mojira.dev
MC-275486

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

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 (

[media]
  1. ) 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."

Linked issues

Attachments

Comments 4

I don't know why, but the correct command won't save in the report. it keeps forcing a \ after the = sign

Can confirm:
Elytra:

[media]

Wolf armor:

[media]

Correct commands:

/give @p minecraft:elytra[enchantable={value:1}]
/give @p minecraft:wolf_armor[enchantable={value:1}]

Adding a space after the { fixed the \ in your description.

Can reproduce, and pack looks like it should work, I cannot think of anything that's missing. Elytra is configured the same by the, and works, even if you remove the additional air breaking enchantment.

The reason I added the wolf armor to several enchantable tags was to try and give it more "available" enchantments using the base enchantments, but that didn't work.

I included the elytra enchantment to show that custom enchantments do make it into the enchanting table once the UI shows up, but that the UI doesn't show up unless the item can be enchanted (in an anvil) in the vanilla game.

If I had to guess, the check for wether "applicable enchantments are available" somehow only checks vanilla information. I wanted to change the files for the versions .jar file, and see if adding wolf_armor to enchantable/armor.json would work, but as expected, I can't open the game if I mess with the game files like that.

cakeyeater99

etanaratsastaja

Confirmed

Platform

Normal

Data Packs, Enchantments

24w33a

24w34a

Retrieved