mojira.dev
MC-94225

Pick block (middle mouse button) on spawner_minecart gives you minecart

The bug

When you middle click a spawner_minecart you will get a minecart item. I am not talking about the fact that you do not get a minecart spawner item (that is MC-17653), but rather that you get a plain minecart. I would expect like it is for other blocks or entities that have no item to get nothing at all.

The reason

The reason for this is that in the net.minecraft.client.Minecraft.middleClickMouse() method of the net.minecraft.client.Minecraft class (MCP 1.8 names) it defaults to a normal Minecart in case no item for the corresponding Minecart type exists:

//...

else if (this.objectMouseOver.entityHit instanceof EntityMinecart)
{
	EntityMinecart var12 = (EntityMinecart)this.objectMouseOver.entityHit;

	switch (Minecraft.SwitchEnumMinecartType.field_178901_b[var12.func_180456_s().ordinal()])
	{
		case 1:
			var2 = Items.furnace_minecart;
			break;

		case 2:
			var2 = Items.chest_minecart;
			break;

		case 3:
			var2 = Items.tnt_minecart;
			break;

		case 4:
			var2 = Items.hopper_minecart;
			break;

		case 5:
			var2 = Items.command_block_minecart;
			break;

		default:
			var2 = Items.minecart;
	}
}

//...

However having a method for each entity that returns the item would be probably better.

How to reproduce

  1. Middle click a spawner_minecart

Linked issues

Attachments

Comments 23

Can confirm for MC 1.12.1.

Confirmed for 1.13.1.

Can confirm for 19w34a

Confirmed in 19w45a.

anthony cicinelli

Confirmed for Minecraft 1.15 Pre-Release 3

13 more comments

Can confirm in 1.18.1.

Can confirm in 1.18.2 and 22w15a.

Can confirm in 1.19.

Can confirm in 1.19.2.

Affects 1.21.2  Pre-Release 3

marcono1234

(Unassigned)

Confirmed

Platform

Low

Minecart, Player

middle-click, minecart, pick-block, spawner_minecart

Minecraft 15w50a, Minecraft 16w42a, Minecraft 1.11.2, Minecraft 1.12.1, Minecraft 1.12.2, ..., 1.21.3, 1.21.5, 1.21.6, 1.21.7, 1.21.8

Retrieved