Class AbstractInventoryBlockEntity
java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.level.block.entity.BlockEntity
tech.anonymoushacker1279.immersiveweapons.blockentity.AbstractInventoryBlockEntity
- All Implemented Interfaces:
Iterable<net.minecraft.world.item.ItemStack>,net.minecraft.world.Clearable,net.minecraft.world.Container,net.minecraft.world.level.block.EntityBlock,net.neoforged.neoforge.attachment.IAttachmentHolder,net.neoforged.neoforge.common.extensions.IBlockEntityExtension
- Direct Known Subclasses:
AstralCrystalBlockEntity,CommanderPedestalBlockEntity,ShelfBlockEntity
public abstract class AbstractInventoryBlockEntity
extends net.minecraft.world.level.block.entity.BlockEntity
implements net.minecraft.world.level.block.EntityBlock, net.minecraft.world.Container
-
Nested Class Summary
Nested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
net.neoforged.neoforge.attachment.AttachmentHolder.AsFieldNested classes/interfaces inherited from interface net.minecraft.world.Container
net.minecraft.world.Container.ContainerIterator -
Field Summary
Fields inherited from class net.minecraft.world.level.block.entity.BlockEntity
level, remove, worldPositionFields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
ATTACHMENTS_NBT_KEYFields inherited from interface net.minecraft.world.Container
DEFAULT_DISTANCE_BUFFER -
Constructor Summary
ConstructorsConstructorDescriptionAbstractInventoryBlockEntity(net.minecraft.world.level.block.entity.BlockEntityType<?> type, net.minecraft.core.BlockPos blockPos, net.minecraft.world.level.block.state.BlockState blockState) Constructor for AbstractInventoryBlockEntity. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddItem(net.minecraft.world.item.ItemStack itemStack) Add an item to the inventory.voidClear the inventory.intintnet.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> Get the inventory.net.minecraft.world.item.ItemStackgetItem(int slot) net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacketGet the entity update packet.net.minecraft.nbt.CompoundTaggetUpdateTag(net.minecraft.core.HolderLookup.Provider provider) voidSet the change state.booleanisEmpty()protected voidloadAdditional(net.minecraft.world.level.storage.ValueInput valueInput) voidpreRemoveSideEffects(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) voidRemove an item from the inventory.net.minecraft.world.item.ItemStackremoveItem(int slot, int amount) net.minecraft.world.item.ItemStackremoveItemNoUpdate(int slot) protected voidsaveAdditional(net.minecraft.world.level.storage.ValueOutput valueOutput) voidsetItem(int slot, net.minecraft.world.item.ItemStack stack) booleanstillValid(net.minecraft.world.entity.player.Player player) Methods inherited from class net.minecraft.world.level.block.entity.BlockEntity
addEntityType, applyComponents, applyComponentsFromItemStack, applyImplicitComponents, clearRemoved, collectComponents, collectImplicitComponents, components, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getNameForReporting, getPersistentData, getPosFromTag, getType, hasLevel, isRemoved, isValidBlockState, loadCustomOnly, loadStatic, loadWithComponents, parseCustomNameSafe, problemPath, removeComponentsFromTag, removeData, saveCustomOnly, saveCustomOnly, saveWithFullMetadata, saveWithFullMetadata, saveWithId, saveWithoutMetadata, saveWithoutMetadata, setBlockState, setChanged, setChanged, setComponents, setData, setLevel, setRemoved, syncData, triggerEventMethods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
deserializeAttachments, getData, getExistingDataOrNull, hasAttachments, hasData, serializeAttachmentsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.world.Container
canPlaceItem, canTakeItem, countItem, getMaxStackSize, getMaxStackSize, hasAnyMatching, hasAnyOf, iterator, setChanged, startOpen, stopOpenMethods inherited from interface net.minecraft.world.level.block.EntityBlock
getListener, getTicker, newBlockEntityMethods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData, syncDataMethods inherited from interface net.neoforged.neoforge.common.extensions.IBlockEntityExtension
getModelData, handleUpdateTag, invalidateCapabilities, onChunkUnloaded, onDataPacket, onLoad, requestModelDataUpdateMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
AbstractInventoryBlockEntity
public AbstractInventoryBlockEntity(net.minecraft.world.level.block.entity.BlockEntityType<?> type, net.minecraft.core.BlockPos blockPos, net.minecraft.world.level.block.state.BlockState blockState) Constructor for AbstractInventoryBlockEntity.
-
-
Method Details
-
getContainerSize
public int getContainerSize()- Specified by:
getContainerSizein interfacenet.minecraft.world.Container
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfacenet.minecraft.world.Container
-
getItem
public net.minecraft.world.item.ItemStack getItem(int slot) - Specified by:
getItemin interfacenet.minecraft.world.Container
-
getFilledSlots
public int getFilledSlots() -
setItem
public void setItem(int slot, net.minecraft.world.item.ItemStack stack) - Specified by:
setItemin interfacenet.minecraft.world.Container
-
stillValid
public boolean stillValid(net.minecraft.world.entity.player.Player player) - Specified by:
stillValidin interfacenet.minecraft.world.Container
-
addItem
public boolean addItem(net.minecraft.world.item.ItemStack itemStack) Add an item to the inventory.- Parameters:
itemStack- theItemStackto add- Returns:
- boolean
-
removeItem
public net.minecraft.world.item.ItemStack removeItem(int slot, int amount) - Specified by:
removeItemin interfacenet.minecraft.world.Container
-
removeItemNoUpdate
public net.minecraft.world.item.ItemStack removeItemNoUpdate(int slot) - Specified by:
removeItemNoUpdatein interfacenet.minecraft.world.Container
-
removeItem
public void removeItem()Remove an item from the inventory. -
inventoryChanged
public void inventoryChanged()Set the change state. -
getInventory
public net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> getInventory()Get the inventory.- Returns:
- NonNullList extending ItemStack
-
loadAdditional
protected void loadAdditional(net.minecraft.world.level.storage.ValueInput valueInput) - Overrides:
loadAdditionalin classnet.minecraft.world.level.block.entity.BlockEntity
-
saveAdditional
protected void saveAdditional(net.minecraft.world.level.storage.ValueOutput valueOutput) - Overrides:
saveAdditionalin classnet.minecraft.world.level.block.entity.BlockEntity
-
getUpdatePacket
public net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket getUpdatePacket()Get the entity update packet.- Overrides:
getUpdatePacketin classnet.minecraft.world.level.block.entity.BlockEntity- Returns:
- ClientboundBlockEntityDataPacket
-
getUpdateTag
public net.minecraft.nbt.CompoundTag getUpdateTag(net.minecraft.core.HolderLookup.Provider provider) - Overrides:
getUpdateTagin classnet.minecraft.world.level.block.entity.BlockEntity
-
clearContent
public void clearContent()Clear the inventory.- Specified by:
clearContentin interfacenet.minecraft.world.Clearable
-
preRemoveSideEffects
public void preRemoveSideEffects(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) - Overrides:
preRemoveSideEffectsin classnet.minecraft.world.level.block.entity.BlockEntity
-