程序包 org.bukkit.block

接口 Dropper

所有超级接口:
BlockInventoryHolder, BlockState, Container, InventoryHolder, Lockable, Lootable, Metadatable, Nameable, PersistentDataHolder, TileState

public interface Dropper extends Container, Lootable
代表投掷器.
  • 方法详细资料

    • drop

      void drop()
      尝试从投掷器的物品栏随机进行投掷物品.

      投掷器正常的行为如下:

      如果这个投掷器方块面对的是一个InventoryHolder, 将会随机抽取投掷器里的物品放在第一个空的物品栏格子(从0开始计数),如果背包已满,什么也不会发生.

      如果这个投掷器方块面对的不是一个InventoryHolder, 将随机抽取投掷器里的物品以掉落在地上的形式 (掉落物实体) 投掷.

      如果该方块状态代表的方块不再是一个投掷器,使用本方法没有任何效果.

      原文: Tries to drop a randomly selected item from the dropper's inventory, following the normal behavior of a dropper.

      Normal behavior of a dropper is as follows:

      If the block that the dropper is facing is an InventoryHolder, the randomly selected ItemStack is placed within that Inventory in the first slot that's available, starting with 0 and counting up. If the inventory is full, nothing happens.

      If the block that the dropper is facing is not an InventoryHolder, the randomly selected ItemStack is dropped on the ground in the form of an Item.

      If the block represented by this state is no longer a dropper, this will do nothing.

      抛出:
      IllegalStateException - 如果方块状态未应用(译注:仅仅是一种表示而未应用到实际的方块上, 一种虚拟状态)