The bug
Carpets can use the lower half of tall grass and large fern as support blocks, which can't exist on their own without the upper half. When placing a carpet to replace the upper half the lower half is a support block before the game detects that the lower half should break, immediately breaking the carpet as well.
Carpets can also be placed at a vine block that doesn't have a support block itself, which produces the same result as above.
In 17w48a it's no longer possible for banners and signs to do the same. (Possibly fixed with MC-86980)
Code analysis
Based on 1.11.2 decompiled using MCP 9.35 rc1
Signs and banners are not properly overriding the method net.minecraft.block.Block.canPlaceBlockAt(World, BlockPos)
, instead they test if they can be placed in the method net.minecraft.item.Item.onItemUse(EntityPlayer, World, BlockPos, EnumHand, EnumFacing, float, float, float)
. This method allows the item to be placed facing up (= on the ground) without checking if the block below is solid if the block it is placed on is replaceable, which causes problems with double plants.
Carpets appear to override the method canPlaceBlockAt
"correctly" by testing if the block below is not air. The problem is that once the upper part of the double plant was replaced the lower part is air and therefor the carpet drops.
Bug discovered when testing
Off topic, but when banners were affected (before 17w48a), another bug was discovered by reproducing this bug. When a non-black banner replaced a top block of tall grass or a large fern, a black banner drops, not the color of the banner placed. A bug report containing this seems to not be created yet.
Linked issues
relates to 2
Attachments
Comments 14
Probably caused by the fix of MC-64139
They also turn black when dropped.