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.RackInventoryNested classes/interfaces inherited from class net.minecraft.world.level.block.entity.BlockEntity
net.minecraft.world.level.block.entity.BlockEntity.DataComponentInputNested 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, inWarehouseFields inherited from class net.minecraft.world.level.block.entity.BlockEntity
level, remove, worldPositionFields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
ATTACHMENTS_NBT_KEY -
Constructor Summary
ConstructorsConstructorDescriptionTileEntityRack(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 TypeMethodDescriptionvoidnet.neoforged.neoforge.items.ItemStackHandlercreateInventory(int slots) Create the inventory that belongs to the rack.net.minecraft.world.inventory.AbstractContainerMenucreateMenu(int id, @NotNull net.minecraft.world.entity.player.Inventory inv, @NotNull net.minecraft.world.entity.player.Player player) Gets the content of the RackintgetCount(ItemStorage storage) Check if a similar/same item as the stack is in the inventory.intgetCount(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.ComponentintGet the amount of free slots in the inventory.intgetItemCount(Predicate<net.minecraft.world.item.ItemStack> predicate) net.neoforged.neoforge.items.IItemHandlergetItemHandlerCap(net.minecraft.core.Direction direction) @NotNull net.neoforged.neoforge.client.model.data.ModelDataGet the other double chest or null.@NotNull com.ldtteam.domumornamentum.client.model.data.MaterialTextureDatanet.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket@NotNull net.minecraft.nbt.CompoundTaggetUpdateTag(net.minecraft.core.HolderLookup.Provider provider) intGet the upgrade size.voidhandleUpdateTag(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider provider) booleanhasItemStack(@NotNull Predicate<net.minecraft.world.item.ItemStack> itemStackSelectionPredicate) Check if a similar/same item as the stack is in the inventory.booleanhasItemStack(net.minecraft.world.item.ItemStack stack, int count, boolean ignoreDamageValue) Check if a similar/same item as the stack is in the inventory.booleanhasItemStorage(ItemStorage storage, int count) Check if the itemStorage exists in the inventory.booleanhasSimilarStack(@NotNull net.minecraft.world.item.ItemStack stack) Check if a similar stack is in the rack.booleanisEmpty()Checks if the chest is empty.voidloadAdditional(net.minecraft.nbt.CompoundTag compound, net.minecraft.core.HolderLookup.Provider provider) voidonDataPacket(net.minecraft.network.Connection net, net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket packet, net.minecraft.core.HolderLookup.Provider provider) voidsaveAdditional(net.minecraft.nbt.CompoundTag compound, net.minecraft.core.HolderLookup.Provider provider) voidvoidsetInWarehouse(Boolean isInWarehouse) Set the value for inWarehousevoidprotected voidUpdate the blockState of the rack.voidScans through the whole storage and updates it.voidupdateTextureDataWith(com.ldtteam.domumornamentum.client.model.data.MaterialTextureData materialTextureData) voidUpgrade the rack by 1.Methods inherited from class com.minecolonies.api.tileentities.AbstractTileEntityRack
getInventory, setBuildingPos, updateWarehouseIfAvailableMethods 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, triggerEventMethods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
deserializeAttachments, getData, getExistingData, hasAttachments, hasData, serializeAttachmentsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, hasData, removeData, setDataMethods inherited from interface net.neoforged.neoforge.common.extensions.IBlockEntityExtension
hasCustomOutlineRendering, invalidateCapabilities, onChunkUnloaded, onLoad, requestModelDataUpdateMethods inherited from interface com.minecolonies.api.util.IItemHandlerCapProvider
getItemHandlerCap, getItemHandlerCapMethods 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
Description copied from class:AbstractTileEntityRackSet the value for inWarehouse- Specified by:
setInWarehousein classAbstractTileEntityRack- Parameters:
isInWarehouse- is this rack in a warehouse?
-
getFreeSlots
public int getFreeSlots()Description copied from class:AbstractTileEntityRackGet the amount of free slots in the inventory. This method checks the content list, it is therefore extremely fast.- Specified by:
getFreeSlotsin classAbstractTileEntityRack- 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:AbstractTileEntityRackCheck 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:
hasItemStackin classAbstractTileEntityRack- Parameters:
stack- the stack to check.count- the min count it should have.ignoreDamageValue- ignore the damage value.- Returns:
- true if so.
-
hasItemStorage
Description copied from class:AbstractTileEntityRackCheck if the itemStorage exists in the inventory. This method checks the content list, it is therefore extremely fast.- Specified by:
hasItemStoragein classAbstractTileEntityRack- 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:AbstractTileEntityRackCheck if a similar/same item as the stack is in the inventory. And return the count if so.- Specified by:
getCountin classAbstractTileEntityRack- 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:AbstractTileEntityRackUpdate the blockState of the rack. Switch between connected, single, full and empty texture.- Specified by:
updateBlockStatein classAbstractTileEntityRack
-
getCount
Description copied from class:AbstractTileEntityRackCheck if a similar/same item as the stack is in the inventory. And return the count if so.- Specified by:
getCountin classAbstractTileEntityRack- 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:AbstractTileEntityRackCheck 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:
hasItemStackin classAbstractTileEntityRack- 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:AbstractTileEntityRackCheck if a similar stack is in the rack.- Specified by:
hasSimilarStackin classAbstractTileEntityRack- Parameters:
stack- stack to check.- Returns:
- a set of different results depending on the similarity metric.
-
getAllContent
Gets the content of the Rack- Returns:
- the map of content.
-
upgradeRackSize
public void upgradeRackSize()Description copied from class:AbstractTileEntityRackUpgrade the rack by 1. This adds 9 more slots and copies the inventory to the new one.- Specified by:
upgradeRackSizein classAbstractTileEntityRack
-
getItemCount
- Specified by:
getItemCountin classAbstractTileEntityRack
-
updateItemStorage
public void updateItemStorage()Description copied from class:AbstractTileEntityRackScans through the whole storage and updates it.- Specified by:
updateItemStoragein classAbstractTileEntityRack
-
getOtherChest
Description copied from class:AbstractTileEntityRackGet the other double chest or null.- Specified by:
getOtherChestin classAbstractTileEntityRack- Returns:
- the tileEntity of the other half or null.
-
createInventory
public net.neoforged.neoforge.items.ItemStackHandler createInventory(int slots) Description copied from class:AbstractTileEntityRackCreate the inventory that belongs to the rack.- Specified by:
createInventoryin classAbstractTileEntityRack- Parameters:
slots- the number of slots.- Returns:
- the created inventory,
-
isEmpty
public boolean isEmpty()Description copied from class:AbstractTileEntityRackChecks if the chest is empty. This method checks the content list, it is therefore extremely fast.- Specified by:
isEmptyin classAbstractTileEntityRack- Returns:
- true if so.
-
loadAdditional
public void loadAdditional(net.minecraft.nbt.CompoundTag compound, @NotNull net.minecraft.core.HolderLookup.Provider provider) - Overrides:
loadAdditionalin classnet.minecraft.world.level.block.entity.BlockEntity
-
saveAdditional
public void saveAdditional(net.minecraft.nbt.CompoundTag compound, @NotNull net.minecraft.core.HolderLookup.Provider provider) - Overrides:
saveAdditionalin classnet.minecraft.world.level.block.entity.BlockEntity
-
getUpdatePacket
public net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket getUpdatePacket()- Overrides:
getUpdatePacketin classnet.minecraft.world.level.block.entity.BlockEntity
-
getUpdateTag
@NotNull public @NotNull net.minecraft.nbt.CompoundTag getUpdateTag(@NotNull net.minecraft.core.HolderLookup.Provider provider) - Overrides:
getUpdateTagin classnet.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:
onDataPacketin interfacenet.neoforged.neoforge.common.extensions.IBlockEntityExtension
-
handleUpdateTag
public void handleUpdateTag(net.minecraft.nbt.CompoundTag tag, @NotNull net.minecraft.core.HolderLookup.Provider provider) - Specified by:
handleUpdateTagin interfacenet.neoforged.neoforge.common.extensions.IBlockEntityExtension
-
getItemHandlerCap
@Nullable public net.neoforged.neoforge.items.IItemHandler getItemHandlerCap(net.minecraft.core.Direction direction) - Specified by:
getItemHandlerCapin interfaceIItemHandlerCapProvider- Returns:
- direction-aware itemHandler
-
getUpgradeSize
public int getUpgradeSize()Description copied from class:AbstractTileEntityRackGet the upgrade size.- Specified by:
getUpgradeSizein classAbstractTileEntityRack- Returns:
- the upgrade size.
-
setChanged
public void setChanged()- Overrides:
setChangedin classnet.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:
createMenuin interfacenet.minecraft.world.inventory.MenuConstructor
-
getDisplayName
@NotNull public @NotNull net.minecraft.network.chat.Component getDisplayName()- Specified by:
getDisplayNamein interfacenet.minecraft.world.MenuProvider
-
setRemoved
public void setRemoved()- Overrides:
setRemovedin classnet.minecraft.world.level.block.entity.BlockEntity
-
updateTextureDataWith
public void updateTextureDataWith(com.ldtteam.domumornamentum.client.model.data.MaterialTextureData materialTextureData) - Specified by:
updateTextureDataWithin interfacecom.ldtteam.domumornamentum.entity.block.IMateriallyTexturedBlockEntity
-
getModelData
@NotNull public @NotNull net.neoforged.neoforge.client.model.data.ModelData getModelData()- Specified by:
getModelDatain interfacenet.neoforged.neoforge.common.extensions.IBlockEntityExtension
-
getTextureData
@NotNull public @NotNull com.ldtteam.domumornamentum.client.model.data.MaterialTextureData getTextureData()- Specified by:
getTextureDatain interfacecom.ldtteam.domumornamentum.entity.block.IMateriallyTexturedBlockEntity
-
clearContent
public void clearContent()- Specified by:
clearContentin interfacenet.minecraft.world.Clearable
-