mojira.dev
MC-125046

"RepairCost" NBT tag is created on any renamed item using anvils which can cause items to not stack properly

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

  1. Rename an item in an anvil

  2. 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 contains RepairCost:0, which doesn't change after renaming the item any amount of times.

Linked issues

Comments

pine1needle

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.

ampolive

Can confirm in 1.17.1.

ampolive

Can confirm in 1.18 Pre-release 1.

ampolive

Can confirm in 1.18 Pre-release 4.

migrated

Can confirm in 22w06a.

Avoma

Can confirm in 1.19.2.

Brain81505

Can confirm in 1.19.4 and 23w18a

Maxaxik

gnembon

Confirmed

Gameplay

Normal

Items

RepairCost

Minecraft 1.12.2, Minecraft 18w06a, Minecraft 18w08a, Minecraft 18w11a, Minecraft 18w21b, ..., 23w03a, 1.19.4, 23w12a, 23w18a, 1.20 Pre-release 2

23w33a

Retrieved