mojira.dev
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.

Comments 3

Thank you for your report!
We're tracking this issue in MC-120507, so this ticket is being resolved and linked as a duplicate.

If you would like to add a vote and any extra information to the main ticket it would be appreciated.

If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.

Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
-- I am a bot. This action was performed automatically! The ticket was resolved by one of our moderators, and I left this message to give more information to you.

👍 Thanks, I didn't search for existing issues since I assumed duplication-related issues wouldn't be public.

Normally they're not, but since this one requires command access, it can't be used to destroy server economies.

NoahvdAa

(Unassigned)

Unconfirmed

(Unassigned)

1.18.1, 22w03a

Retrieved