Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-125496

Hoppers ignore PickupDelay and Owner of item entities making the tags useless

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Works As Intended
    • None
    • Minecraft 1.12.2, Minecraft 18w07b, Minecraft 18w20c, Minecraft 18w22c, Minecraft 1.13-pre1, Minecraft 1.13-pre2, Minecraft 1.13-pre3, Minecraft 1.13-pre4, Minecraft 1.13-pre5, Minecraft 1.13, Minecraft 18w31a, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 19w03c, Minecraft 19w04b, Minecraft 1.14 Pre-Release 2, Minecraft 1.14 Pre-Release 3, 1.15.2, 20w17a, 20w21a, 1.16 Pre-release 2, 1.16.1, 20w29a, 20w30a, 1.16.2 Pre-release 3, 1.16.2 Release Candidate 1, 1.16.2 Release Candidate 2, 1.16.2, 1.16.3, 1.16.4 Pre-release 2, 1.16.4 Release Candidate 1, 1.16.4, 1.17, 1.19.3, 1.20.2, 23w43a
    • Confirmed
    • Commands, Items

      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

      1. Place a hopper
      2. 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

            Unassigned Unassigned
            marcono1234 [Mod] Marcono1234
            Votes:
            12 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: