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

Integer division of "enchantability" nullifies some of its intended advantages.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Works As Intended
    • None
    • 1.20.4
    • None
    • Plausible
    • Enchantments

      Enchantability is intended to describe an Item's propensity to receive rarer and higher level enchantments from the Enchanting Table. The greater the enchantability, the more likely the item will receive these enchantments.

      The enchantability of all enchantable items ranks as follows:

      Item Enchantability
      Golden Armor 25
      Golden Tools 22
      Netherite Armor and Tools
      Leather Armor
      Wooden Tools
      15
      Iron Tools 14
      Chainmail Armor 12
      Diamond Armor and Tools 10
      Iron and Turtle Armor 9
      Stone Tools 5
      Other (e.g. Books) 1

      In code, enchantability's intended function is achieved by modifying the enchantment level. However-before this is done-it is first integer divided by 4, then added to 1. This integer division truncates the differences between any two enchantabilities within the same modulus of 4, creating the following effective ranking:

      Item Effective Enchantability
      Golden Armor 7
      Golden Tools 6
      Netherite Armor and Tools
      Leather Armor
      Wooden Tools
      Iron Tools
      Chainmail Armor
      4
      Diamond Armor and Tools
      Iron and Turtle Armor
      3
      Stone Tools 2
      Other (e.g. Books) 1

      As an example of the faulty results this causes, Netherite is intended to modify the enchantment level up to 25% greater than Chainmail (15 versus 12), yet their enchantabilities modify the enchantment level equally. At worst, this behavior nullifies the intended benefit of enchanting Netherite over Chainmail entirely. At best, it creates unnecessary computation. 

      A graphical demonstration can be found here:
      https://www.desmos.com/calculator/pvu7whrb0g
      where:

      • L = the enchantment level
      • E = (int) enchantability / 4
      • f( x ) = the probability distribution function of the modified enchantment level
      • xi = a modified enchantment level, which is followed by the equation for the unweighted probability of achieving xi

       

            Unassigned Unassigned
            PsFunny Eben Gino Lester
            Votes:
            4 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: