Interface BlockEntityContainer

All Known Implementing Classes:
BlockEntityBarrel, BlockEntityBlastFurnace, BlockEntityBrewingStand, BlockEntityCampfire, BlockEntityChest, BlockEntityDispenser, BlockEntityDropper, BlockEntityEjectable, BlockEntityFurnace, BlockEntityHopper, BlockEntityShulkerBox, BlockEntitySmoker, BlockEntitySpawnableContainer

public interface BlockEntityContainer
表达一个容器的接口。
An interface describes a container.

BlockEntityContainer容器必须包含物品的Item对象。
A BlockEntityContainer must contain items as Item objects.

Since:
Nukkit 1.0 | Nukkit API 1.0.0
Author:
MagicDroidX(code) @ Nukkit Project, 粉鞋大妈(javadoc) @ Nukkit Project
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    getItem(int index)
    返回一个存储在容器里的物品的Item对象。
    Returns an item that stores in this container, as an Item object.
    int
    返回这个容器最多能包含的物品数量。
    Returns the max number of items that this container can contain.
    void
    setItem(int index, Item item)
    把一个物品存储进容器。
    Sets or stores this item into this container.
  • Method Details

    • getItem

      Item getItem(int index)
      返回一个存储在容器里的物品的Item对象。
      Returns an item that stores in this container, as an Item object.
      Parameters:
      index - 这个物品的索引序号。
      The index number of this item.
      Returns:
      这个物品的 Item对象。
      An Item object for this item.
      Since:
      Nukkit 1.0 | Nukkit API 1.0.0
    • setItem

      void setItem(int index, Item item)
      把一个物品存储进容器。
      Sets or stores this item into this container.

      注意:如果这个容器相应的索引序号已经有了物品,那么新存储的物品将会替换原有的物品。
      Notice: If there is already an item for this index number, the new item being stored will REPLACE the old one.

      Parameters:
      index - 这个物品的索引序号。
      The index number of this item.
      item - 描述这个物品的 Item对象。
      The Item object that describes this item.
      Since:
      Nukkit 1.0 | Nukkit API 1.0.0
    • getSize

      int getSize()
      返回这个容器最多能包含的物品数量。
      Returns the max number of items that this container can contain.
      Returns:
      最多能包含的物品数量。
      The max number.
      Since:
      Nukkit 1.0 | Nukkit API 1.0.0