mojira.dev
MC-273234

Enchanting a Mace in an Enchanting Table can sometimes show unavailable enchants

The Bug

Introduced in 24w18a.

Enchanting a Mace in an Enchanting Table may sometimes show enchantments that cannot be clicked. This usually happens with lower-level enchantments. Hovering over these unavailable enchantments does not display the hover text as it would normally. Clicking on these also does nothing.

[media]

This issue can rarely happen when having the full 15 bookshelves around the Enchanting Table, however, only the first option is usually bugged.

Cause

What seems to cause the issue is that all of the enchantments obtainable from an Enchanting Table have at least a minimum cost of 5. The game automatically assigns an enchanting level to all three slots using a different formula* based on the number of bookshelves around it. The results of these formulas may not meet the minimum requirements of the enchantment, especially if there are little to no bookshelves around the table.

According to the vanilla datapack**, the minimum cost required for each enchantment when enchanting the Mace in an Enchanting Table is:

Enchantment Name

Minimum Cost

Unbreaking

5

Density

5

Breach

15

Note that other enchantments compatible with Maces (e.g. Mending, Wind Burst, Smite, etc.) cannot be obtained from the Enchanting Table.

Since this issue was introduced in 24w18a, this is likely due to the changes to enchantments introduced in the same snapshot.

Steps to Reproduce

It works in Survival mode, but you need experience levels and lapis lazuli.

  1. Place down an Enchanting Table, and get a bunch of Maces.

  2. Start enchanting each Mace in Creative mode until you see an option you cannot click on (it will usually be the first or second option).

Sometimes, it can be impossible to enchant a Mace without refreshing the enchantments by enchanting another item.

Additional Notes

Related to MC-36937 (similar issue but with Fishing Rods).


First Note *

The method EnchantmentHelper#calculateRequiredExperienceLevel most likely defines the formula used.

Second Note **

Found by reading the JSON files in the 1.21 Release Candidate 1 .jar file using 7-Zip (in the directory /data/minecraft/enchantment of the archived jar).

In the respective enchantment's JSON file, this is the part that most likely defines the minimum cost:

"min_cost": {
    "base": 5, // This defines the minimum cost
    "per_level_above_first": 8 
  },

The value varies between enchantments (for example, Aqua Affinity's minimum cost is 1).

Linked issues

Attachments

Comments 8

Jarl-Penguin

Attached another screenshot with the "unselectable" enchantment highlighted.

Viradex

@unknown Can you reproduce this in 1.20.6? I was unable to, but I just want to make sure that it isn't just me who can't reproduce it.

Jarl-Penguin

No, I was not able to reproduce this in 1.20.6 after enchanting about 30 maces.

Viradex

Thanks! 🙂

I'll try and find the snapshot where this bug was introduced.

Edit: After some testing, it seems to have been introduced in 24w18a.

SeaOfPixels

Can confirm. This may be WAI, fishing rods have had this issue forever and that was marked as WAI iirc.

Viradex

@unknown This is probably not WAI since Mojang has triaged it, and MC-36937 is still unresolved.

Minecraft386882

Can confirm for 1.21.3 

Viradex

It's already been added as an affected version.

Viradex

(Unassigned)

Confirmed

Platform

Normal

Enchantments

24w18a, 1.21, 1.21 Release Candidate 1, 1.21.1 Release Candidate 1, 1.21.1, ..., 25w03a, 25w04a, 25w05a, 25w06a, 1.21.5

Retrieved