1.16.1, 1.16.2 Pre-release 3, 1.16.2, 1.16.3, 1.16.4 Pre-release 1, 1.16.4 Pre-release 2, 1.16.4 Release Candidate 1, 1.16.4, 20w45a, 20w46a, 20w48a, 20w49a, 20w51a, 21w03a, 1.16.5, 21w05a, 21w05b, 21w06a, 21w07a, 21w08b, 21w10a, 21w11a, 21w13a, 21w14a, 21w15a, 21w16a, 21w17a, 21w18a, 21w19a, 21w20a, 1.17 Release Candidate 2, 1.17, 1.17.1, 1.18.1, 1.19.2, 1.19.3, 1.19.4
The level cost in an anvil is affected by what order you put the items in. The sacrificed item's repair cost is basically ignored if the primary item has a repair cost, rather than added up to the total level cost. Everything (durability, enchantments, etc.) is merged into the main item, including the RepairCost (it'll be the sum+penalty); it's just not initially included in the level cost. There's literally no logic behind why one way is more expensive than the other, while the resulting item is the same.
MC-3880, but that was resolved as intended without Mojang source, this definitely seems like an oversight to me. I would request a reopen if the ticket wasn't ancient, so made this cloned report instead.
The only "source" provided by the resolving mod was a wiki page, which is stated time and time again, the wiki is not a source for intended or unintended behavior.
Easy steps to reproduce:
- Give yourself 2 diamond swords and an enchanted book with sharpness 5, one with fire aspect 2, and one with knockback 2
- Put 1 enchantment on 1 diamond sword, and the other 2 on the other sword.
- Put the swords in an avil, and look at the cost
- Switch around the swords, and notice a different cost, while the resulting item is the exact same.
Additional, see that both combinations have the same RepairCost value:
- Duplicate the swords using the pick block key in creative, and make both combinations.
- Use the following command while holding the created sword
/data get entity @s SelectedItem.tag.RepairCost
- Notice both swords have the same repair cost, despite the cost being different to create both swords.
MC-3880 Level costs depend on where you put items in an Anvil
- relates to
MCPE-123665 Enchantment Cost Fluctuate for same tools combining