接口 Item

所有超级接口:
CommandSender, Entity, Metadatable, Nameable, Permissible, PersistentDataHolder, ServerOperator

public interface Item extends Entity
代表掉落物实体.
  • 方法详细资料

    • getItemStack

      @NotNull @NotNull ItemStack getItemStack()
      获取与此掉落物相关的物品堆.

      原文:Gets the item stack associated with this item drop.

      返回:
      物品堆
    • setItemStack

      void setItemStack(@NotNull @NotNull ItemStack stack)
      设置与此掉落物相关的物品堆.

      原文:Sets the item stack associated with this item drop.

      参数:
      stack - 物品堆
    • getPickupDelay

      int getPickupDelay()
      获取此掉落物剩余的不可被捡起的时间.

      原文:Gets the delay before this Item is available to be picked up by players

      返回:
      掉落物剩余的不可被捡起的时间
    • setPickupDelay

      void setPickupDelay(int delay)
      设置掉落物剩余的不可被捡起的时间.

      原文:Sets the delay before this Item is available to be picked up by players

      参数:
      delay - 掉落物剩余的不可被捡起的时间
    • setUnlimitedLifetime

      void setUnlimitedLifetime(boolean unlimited)
      设置此掉落物是否应永久存在.

      原文:Sets if this Item should live forever

      参数:
      unlimited - 如果为true则掉落物的生存时间无限制
    • isUnlimitedLifetime

      boolean isUnlimitedLifetime()
      获取此掉落物是否永久存在.

      原文:Gets if this Item lives forever

      返回:
      如果生存时间无限制则返回true
    • 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.

      参数:
      owner - 新所有者的UUID
    • getOwner

      获取此掉落物的所有者.

      原文:Get the owner of this item.

      返回:
      所有者的UUID
    • 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.

      参数:
      uuid - 投掷者的UUID
    • getThrower

      @Nullable @Nullable UUID getThrower()
      获取此掉落物的投掷者.

      投掷者是掉落此物品的实体.

      原文:Get the thrower of this item.

      The thrower is the entity which dropped the item.

      返回:
      投掷者的UUID