mojira.dev
MC-248372

Anvil limits book enchantment level to survival values

The bug

When enchanting a tool/armor piece with an enchanted book that has an enchantment level higher than the survival maximum enchantment level (for example, Fortune V), which can be done through the use of commands or data packs, the anvil caps the enchanted item at said maximum level.

To reproduce

  1. Obtain a book with a high enchantment level value, such as Protection V or Fortune V. For example, drop an enchanted book item on the ground and run the following command:

    /data merge entity @e[type=item,limit=1,sort=nearest] {Item:{tag:{StoredEnchantments: [{lvl:5s, id:"minecraft:protection"}]}}}
  2. Give yourself a compatible tool/armor piece and place it in the first slot of the anvil.

  3. Place the enchanted book in the second slot of the anvil.

  4. The anvil caps the enchantment value at the maximum level.

Original description

Some datapacks such as Altar Enchanting allow for higher levels of enchantment than normal rules, such as Fortune V. However, combining items on an anvil has a glitch when two of the same enchantment are combined. If I combine a Fortune V pickaxe with a Efficiency V pickaxe, I get the expected result of a Fortune V+Efficiency V pickaxe. However, if I combine a Fortune V pickaxe with a Fortune III + Efficiency V pickaxe, I only get a Fortune III + Efficiency V pickaxe, no matter what slot is used. I'm not sure if this even a proper bug given it's beyond normal vanilla gameplay, but it certainly is important for datapacks and mods and datapack devs don't have the abilities to fix this. I'm guessing the game code currently caps the level to avoid combining two Fortune III picks into a Fortune IV pick, however I would expect intended Anvil behavior to preserve high-level enchants rather than downgrading them. 

Related issues

Attachments

Comments

migrated
[media][media]
DLSDUFER

You used a modpack for the ticket.

migrated

This can also be achieved with just give commands...

migrated

Probably a won't fix MC-10755

migrated

We'll see, this is an issue with the anvil, and not the actual enchantmnet though.

migrated

(Unassigned)

Confirmed

Gameplay

Normal

Enchantments, Items

1.18.1, 1.20.2, 1.20.6, 1.21 Pre-Release 3, 25w06a

Retrieved