mojira.dev
MC-113869

Shulker boxes restore custom name after deleting it and placing them down

The bug

Custom names from items can be removed by putting them in an anvil and emptying the name field.

For custom named shulker boxes that were placed down and picked up before that doesn't remove the custom name from the NBT data. This results in them taking their old name again after placing them down.

Steps to reproduce

  1. Rename a shulker box in an anvil, for example name it "test"

  2. Place it down and pick it up again

  3. Put the shulker box in an anvil and empty the name field to rename it to its standard name

  4. Place the shulker box down
    → It will now be named "test" again. After picking it up the item also has its old name "test"

Code analysis

Based on 1.11.2 decompiled using MCP 9.35 rc1

The problem seems to be that when the shulker box is broken the name is stored in the CustomName tag of the BlockEntityTag as well, but renaming an item only changes the value of the Name tag in the display tag.
The method net.minecraft.block.BlockShulkerBox.breakBlock(World, BlockPos, IBlockState) currently removes the custom name of the shulker box tile entity to prevent it from being dropped by the method net.minecraft.block.BlockContainer.harvestBlock(World, EntityPlayer, BlockPos, IBlockState, TileEntity, ItemStack) as well.
If the custom name was removed before the NBT data is copied into the BlockEntityTag this bug could be solved too.

Related issues

Comments

migrated

confirmed in 1.12

UsernameGeri

This bug is quite annoying.. The best thing you can do is rename your shulker boxes to their corresponding color and than shulker box, but it will say the color in the container gui which the un-named doesn't and also the font is tilted

bemoty

Can confirm for MC 1.12.1.

migrated

Confirmed in 1.12.2

migrated

Confirmed for 1.13.1.

migrated

Confirmed for 1.13.2

tryashtar

This was fixed in 18w43a

TheXDragon_LTU

Bug appears again in 1.15.2

migrated

(Unassigned)

Confirmed

CustomName, NBT, anvil, block-entity, item, shulker_box

Minecraft 1.11.2, Minecraft 17w06a, Minecraft 1.12, Minecraft 1.12.1, Minecraft 1.12.2, Minecraft 17w47b, Minecraft 1.13.1

Minecraft 19w03b

Retrieved