Class TileEntityRack

java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
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, IItemHandlerCapProvider, net.minecraft.world.Clearable, net.minecraft.world.inventory.MenuConstructor, net.minecraft.world.MenuProvider, net.neoforged.neoforge.attachment.IAttachmentHolder, net.neoforged.neoforge.client.extensions.IMenuProviderExtension, net.neoforged.neoforge.common.extensions.IBlockEntityExtension
Direct Known Subclasses:
AbstractTileEntityColonyBuilding, AbstractTileEntityGrave

public class TileEntityRack extends AbstractTileEntityRack implements com.ldtteam.domumornamentum.entity.block.IMateriallyTexturedBlockEntity, net.minecraft.world.Clearable
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.minecraft.world.level.block.entity.BlockEntity

    net.minecraft.world.level.block.entity.BlockEntity.DataComponentInput

    Nested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder

    net.neoforged.neoforge.attachment.AttachmentHolder.AsField
  • 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 class net.neoforged.neoforge.attachment.AttachmentHolder

    ATTACHMENTS_NBT_KEY
  • 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
    void
     
    net.neoforged.neoforge.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
    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)
     
    net.neoforged.neoforge.items.IItemHandler
    getItemHandlerCap(net.minecraft.core.Direction direction)
     
    @NotNull net.neoforged.neoforge.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
    getUpdateTag(net.minecraft.core.HolderLookup.Provider provider)
     
    int
    Get the upgrade size.
    void
    handleUpdateTag(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider provider)
     
    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
    loadAdditional(net.minecraft.nbt.CompoundTag compound, net.minecraft.core.HolderLookup.Provider provider)
     
    void
    onDataPacket(net.minecraft.network.Connection net, net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket packet, net.minecraft.core.HolderLookup.Provider provider)
     
    void
    saveAdditional(net.minecraft.nbt.CompoundTag compound, net.minecraft.core.HolderLookup.Provider provider)
     
    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, applyComponents, applyComponentsFromItemStack, applyImplicitComponents, clearRemoved, collectComponents, collectImplicitComponents, components, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getPersistentData, getPosFromTag, getType, hasLevel, isRemoved, isValidBlockState, loadCustomOnly, loadStatic, loadWithComponents, onlyOpCanSetNbt, parseCustomNameSafe, removeComponentsFromTag, removeData, saveCustomAndMetadata, saveCustomOnly, saveToItem, saveWithFullMetadata, saveWithId, saveWithoutMetadata, setBlockState, setChanged, setComponents, setData, setLevel, triggerEvent

    Methods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder

    deserializeAttachments, getData, getExistingData, hasAttachments, hasData, serializeAttachments

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder

    getData, getExistingData, hasData, removeData, setData

    Methods inherited from interface net.neoforged.neoforge.common.extensions.IBlockEntityExtension

    hasCustomOutlineRendering, invalidateCapabilities, onChunkUnloaded, onLoad, requestModelDataUpdate

    Methods inherited from interface com.minecolonies.api.util.IItemHandlerCapProvider

    getItemHandlerCap, getItemHandlerCap

    Methods inherited from interface net.neoforged.neoforge.client.extensions.IMenuProviderExtension

    shouldTriggerClientSideContainerClosingOnOpen
  • 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.neoforged.neoforge.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.
    • loadAdditional

      public void loadAdditional(net.minecraft.nbt.CompoundTag compound, @NotNull net.minecraft.core.HolderLookup.Provider provider)
      Overrides:
      loadAdditional in class net.minecraft.world.level.block.entity.BlockEntity
    • saveAdditional

      public void saveAdditional(net.minecraft.nbt.CompoundTag compound, @NotNull net.minecraft.core.HolderLookup.Provider provider)
      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(@NotNull net.minecraft.core.HolderLookup.Provider provider)
      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, @NotNull net.minecraft.core.HolderLookup.Provider provider)
      Specified by:
      onDataPacket in interface net.neoforged.neoforge.common.extensions.IBlockEntityExtension
    • handleUpdateTag

      public void handleUpdateTag(net.minecraft.nbt.CompoundTag tag, @NotNull net.minecraft.core.HolderLookup.Provider provider)
      Specified by:
      handleUpdateTag in interface net.neoforged.neoforge.common.extensions.IBlockEntityExtension
    • getItemHandlerCap

      @Nullable public net.neoforged.neoforge.items.IItemHandler getItemHandlerCap(net.minecraft.core.Direction direction)
      Specified by:
      getItemHandlerCap in interface IItemHandlerCapProvider
      Returns:
      direction-aware itemHandler
    • 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.neoforged.neoforge.client.model.data.ModelData getModelData()
      Specified by:
      getModelData in interface net.neoforged.neoforge.common.extensions.IBlockEntityExtension
    • getTextureData

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

      public void clearContent()
      Specified by:
      clearContent in interface net.minecraft.world.Clearable