Class AbstractTileEntityRack

java.lang.Object
net.minecraftforge.common.capabilities.CapabilityProvider<net.minecraft.world.level.block.entity.BlockEntity>
net.minecraft.world.level.block.entity.BlockEntity
com.minecolonies.api.tileentities.AbstractTileEntityRack
All Implemented Interfaces:
net.minecraft.world.inventory.MenuConstructor, net.minecraft.world.MenuProvider, net.minecraftforge.common.capabilities.ICapabilityProvider, net.minecraftforge.common.capabilities.ICapabilityProviderImpl<net.minecraft.world.level.block.entity.BlockEntity>, net.minecraftforge.common.capabilities.ICapabilitySerializable<net.minecraft.nbt.CompoundTag>, net.minecraftforge.common.extensions.IForgeBlockEntity, net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
Direct Known Subclasses:
TileEntityRack

public abstract class AbstractTileEntityRack extends net.minecraft.world.level.block.entity.BlockEntity implements net.minecraft.world.MenuProvider
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    class 
    Rack inventory type.

    Nested classes/interfaces inherited from class net.minecraftforge.common.capabilities.CapabilityProvider

    net.minecraftforge.common.capabilities.CapabilityProvider.AsField<B extends net.minecraftforge.common.capabilities.ICapabilityProviderImpl<B>>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected net.minecraft.core.BlockPos
    Pos of the owning building.
    protected net.minecraftforge.items.ItemStackHandler
    The inventory of the tileEntity.
    protected boolean
    whether this rack is in a warehouse or not.

    Fields inherited from class net.minecraft.world.level.block.entity.BlockEntity

    level, remove, worldPosition

    Fields inherited from interface net.minecraftforge.common.extensions.IForgeBlockEntity

    INFINITE_EXTENT_AABB
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractTileEntityRack(net.minecraft.world.level.block.entity.BlockEntityType<?> tileEntityTypeIn, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
    Create a new rack.
    AbstractTileEntityRack(net.minecraft.world.level.block.entity.BlockEntityType<?> tileEntityTypeIn, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, int size)
    Create a rack with a specific inventory size.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract net.minecraftforge.items.ItemStackHandler
    createInventory(int slots)
    Create the inventory that belongs to the rack.
    abstract int
    Check if a similar/same item as the stack is in the inventory.
    abstract int
    getCount(net.minecraft.world.item.ItemStack stack, boolean ignoreDamageValue, boolean ignoreNBT)
    Check if a similar/same item as the stack is in the inventory.
    abstract int
    Get the amount of free slots in the inventory.
    net.minecraftforge.items.IItemHandlerModifiable
     
    abstract int
    getItemCount(Predicate<net.minecraft.world.item.ItemStack> predicate)
     
    Get the other double chest or null.
    abstract int
    Get the upgrade size.
    abstract boolean
    hasItemStack(@NotNull Predicate<net.minecraft.world.item.ItemStack> itemStackSelectionPredicate)
    Check if a similar/same item as the stack is in the inventory.
    abstract boolean
    hasItemStack(net.minecraft.world.item.ItemStack stack, int count, boolean ignoreDamageValue)
    Check if a similar/same item as the stack is in the inventory.
    abstract boolean
    hasItemStorage(ItemStorage storage, int count)
    Check if the itemStorage exists in the inventory.
    abstract boolean
    hasSimilarStack(@NotNull net.minecraft.world.item.ItemStack stack)
    Check if a similar stack is in the rack.
    abstract boolean
    Checks if the chest is empty.
    void
    setBuildingPos(net.minecraft.core.BlockPos pos)
    Set the building pos it belongs to.
    abstract void
    setInWarehouse(Boolean isInWarehouse)
    Set the value for inWarehouse
    protected abstract void
    Update the blockState of the rack.
    abstract void
    Scans through the whole storage and updates it.
    void
    updateWarehouseIfAvailable(net.minecraft.world.item.ItemStack stack)
    Update the warehouse if available with the updated stack.
    abstract void
    Upgrade the rack by 1.

    Methods inherited from class net.minecraft.world.level.block.entity.BlockEntity

    addEntityType, clearRemoved, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getPersistentData, getPosFromTag, getType, getUpdatePacket, getUpdateTag, hasLevel, isRemoved, load, loadStatic, onChunkUnloaded, onlyOpCanSetNbt, saveAdditional, saveToItem, saveWithFullMetadata, saveWithId, saveWithoutMetadata, setBlockState, setChanged, setChanged, setLevel, setRemoved, triggerEvent

    Methods inherited from class net.minecraftforge.common.capabilities.CapabilityProvider

    areCapsCompatible, areCapsCompatible, deserializeCaps, gatherCapabilities, gatherCapabilities, gatherCapabilities, getCapabilities, getCapability, invalidateCaps, reviveCaps, serializeCaps

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.minecraftforge.common.capabilities.ICapabilityProvider

    getCapability, getCapability

    Methods inherited from interface net.minecraftforge.common.extensions.IForgeBlockEntity

    deserializeNBT, getModelData, getRenderBoundingBox, handleUpdateTag, hasCustomOutlineRendering, onDataPacket, onLoad, requestModelDataUpdate, serializeNBT

    Methods inherited from interface net.minecraft.world.inventory.MenuConstructor

    createMenu

    Methods inherited from interface net.minecraft.world.MenuProvider

    getDisplayName
  • Field Details

    • inWarehouse

      protected boolean inWarehouse
      whether this rack is in a warehouse or not. defaults to not set by the warehouse building upon being built
    • buildingPos

      protected net.minecraft.core.BlockPos buildingPos
      Pos of the owning building.
    • inventory

      protected net.minecraftforge.items.ItemStackHandler inventory
      The inventory of the tileEntity.
  • Constructor Details

    • AbstractTileEntityRack

      public AbstractTileEntityRack(net.minecraft.world.level.block.entity.BlockEntityType<?> tileEntityTypeIn, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
      Create a new rack.
      Parameters:
      tileEntityTypeIn - the specific block entity type.
      pos - the position.
      state - its state.
    • AbstractTileEntityRack

      public AbstractTileEntityRack(net.minecraft.world.level.block.entity.BlockEntityType<?> tileEntityTypeIn, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, int size)
      Create a rack with a specific inventory size.
      Parameters:
      tileEntityTypeIn - the specific block entity type.
      pos - the position.
      state - its state.
      size - the ack size.
  • Method Details

    • createInventory

      public abstract net.minecraftforge.items.ItemStackHandler createInventory(int slots)
      Create the inventory that belongs to the rack.
      Parameters:
      slots - the number of slots.
      Returns:
      the created inventory,
    • updateWarehouseIfAvailable

      public void updateWarehouseIfAvailable(net.minecraft.world.item.ItemStack stack)
      Update the warehouse if available with the updated stack.
      Parameters:
      stack - the incoming stack.
    • setInWarehouse

      public abstract void setInWarehouse(Boolean isInWarehouse)
      Set the value for inWarehouse
      Parameters:
      isInWarehouse - is this rack in a warehouse?
    • getFreeSlots

      public abstract int getFreeSlots()
      Get the amount of free slots in the inventory. This method checks the content list, it is therefore extremely fast.
      Returns:
      the amount of free slots (an integer).
    • hasItemStack

      public abstract boolean hasItemStack(net.minecraft.world.item.ItemStack stack, int count, boolean ignoreDamageValue)
      Check if a similar/same item as the stack is in the inventory. This method checks the content list, it is therefore extremely fast.
      Parameters:
      stack - the stack to check.
      count - the min count it should have.
      ignoreDamageValue - ignore the damage value.
      Returns:
      true if so.
    • hasItemStorage

      public abstract boolean hasItemStorage(ItemStorage storage, int count)
      Check if the itemStorage exists in the inventory. This method checks the content list, it is therefore extremely fast.
      Parameters:
      storage - the storage to check.
      count - the min count it should have.
      Returns:
      true if so.
    • getCount

      public abstract int getCount(net.minecraft.world.item.ItemStack stack, boolean ignoreDamageValue, boolean ignoreNBT)
      Check if a similar/same item as the stack is in the inventory. And return the count if so.
      Parameters:
      stack - the stack to check.
      ignoreDamageValue - ignore the damage value.
      ignoreNBT - if nbt should be ignored.
      Returns:
      the quantity or 0.
    • getCount

      public abstract int getCount(ItemStorage storage)
      Check if a similar/same item as the stack is in the inventory. And return the count if so.
      Parameters:
      storage - the storage to match.
      Returns:
      the quantity or 0.
    • hasItemStack

      public abstract boolean hasItemStack(@NotNull @NotNull Predicate<net.minecraft.world.item.ItemStack> itemStackSelectionPredicate)
      Check if a similar/same item as the stack is in the inventory. This method checks the content list, it is therefore extremely fast.
      Parameters:
      itemStackSelectionPredicate - the predicate to test the stack against.
      Returns:
      true if so.
    • hasSimilarStack

      public abstract boolean hasSimilarStack(@NotNull @NotNull net.minecraft.world.item.ItemStack stack)
      Check if a similar stack is in the rack.
      Parameters:
      stack - stack to check.
      Returns:
      a set of different results depending on the similarity metric.
    • upgradeRackSize

      public abstract void upgradeRackSize()
      Upgrade the rack by 1. This adds 9 more slots and copies the inventory to the new one.
    • setBuildingPos

      public void setBuildingPos(net.minecraft.core.BlockPos pos)
      Set the building pos it belongs to.
      Parameters:
      pos - the pos of the building.
    • getUpgradeSize

      public abstract int getUpgradeSize()
      Get the upgrade size.
      Returns:
      the upgrade size.
    • getItemCount

      public abstract int getItemCount(Predicate<net.minecraft.world.item.ItemStack> predicate)
    • updateItemStorage

      public abstract void updateItemStorage()
      Scans through the whole storage and updates it.
    • updateBlockState

      protected abstract void updateBlockState()
      Update the blockState of the rack. Switch between connected, single, full and empty texture.
    • getOtherChest

      public abstract AbstractTileEntityRack getOtherChest()
      Get the other double chest or null.
      Returns:
      the tileEntity of the other half or null.
    • isEmpty

      public abstract boolean isEmpty()
      Checks if the chest is empty. This method checks the content list, it is therefore extremely fast.
      Returns:
      true if so.
    • getInventory

      public net.minecraftforge.items.IItemHandlerModifiable getInventory()