mojira.dev
MC-135354

Actively editing the age data of dropped items and using /give will give two items

How to reproduce

Paste the following command in an always active repeating command block:

execute as @e[type=item] run data merge entity @s {Age:0s}

Now use the /give command to give yourself one of anything:

/give @p minecraft:stone 1

Expected behavior is that the player will be given one of that item. What really happens is that the player is given the item as specified in the /give command, but there is also plus one more dropped on the floor than what they asked for. In this case, the player was given two stone and not one.

Linked issues

Comments 7

Confirmed for 1.13.2-pre2.

Still an issue in 1.16.2

The item thrown on the ground however has PickupDelay:32767s, which could be an underflow bug of some sorts.

Furthermore, it seems that while giving an item to the player, it BOTH spawns an item in the world (so the animation plays) and it INSERTS the item into the player inventory. The reason this bug happens seems to be because there in fact ARE two instances of the same item, however, since the spawned item has it's age set to 5999s, it immediately despawns the next tick, giving you the illusion it went in your inventory, while in fact it was already there. By changing the Age, it will change that world item so it doesn't despawn immediately, resulting in the seemingly duped behavior.
Also, the PickupDelay set on this world item is 32767s by default, so that the player doesn't pick it up.

This bug could be exploited as a duplication glitch. (but only on worlds that use /give, for example in shops or the like, the duped item could be picked up by a hopper.)

Can confirm in 20w51a.

Can confirm in 21w05b.

Can confirm in 21w06a.

Can confirm in 1.16.5 and 21w08b.

OnePointZero

(Unassigned)

Confirmed

Commands

Minecraft 1.13, Minecraft 1.13.1, Minecraft 1.13.2-pre2, Minecraft 1.13.2, Minecraft 18w43b, ..., 20w51a, 1.16.5, 21w06a, 21w08b, 1.20.5 Pre-Release 4

Retrieved