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

Duplicate entries in a tag does not impact the weight

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • None
    • 1.21.1, 24w37a
    • None
    • Confirmed
    • Data Packs

      Having duplicate entries in a tag does not impact the chance of that entry getting randomly picked.

      In the attached datapack. There is an enchantment tag with 4 entries for protection and 1 for mending. Using this tag with the enchant_randomly modifier. The chance of getting mending is expected to be lower than 50%. This is not the case.

      {
        "function": "minecraft:enchant_randomly",
        "options": "#weighted_enchantments:weighted_list"
      }
      

       
      When using the same modifier but using multiple options, the chance of getting mending is much lower.

      {
        "function": "minecraft:enchant_randomly",
        "options": [
          "minecraft:protection",
          "minecraft:protection",
          "minecraft:protection",
          "minecraft:protection",
          "minecraft:mending"
        ]
      }
      

       

      How to recreate

      1. Install the datapack
      2. Run /loot give @s loot weighted_enchantments:using_options
        → Observe the rarity of getting mending
      3. Run /loot give @s loot weighted_enchantments:using_tag
        → Observe that the chance of getting mending is much higher

       

            Unassigned Unassigned
            tholleman tholleman
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: