The bug
Hoppers and hopper minecarts ignore the PickupDelay
and Owner
tags of item entities completely defeating their purpose.
Expected would be that EntityItem
provides for example two methods (ignores MC-125495):
// Pseudo code
/**
* Returns if the pickup delay is over.
*
* @return If the pickup delay is over.
*/
private boolean isPickupDelayOver() {
return this.pickupDelay == 0;
}
/**
* Returns if the item entity can be picked up by the given entity. For non-entities call {@code #canBePickedUp()}.
*
* @param entity The entity which should be tested
* @return If the given entity can pick up this item entity
*/
public boolean canBePickedUp(Entity entity) {
if (this.isPickupDelayOver()) {
if (this.owner == null || this.owner.equals(entity)) {
return true;
}
}
return false;
}
/**
* Returns if the item entity can be picked up by a non-entity. For entities call {@code #canBePickedUp(Entity)}.
*
* @return If the item entity can be picked up by a non-entity
*/
public boolean canBePickedUp() {
return this.isPickupDelayOver() && this.owner == null;
}
How to reproduce
Place a hopper
Stand on the hopper and use the following command
/summon item ~ ~ ~ {PickupDelay:10000s,Item:{id:"stone",Count:1b}}
→ ❌ The item is picked up by the hopper
Can confirm in 1.19.3.