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

bemoty

Can confirm for MC 1.12.1.

migrated

Confirmed for 1.13.1.

JUE13

Can confirm for 19w34a

TheBoy358

Confirmed in 19w45a.

anthony cicinelli

Confirmed for Minecraft 1.15 Pre-Release 3

anthony cicinelli

Affects Minecraft 1.15 Pre-Release 4

anthony cicinelli

Affects 1.15 Pre-release 5

anthony cicinelli

Affects 20w20b

anthony cicinelli

Affects 1.16 Pre-Release 2

anthony cicinelli

Affects 1.16 Pre-Release 6

anthony cicinelli

Affects 1.16 Pre-Release 7

anthony cicinelli

Affects 1.16 rc-1

anthony cicinelli

Affects 20w27a

Avoma

Can confirm in 21w05b.

Avoma

Can confirm in 21w07a.

migrated

Affects 1.17

migrated

What’s a spawner_Minecraft and what is the difference between that and a normal one?

migrated

Affects 1.18

Avoma

Can confirm in 1.18.1.

Avoma

Can confirm in 1.18.2 and 22w15a.

Avoma

Can confirm in 1.19.

Avoma

Can confirm in 1.19.2.

migrated

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, ..., 24w11a, 24w12a, 1.20.6, 1.21, 1.21.3

Retrieved