Class CitizenInventoryHandler

java.lang.Object
com.minecolonies.core.entity.citizen.citizenhandlers.CitizenInventoryHandler
All Implemented Interfaces:
ICitizenInventoryHandler

public class CitizenInventoryHandler extends Object implements ICitizenInventoryHandler
Handles the inventory of the citizen.
  • Constructor Details

    • CitizenInventoryHandler

      public CitizenInventoryHandler(AbstractEntityCitizen citizen)
      Constructor for the experience handler.
      Parameters:
      citizen - the citizen owning the handler.
  • Method Details

    • findFirstSlotInInventoryWith

      public int findFirstSlotInInventoryWith(net.minecraft.world.item.Item targetItem)
      Returns the first slot in the inventory with a specific item.
      Specified by:
      findFirstSlotInInventoryWith in interface ICitizenInventoryHandler
      Parameters:
      targetItem - the item.
      Returns:
      the slot.
    • findFirstSlotInInventoryWith

      public int findFirstSlotInInventoryWith(net.minecraft.world.level.block.Block block)
      Returns the first slot in the inventory with a specific block.
      Specified by:
      findFirstSlotInInventoryWith in interface ICitizenInventoryHandler
      Parameters:
      block - the block.
      Returns:
      the slot.
    • getItemCountInInventory

      public int getItemCountInInventory(net.minecraft.world.level.block.Block block)
      Returns the amount of a certain block in the inventory.
      Specified by:
      getItemCountInInventory in interface ICitizenInventoryHandler
      Parameters:
      block - the block.
      Returns:
      the quantity.
    • getItemCountInInventory

      public int getItemCountInInventory(net.minecraft.world.item.Item targetItem)
      Returns the amount of a certain item in the inventory.
      Specified by:
      getItemCountInInventory in interface ICitizenInventoryHandler
      Parameters:
      targetItem - the block.
      Returns:
      the quantity.
    • hasItemInInventory

      public boolean hasItemInInventory(net.minecraft.world.level.block.Block block)
      Checks if citizen has a certain block in the inventory.
      Specified by:
      hasItemInInventory in interface ICitizenInventoryHandler
      Parameters:
      block - the block.
      Returns:
      true if so.
    • hasItemInInventory

      public boolean hasItemInInventory(net.minecraft.world.item.Item item)
      Checks if citizen has a certain item in the inventory.
      Specified by:
      hasItemInInventory in interface ICitizenInventoryHandler
      Parameters:
      item - the item.
      Returns:
      true if so.
    • isInventoryFull

      public boolean isInventoryFull()
      Description copied from interface: ICitizenInventoryHandler
      Checks whether or not the inventory is full
      Specified by:
      isInventoryFull in interface ICitizenInventoryHandler
      Returns:
      true if the inventory is full