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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 24w18a, 1.21 Release Candidate 1, 1.21
    • Confirmed
    • Enchantments
    • Normal
    • Platform

      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.

      Reverting to 1.20.6 behavior would be best, however, an alternate solution would be to grey out the unavailable enchants, like is already done to the bottom two enchantments in the image below.

      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.

      How 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). That is the bug.

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

      Additional Notes

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


      First Note *

      The function calculateRequiredExperienceLevel in EnchantmentHelper.class located in /net/minecraft/enchantment 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).

            Unassigned Unassigned
            Arnav78 Viradex
            Votes:
            9 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              CHK: