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
is duplicated by 1
relates to 1
Comments 7
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.)
Confirmed for 1.13.2-pre2.