Mojira Archive
MC-248270

Give comand item duplication

Description

When executing the /give command, players that are standing inside of a hopper minecart will not only get the item added to their inventory, it will also appear inside of the hopper.

Reproduction steps

  • Connect to a vanilla server or open a singleplayer world.
  • Place a single rail with a hopper minecart on top, surrounded by blocks so the minecart can't drive away.
  • Stand inside of the minecart and run /give.

An unlisted YouTube video executing these steps can be found here: https://youtu.be/wXnugysvc3c

Code analysis

In the GiveCommand#giveItem method, a fake item is created, that is set to have an infinite pickup delay and is scheduled to despawn in the next tick (since the age is set to 5999). Since the minecart will be ticked before the itemstack, it will be able to pick it up, right before it is supposed to despawn.

Duplicate

Noah van der Aa

2022-01-26, 10:27 AM

2022-01-26, 12:01 PM

2022-01-26, 11:08 AM

0

2

Unconfirmed

(Unassigned)

1.18.1, 22w03a

-