Interface Item

All Superinterfaces:
Audience, CommandSender, Entity, HoverEventSource<HoverEvent.ShowEntity>, Metadatable, Nameable, Permissible, PersistentDataHolder, Pointered, ServerOperator, Sound.Emitter

public interface Item extends Entity
Represents a dropped item.
  • Method Details

    • getItemStack

      @NotNull @NotNull ItemStack getItemStack()
      Gets the item stack associated with this item drop.
      Returns:
      An item stack.
    • setItemStack

      void setItemStack(@NotNull @NotNull ItemStack stack)
      Sets the item stack associated with this item drop.
      Parameters:
      stack - An item stack.
    • getPickupDelay

      int getPickupDelay()
      Gets the delay before this Item is available to be picked up by players
      Returns:
      Remaining delay
    • setPickupDelay

      void setPickupDelay(int delay)
      Sets the delay before this Item is available to be picked up by players
      Parameters:
      delay - New delay
    • setOwner

      void setOwner(@Nullable @Nullable UUID owner)
      Sets the owner of this item. Other entities will not be able to pickup this item when an owner is set.
      Parameters:
      owner - UUID of new owner
    • getOwner

      Get the owner of this item.
      Returns:
      UUID of owner
    • setThrower

      void setThrower(@Nullable @Nullable UUID uuid)
      Set the thrower of this item. The thrower is the entity which dropped the item. This affects the trigger criteria for item pickups, for things such as advancements.
      Parameters:
      uuid - UUID of thrower
    • getThrower

      @Nullable @Nullable UUID getThrower()
      Get the thrower of this item. The thrower is the entity which dropped the item.
      Returns:
      UUID of thrower
    • canMobPickup

      boolean canMobPickup()
      Gets if non-player entities can pick this Item up
      Returns:
      True if non-player entities can pickup
    • setCanMobPickup

      void setCanMobPickup(boolean canMobPickup)
      Sets if non-player entities can pick this Item up
      Parameters:
      canMobPickup - True to allow non-player entity pickup
    • canPlayerPickup

      boolean canPlayerPickup()
      Gets whether the player can pickup the item or not
      Returns:
      True if a player can pickup the item
    • setCanPlayerPickup

      void setCanPlayerPickup(boolean canPlayerPickup)
      Sets whether the item can be picked up or not. Modifies the pickup delay value to do so.
      Parameters:
      canPlayerPickup - True if the player can pickup the item
    • willAge

      boolean willAge()
      Gets whether the item will age and despawn from being on the ground too long
      Returns:
      True if the item will age
    • setWillAge

      void setWillAge(boolean willAge)
      Sets whether the item will age or not. If the item is not ageing, it will not despawn by being on the ground for too long.
      Parameters:
      willAge - True if the item should age