mojira.dev
MC-94094

Snow golems don't drop their pumpkin when sheared

The bug

As of snapshot 15w49a, if you shear a snow golem, you'll be able to remove his pumpkin and see his original face. But the pumpkin isn't dropped in a way that you can get it back.

Code analysis

Code analysis by @unknown can be found in this comment.

Linked issues

Attachments

Comments 10

In MC:PE it is the same, so it's intended

This could well be a bug in both versions. Has a dev actually said/tweeted/whatever that it is intended?

Like I said in the description, maybe the developers have their reasons not to make them drop the pumpkin - maybe so that you couldn't spawn an infinite amount of golems using a single pumpkin. But, in any case, I wanted to make sure it is intended. But if it isn't, it will get fixed.

Still in 1.9.1-pre3

Can confirm for MC 1.12.1.

The following is based on a decompiled version of Minecraft 1.12 using MCP 9.40pre-1.

This happens because the method net.minecraft.entity.monster.EntitySnowman.processInteract() simply removes the pumpkin from the snow golem's head without dropping it. This can be fixed by invoking the method net.minecraft.entity.dropItem(Item.getItemFromBlock(Blocks.PUMPKIN), 1) which will make the snow golem drop a pumpkin.

protected boolean processInteract(EntityPlayer player, EnumHand hand)
{
	ItemStack itemstack = player.getHeldItem(hand);

	if (itemstack.getItem() == Items.SHEARS && this.isPumpkinEquipped() && !this.world.isRemote)
	{
		this.setPumpkinEquipped(false);
		// This line should be added, it will make the snow golem drop a pumpkin when sheared
		this.dropItem(Item.getItemFromBlock(Blocks.PUMPKIN), 1);
		itemstack.damageItem(1, player);
	}

	return super.processInteract(player, hand);
}

Affects 1.14 and 1.14.1 Pre-Release 2

Affects 1.14.4 and 1.15-pre1

Bentroen

kingbdogz

Confirmed

(Unassigned)

Minecraft 15w49a, Minecraft 15w49b, Minecraft 15w50a, Minecraft 1.9.1 Pre-Release 3, Minecraft 1.9.4, ..., Minecraft 1.14, Minecraft 1.14.1 Pre-Release 2, 1.14.4, 1.15 Pre-release 1, 20w06a

20w07a

Retrieved