Class BlockEntityCampfire

All Implemented Interfaces:
BlockEntityContainer, InventoryHolder, Cloneable

@PowerNukkitOnly public class BlockEntityCampfire extends BlockEntitySpawnable implements InventoryHolder, BlockEntityContainer
  • Constructor Details

  • Method Details

    • initBlockEntity

      protected void initBlockEntity()
      Overrides:
      initBlockEntity in class BlockEntitySpawnable
    • loadNBT

      @Since("1.19.60-r1") public void loadNBT()
      Description copied from class: BlockEntity
      从方块实体的namedtag中读取数据
      Overrides:
      loadNBT in class BlockEntity
    • onUpdate

      public boolean onUpdate()
      Overrides:
      onUpdate in class BlockEntity
    • getKeepItem

      @PowerNukkitOnly public boolean getKeepItem(int slot)
    • setKeepItem

      @PowerNukkitOnly public void setKeepItem(int slot, boolean keep)
    • saveNBT

      public void saveNBT()
      Description copied from class: BlockEntity
      存储方块实体数据到namedtag
      Overrides:
      saveNBT in class BlockEntity
    • setRecipe

      @PowerNukkitOnly public void setRecipe(int index, CampfireRecipe recipe)
    • close

      public void close()
      Overrides:
      close in class BlockEntity
    • onBreak

      public void onBreak()
      Overrides:
      onBreak in class BlockEntity
    • getName

      public String getName()
      Overrides:
      getName in class BlockEntity
    • getSpawnCompound

      public CompoundTag getSpawnCompound()
      Overrides:
      getSpawnCompound in class BlockEntitySpawnable
    • isBlockEntityValid

      public boolean isBlockEntityValid()
      Specified by:
      isBlockEntityValid in class BlockEntity
    • getSize

      public int getSize()
      Description copied from interface: BlockEntityContainer
      返回这个容器最多能包含的物品数量。
      Returns the max number of items that this container can contain.
      Specified by:
      getSize in interface BlockEntityContainer
      Returns:
      最多能包含的物品数量。
      The max number.
    • getItem

      public Item getItem(int index)
      Description copied from interface: BlockEntityContainer
      返回一个存储在容器里的物品的Item对象。
      Returns an item that stores in this container, as an Item object.
      Specified by:
      getItem in interface BlockEntityContainer
      Parameters:
      index - 这个物品的索引序号。
      The index number of this item.
      Returns:
      这个物品的 Item对象。
      An Item object for this item.
    • setItem

      public void setItem(int index, Item item)
      Description copied from interface: BlockEntityContainer
      把一个物品存储进容器。
      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.

      Specified by:
      setItem in interface BlockEntityContainer
      Parameters:
      index - 这个物品的索引序号。
      The index number of this item.
      item - 描述这个物品的 Item对象。
      The Item object that describes this item.
    • getInventory

      public CampfireInventory getInventory()
      Specified by:
      getInventory in interface InventoryHolder