The bug
After renaming any item in an anvil the RepairCost
tag appears in its tag tag. No matter if the item is a tool or an item with no Damage tag.
This is for example problematic when removing the custom name of an item by using only spaces as name. Afterwards the item has no custom name anymore but does not stack with other items of the same kind due to the RepairCost
tag.
How to reproduce
Rename an item in an anvil
Drop it and check its NBT data using {{/entitydata @e[type=item,c=1] {}}} or
/data get entity @e[type=item,limit=1,sort=nearest] Item.tag
and look at the tag:{}. Now it containsRepairCost:0
, which doesn't change after renaming the item any amount of times.
Linked issues
is duplicated by
relates to
testing discovered
Comments


Can confirm in 1.17.1.

Can confirm in 1.18 Pre-release 1.

Can confirm in 1.18 Pre-release 4.

Can confirm in 22w06a.
Can confirm in 1.19.2.

Can confirm in 1.19.4 and 23w18a
You can remove the NBT tag that yields the custom name by putting the item in the anvil a second time and attempting to rename the item to a single space. (This will instead revert the custom name back to the default item name.) However, the RepairCost NBT tag still remains. The RepairCost tag causes the item not to stack will other items of the same type (even though the custom name was removed) and also causes the recipe book in the crafting table to not automatically move the item; see MC-129057. Additionally, there exists a similar issue about grindstones leaving the RepairCost tag; see MC-181109.