mojira.dev
MC-276782

Duplicate entries in a tag does not impact the weight

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

 

Attachments

Comments 2

Thank you for your report!
After consideration, the issue is being closed as Invalid.

You have posted a feature request or a suggestion. This site is for bug reports only.
For suggestions, please visit The official Minecraft feedback site or visit the Minecraft Feedback Discord server.

Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki

Was this supposed to be marked as invalid? "Working as intended" or "Won't fix" would make more sense.

tholleman

(Unassigned)

Confirmed

Data Packs

1.21.1, 24w37a

Retrieved