Running 'enchant_with_levels' function multiple times on the same item can illegally stack exclusive enchantments
Steps to reproduce:
- Join a new Creative world.
- Get any sword from the menu and hold it.
- Run the following command multiple times:
/item modify entity @s weapon {"function":"minecraft:enchant_with_levels","levels":30,"options":"#minecraft:on_random_loot"}
In this example, a Sword enchanted with Sharpness, Smite and Bane of Arthropods was obtained, as shown on the image below. This is inconsistent with the 'enchant_randomly' function, which can be specified to only enchant the item with compatible enchantments.

2024-08-02, 11:56 PM
2025-01-24, 12:55 PM
16
1
-