mojira.dev
MC-197473

Renamed block entities don't stack properly

When you rename a block entity (barrel, chest, enchantment table etc) on an anvil, it has its name like it's supposed to, even when placed. However, when you mine it to pick it up, it no longer stacks with the containers from the anvil, because it lost the "RepairCost:0" tag. So you end up with two different block entities with the same name, unable to stack them because of a tag that gets lost when it's placed.

1. Rename a stack of barrels/chest/etc on an anvil
2. Place a few of the containers
3. Mine containers in survival mode

Comments 3

well, the issue here could be fixed by saving the RepairCost, so no, don't think so
marking as related tho

Still an issue in 1.17 pre-1

A simple solution is to not add the RepairCost tag to blocks. This can easily be done like so:
Yarn Mappings - 1.16.5
net.minecraft.item.ItemStack

public void setRepairCost(int repairCost) {
    if (!isSectionHidden(this.getHideFlags(),ItemStack.TooltipSection.CAN_PLACE)) {
        this.getOrCreateTag().putInt("RepairCost", repairCost);
    }
}

Micah

gnembon

Confirmed

Gameplay

Normal

Crafting

RepairCost, block-entity, chest, command, inventory

1.16.1, 1.16.2 Release Candidate 1, 1.16.2, 1.16.5, 1.17 Pre-release 1

23w33a

Retrieved