mojira.dev
MC-40380

Replacing heads still drop as an item

The bug

Replacing heads using the /setblock or /fill command (or /clone move) drops them as items.

Note: For versions >= 17w47 flower pots are no longer affected because they are not using a block entity anymore.

How to reproduce

  1. Place one of the affected blocks

  2. Use the following command while standing on them

    /setblock ~ ~ ~ air replace

    → The head will still drop as an item, even though the command is set to replace and not destroy

Code analysis

The following is based on a decompiled version of Minecraft 1.9 using MCP 9.24 beta.

For flower pots the reason for this is that they do not implement the interface net.minecraft.inventory.IInventory and therefor the method net.minecraft.inventory.IInventory.clear() does not exist and is not called to clear the contained items.

For skulls the problem is that currently the method net.minecraft.block.BlockSkull.breakBlock(World, BlockPos, IBlockState) drops the skull (should be rather called "onBlockRemoved"). Instead the method net.minecraft.block.BlockSkull.dropBlockAsItemWithChance(World, BlockPos, IBlockState, float, int) should do this. The problem with this is that the former method removes the tile entity first. The order of this should be probably changed.

Related issues

Comments

CubeTheThird

Can confirm.

migrated

Can confirm for Redstone block too.

EDIT:
Acting like a player. If it breaks stone, you get cobblestone etc.
Tested for multiple other blocks.

marcono1234

Confirmed for:

  • 1.8 Also you get the error message (with block=air): "The block couldn't be placed" (that's MC-50166)

  • 1.8.4 Could relate to the fact that Minecraft displays *nodrop:false* in F3 screen

migrated

Still an issue in 15w35b snapshot even if replace or keep arguments are used to fill skull block with the same skull.

migrated

Confirmed for 15w51b.

marcono1234

Please link to this comment in the description

The following is based on a decompiled version of Minecraft 1.9 using MCP 9.24 beta.

For flower pots the reason for this is that they do not implement the interface net.minecraft.inventory.IInventory and therefor the method net.minecraft.inventory.IInventory.clear() does not exist and is not called to clear the contained items.

For skulls the problem is that currently the method net.minecraft.block.BlockSkull.breakBlock(World, BlockPos, IBlockState) drops the skull (should be rather called "onBlockRemoved"). Instead the method net.minecraft.block.BlockSkull.dropBlockAsItemWithChance(World, BlockPos, IBlockState, float, int) should do this. The problem with this is that the former method removes the tile entity first. The order of this should be probably changed.

wobst.michael

Is this still an issue in the most recent versions (currently that is 1.10.2, or 16w43a) of Minecraft? If so, please update the affected versions and help us keeping this ticket updated from time to time. If you are the owner/reporter of this ticket, you can modify the affected version(s) yourself.

migrated

Yes, it is. 🙂

migrated

Skull still drop when using /fill and /setblock
Confirmed for 1.12-pre5

marcono1234

Flower pots are no longer affected in the latest snapshots because they are not using a block entity anymore.

Leaving it in because the latest release (1.12.2) is still affected.

tryashtar

Also appears to affect jukeboxes now (the record is dropped).

migrated

All Heads (except for the player head) are no longer affected in the latest snapshots because they are not using a block entity anymore.
Leaving it in because the latest release (1.12.2) is still affected.

migrated

or maybie not

marcono1234

This appears to be fixed for skulls / player heads in the latest version. The report MC-138067 tracks this for jukeboxes so we don't have to remove the skull information from this report.

migrated

(Unassigned)

Confirmed

/fill, /setblock, drop, replace, skull

Minecraft 1.7.2, Minecraft 14w33a, Minecraft 1.8, Minecraft 1.8.1, Minecraft 1.8.2-pre6, ..., Minecraft 17w50a, Minecraft 18w01a, Minecraft 18w06a, Minecraft 18w11a, Minecraft 1.13.1

Minecraft 18w43c

Retrieved