Class BaseContainerBlockEntity
java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.level.block.entity.BlockEntity
net.minecraft.world.level.block.entity.BaseContainerBlockEntity
- All Implemented Interfaces:
Iterable<ItemStack>
,Clearable
,Container
,MenuConstructor
,MenuProvider
,Nameable
,IAttachmentHolder
,IBlockEntityExtension
,IMenuProviderExtension
- Direct Known Subclasses:
AbstractFurnaceBlockEntity
,BrewingStandBlockEntity
,RandomizableContainerBlockEntity
public abstract class BaseContainerBlockEntity
extends BlockEntity
implements Container, MenuProvider, Nameable
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.level.block.entity.BlockEntity
BlockEntity.ComponentHelper
Nested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
AttachmentHolder.AsField
Nested classes/interfaces inherited from interface net.minecraft.world.Container
Container.ContainerIterator
-
Field Summary
FieldsFields 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
Fields inherited from interface net.minecraft.world.Container
DEFAULT_DISTANCE_BUFFER
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
BaseContainerBlockEntity
(BlockEntityType<?> p_155076_, BlockPos p_155077_, BlockState p_155078_) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
applyImplicitComponents
(DataComponentGetter p_397486_) boolean
static boolean
void
protected void
protected abstract AbstractContainerMenu
createMenu
(int pContainerId, Inventory pInventory) createMenu
(int pContainerId, Inventory pInventory, Player p_58643_) protected abstract Component
getItem
(int p_332727_) Returns the stack in the given slot.protected abstract NonNullList
<ItemStack> getItems()
getName()
boolean
isEmpty()
protected void
loadAdditional
(CompoundTag p_338606_, HolderLookup.Provider p_338309_) void
removeComponentsFromTag
(CompoundTag p_330762_) removeItem
(int p_332707_, int p_332672_) Removes up to a specified number of items from an inventory slot and returns them in a new stack.removeItemNoUpdate
(int p_332812_) Removes a stack from the given slot and returns it.protected void
saveAdditional
(CompoundTag p_187461_, HolderLookup.Provider p_324280_) void
Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).protected abstract void
setItems
(NonNullList<ItemStack> pItems) boolean
stillValid
(Player p_332791_) Don't rename this method to canInteractWith due to conflicts with ContainerMethods inherited from class net.minecraft.world.level.block.entity.BlockEntity
addEntityType, applyComponents, applyComponentsFromItemStack, clearRemoved, collectComponents, components, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getPersistentData, getPosFromTag, getType, getUpdatePacket, getUpdateTag, hasLevel, isRemoved, isValidBlockState, loadCustomOnly, loadStatic, loadWithComponents, parseCustomNameSafe, preRemoveSideEffects, removeData, saveCustomAndMetadata, saveCustomOnly, saveWithFullMetadata, saveWithId, saveWithoutMetadata, setBlockState, setChanged, setChanged, setComponents, setData, setLevel, setRemoved, triggerEvent
Methods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
deserializeAttachments, getData, getExistingDataOrNull, 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.minecraft.world.Container
canPlaceItem, canTakeItem, countItem, getContainerSize, getMaxStackSize, getMaxStackSize, hasAnyMatching, hasAnyOf, iterator, setChanged, startOpen, stopOpen
Methods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData
Methods inherited from interface net.neoforged.neoforge.common.extensions.IBlockEntityExtension
getModelData, handleUpdateTag, invalidateCapabilities, onChunkUnloaded, onDataPacket, onLoad, requestModelDataUpdate
Methods inherited from interface net.neoforged.neoforge.common.extensions.IMenuProviderExtension
shouldTriggerClientSideContainerClosingOnOpen, writeClientSideData
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface net.minecraft.world.Nameable
hasCustomName
-
Field Details
-
lockKey
-
name
-
-
Constructor Details
-
BaseContainerBlockEntity
protected BaseContainerBlockEntity(BlockEntityType<?> p_155076_, BlockPos p_155077_, BlockState p_155078_)
-
-
Method Details
-
loadAdditional
- Overrides:
loadAdditional
in classBlockEntity
-
saveAdditional
- Overrides:
saveAdditional
in classBlockEntity
-
getName
-
getDisplayName
- Specified by:
getDisplayName
in interfaceMenuProvider
- Specified by:
getDisplayName
in interfaceNameable
-
getCustomName
- Specified by:
getCustomName
in interfaceNameable
-
getDefaultName
-
canOpen
-
canUnlock
-
getItems
-
setItems
-
isEmpty
public boolean isEmpty() -
getItem
Description copied from interface:Container
Returns the stack in the given slot. -
removeItem
Description copied from interface:Container
Removes up to a specified number of items from an inventory slot and returns them in a new stack.- Specified by:
removeItem
in interfaceContainer
-
removeItemNoUpdate
Description copied from interface:Container
Removes a stack from the given slot and returns it.- Specified by:
removeItemNoUpdate
in interfaceContainer
-
setItem
Description copied from interface:Container
Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). -
stillValid
Description copied from interface:Container
Don't rename this method to canInteractWith due to conflicts with Container- Specified by:
stillValid
in interfaceContainer
-
clearContent
public void clearContent()- Specified by:
clearContent
in interfaceClearable
-
createMenu
@Nullable public AbstractContainerMenu createMenu(int pContainerId, Inventory pInventory, Player p_58643_) - Specified by:
createMenu
in interfaceMenuConstructor
-
createMenu
-
applyImplicitComponents
- Overrides:
applyImplicitComponents
in classBlockEntity
-
collectImplicitComponents
- Overrides:
collectImplicitComponents
in classBlockEntity
-
removeComponentsFromTag
- Overrides:
removeComponentsFromTag
in classBlockEntity
-