Class TileEntityRack

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
com.minecolonies.core.tileentities.TileEntityRack
All Implemented Interfaces:
com.ldtteam.domumornamentum.entity.block.IMateriallyTexturedBlockEntity, 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:
AbstractTileEntityColonyBuilding, AbstractTileEntityGrave

public class TileEntityRack extends AbstractTileEntityRack implements com.ldtteam.domumornamentum.entity.block.IMateriallyTexturedBlockEntity
Tile entity for the warehouse shelves.
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.minecolonies.api.tileentities.AbstractTileEntityRack

    AbstractTileEntityRack.RackInventory

    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 inherited from class com.minecolonies.api.tileentities.AbstractTileEntityRack

    buildingPos, inventory, inWarehouse

    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
    TileEntityRack(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
    Create a new default rack.
    TileEntityRack(net.minecraft.world.level.block.entity.BlockEntityType<? extends TileEntityRack> type, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
    Create a new rack.
    TileEntityRack(net.minecraft.world.level.block.entity.BlockEntityType<? extends TileEntityRack> type, 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
    net.minecraftforge.items.ItemStackHandler
    createInventory(int slots)
    Create the inventory that belongs to the rack.
    net.minecraft.world.inventory.AbstractContainerMenu
    createMenu(int id, @NotNull net.minecraft.world.entity.player.Inventory inv, @NotNull net.minecraft.world.entity.player.Player player)
     
    Gets the content of the Rack
    <T> net.minecraftforge.common.util.LazyOptional<T>
    getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, net.minecraft.core.Direction dir)
     
    int
    Check if a similar/same item as the stack is in the inventory.
    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.
    @NotNull net.minecraft.network.chat.Component
     
    int
    Get the amount of free slots in the inventory.
    int
    getItemCount(Predicate<net.minecraft.world.item.ItemStack> predicate)
     
    @NotNull net.minecraftforge.client.model.data.ModelData
     
    Get the other double chest or null.
    @NotNull com.ldtteam.domumornamentum.client.model.data.MaterialTextureData
     
    net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket
     
    @NotNull net.minecraft.nbt.CompoundTag
     
    int
    Get the upgrade size.
    void
    handleUpdateTag(net.minecraft.nbt.CompoundTag tag)
     
    boolean
    hasItemStack(@NotNull Predicate<net.minecraft.world.item.ItemStack> itemStackSelectionPredicate)
    Check if a similar/same item as the stack is in the inventory.
    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.
    boolean
    hasItemStorage(ItemStorage storage, int count)
    Check if the itemStorage exists in the inventory.
    boolean
    hasSimilarStack(@NotNull net.minecraft.world.item.ItemStack stack)
    Check if a similar stack is in the rack.
    boolean
    Checks if the chest is empty.
    void
    load(net.minecraft.nbt.CompoundTag compound)
     
    void
    onDataPacket(net.minecraft.network.Connection net, net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket packet)
     
    void
    saveAdditional(net.minecraft.nbt.CompoundTag compound)
     
    void
     
    void
    setInWarehouse(Boolean isInWarehouse)
    Set the value for inWarehouse
    void
     
    protected void
    Update the blockState of the rack.
    void
    Scans through the whole storage and updates it.
    void
    updateTextureDataWith(com.ldtteam.domumornamentum.client.model.data.MaterialTextureData materialTextureData)
     
    void
    Upgrade the rack by 1.

    Methods inherited from class com.minecolonies.api.tileentities.AbstractTileEntityRack

    getInventory, setBuildingPos, updateWarehouseIfAvailable

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

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

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

    areCapsCompatible, areCapsCompatible, deserializeCaps, gatherCapabilities, gatherCapabilities, gatherCapabilities, getCapabilities, 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

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

    deserializeNBT, getRenderBoundingBox, hasCustomOutlineRendering, onLoad, requestModelDataUpdate, serializeNBT
  • Constructor Details

    • TileEntityRack

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

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

      public TileEntityRack(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
      Create a new default rack.
      Parameters:
      pos - the position.
      state - its state.
  • Method Details

    • setInWarehouse

      public void setInWarehouse(Boolean isInWarehouse)
      Description copied from class: AbstractTileEntityRack
      Set the value for inWarehouse
      Specified by:
      setInWarehouse in class AbstractTileEntityRack
      Parameters:
      isInWarehouse - is this rack in a warehouse?
    • getFreeSlots

      public int getFreeSlots()
      Description copied from class: AbstractTileEntityRack
      Get the amount of free slots in the inventory. This method checks the content list, it is therefore extremely fast.
      Specified by:
      getFreeSlots in class AbstractTileEntityRack
      Returns:
      the amount of free slots (an integer).
    • hasItemStack

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

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

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

      protected void updateBlockState()
      Description copied from class: AbstractTileEntityRack
      Update the blockState of the rack. Switch between connected, single, full and empty texture.
      Specified by:
      updateBlockState in class AbstractTileEntityRack
    • getCount

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

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

      public boolean hasSimilarStack(@NotNull @NotNull net.minecraft.world.item.ItemStack stack)
      Description copied from class: AbstractTileEntityRack
      Check if a similar stack is in the rack.
      Specified by:
      hasSimilarStack in class AbstractTileEntityRack
      Parameters:
      stack - stack to check.
      Returns:
      a set of different results depending on the similarity metric.
    • getAllContent

      public Map<ItemStorage,Integer> getAllContent()
      Gets the content of the Rack
      Returns:
      the map of content.
    • upgradeRackSize

      public void upgradeRackSize()
      Description copied from class: AbstractTileEntityRack
      Upgrade the rack by 1. This adds 9 more slots and copies the inventory to the new one.
      Specified by:
      upgradeRackSize in class AbstractTileEntityRack
    • getItemCount

      public int getItemCount(Predicate<net.minecraft.world.item.ItemStack> predicate)
      Specified by:
      getItemCount in class AbstractTileEntityRack
    • updateItemStorage

      public void updateItemStorage()
      Description copied from class: AbstractTileEntityRack
      Scans through the whole storage and updates it.
      Specified by:
      updateItemStorage in class AbstractTileEntityRack
    • getOtherChest

      public AbstractTileEntityRack getOtherChest()
      Description copied from class: AbstractTileEntityRack
      Get the other double chest or null.
      Specified by:
      getOtherChest in class AbstractTileEntityRack
      Returns:
      the tileEntity of the other half or null.
    • createInventory

      public net.minecraftforge.items.ItemStackHandler createInventory(int slots)
      Description copied from class: AbstractTileEntityRack
      Create the inventory that belongs to the rack.
      Specified by:
      createInventory in class AbstractTileEntityRack
      Parameters:
      slots - the number of slots.
      Returns:
      the created inventory,
    • isEmpty

      public boolean isEmpty()
      Description copied from class: AbstractTileEntityRack
      Checks if the chest is empty. This method checks the content list, it is therefore extremely fast.
      Specified by:
      isEmpty in class AbstractTileEntityRack
      Returns:
      true if so.
    • load

      public void load(net.minecraft.nbt.CompoundTag compound)
      Overrides:
      load in class net.minecraft.world.level.block.entity.BlockEntity
    • saveAdditional

      public void saveAdditional(net.minecraft.nbt.CompoundTag compound)
      Overrides:
      saveAdditional in class net.minecraft.world.level.block.entity.BlockEntity
    • getUpdatePacket

      public net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket getUpdatePacket()
      Overrides:
      getUpdatePacket in class net.minecraft.world.level.block.entity.BlockEntity
    • getUpdateTag

      @NotNull public @NotNull net.minecraft.nbt.CompoundTag getUpdateTag()
      Overrides:
      getUpdateTag in class net.minecraft.world.level.block.entity.BlockEntity
    • onDataPacket

      public void onDataPacket(net.minecraft.network.Connection net, net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket packet)
      Specified by:
      onDataPacket in interface net.minecraftforge.common.extensions.IForgeBlockEntity
    • handleUpdateTag

      public void handleUpdateTag(net.minecraft.nbt.CompoundTag tag)
      Specified by:
      handleUpdateTag in interface net.minecraftforge.common.extensions.IForgeBlockEntity
    • getCapability

      @Nonnull public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(@Nonnull net.minecraftforge.common.capabilities.Capability<T> capability, net.minecraft.core.Direction dir)
      Specified by:
      getCapability in interface net.minecraftforge.common.capabilities.ICapabilityProvider
      Overrides:
      getCapability in class net.minecraftforge.common.capabilities.CapabilityProvider<net.minecraft.world.level.block.entity.BlockEntity>
    • getUpgradeSize

      public int getUpgradeSize()
      Description copied from class: AbstractTileEntityRack
      Get the upgrade size.
      Specified by:
      getUpgradeSize in class AbstractTileEntityRack
      Returns:
      the upgrade size.
    • setChanged

      public void setChanged()
      Overrides:
      setChanged in class net.minecraft.world.level.block.entity.BlockEntity
    • createMenu

      @Nullable public net.minecraft.world.inventory.AbstractContainerMenu createMenu(int id, @NotNull @NotNull net.minecraft.world.entity.player.Inventory inv, @NotNull @NotNull net.minecraft.world.entity.player.Player player)
      Specified by:
      createMenu in interface net.minecraft.world.inventory.MenuConstructor
    • getDisplayName

      @NotNull public @NotNull net.minecraft.network.chat.Component getDisplayName()
      Specified by:
      getDisplayName in interface net.minecraft.world.MenuProvider
    • setRemoved

      public void setRemoved()
      Overrides:
      setRemoved in class net.minecraft.world.level.block.entity.BlockEntity
    • updateTextureDataWith

      public void updateTextureDataWith(com.ldtteam.domumornamentum.client.model.data.MaterialTextureData materialTextureData)
      Specified by:
      updateTextureDataWith in interface com.ldtteam.domumornamentum.entity.block.IMateriallyTexturedBlockEntity
    • getModelData

      @NotNull public @NotNull net.minecraftforge.client.model.data.ModelData getModelData()
      Specified by:
      getModelData in interface net.minecraftforge.common.extensions.IForgeBlockEntity
    • getTextureData

      @NotNull public @NotNull com.ldtteam.domumornamentum.client.model.data.MaterialTextureData getTextureData()
      Specified by:
      getTextureData in interface com.ldtteam.domumornamentum.entity.block.IMateriallyTexturedBlockEntity