Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-113869

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

XMLWordPrintable

    • Confirmed

      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.

            Unassigned Unassigned
            knafrag Kna Frag
            Votes:
            17 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: