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:
Clearable,Container,MenuConstructor,MenuProvider,Nameable,IAttachmentHolder,IMenuProviderExtension,IBlockEntityExtension
- 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, BlockEntity.DataComponentInputNested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
AttachmentHolder.AsField -
Field Summary
FieldsFields 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
ConstructorsModifierConstructorDescriptionprotectedBaseContainerBlockEntity(BlockEntityType<?> pType, BlockPos pPos, BlockState pBlockState) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapplyImplicitComponents(BlockEntity.DataComponentInput pComponentInput) booleanstatic booleanvoidprotected voidcollectImplicitComponents(DataComponentMap.Builder pComponents) protected abstract AbstractContainerMenucreateMenu(int pContainerId, Inventory pInventory) createMenu(int pContainerId, Inventory pPlayerInventory, Player pPlayer) protected abstract ComponentgetItem(int pSlot) Returns the stack in the given slot.protected abstract NonNullList<ItemStack> getItems()getName()booleanisEmpty()protected voidloadAdditional(CompoundTag pTag, HolderLookup.Provider pRegistries) voidremoveItem(int pSlot, int pAmount) Removes up to a specified number of items from an inventory slot and returns them in a new stack.removeItemNoUpdate(int pSlot) Removes a stack from the given slot and returns it.protected voidsaveAdditional(CompoundTag pTag, HolderLookup.Provider pRegistries) voidSets the given item stack to the specified slot in the inventory (can be crafting or armor sections).protected abstract voidsetItems(NonNullList<ItemStack> pItems) booleanstillValid(Player pPlayer) 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, onlyOpCanSetNbt, parseCustomNameSafe, removeData, saveCustomAndMetadata, saveCustomOnly, saveToItem, saveWithFullMetadata, saveWithId, 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, getContainerSize, getMaxStackSize, getMaxStackSize, hasAnyMatching, hasAnyOf, setChanged, startOpen, stopOpenMethods 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, hasCustomOutlineRendering, invalidateCapabilities, onChunkUnloaded, onDataPacket, onLoad, requestModelDataUpdateMethods inherited from interface net.neoforged.neoforge.client.extensions.IMenuProviderExtension
shouldTriggerClientSideContainerClosingOnOpen, writeClientSideDataMethods inherited from interface net.minecraft.world.Nameable
hasCustomName
-
Field Details
-
lockKey
-
name
-
-
Constructor Details
-
BaseContainerBlockEntity
-
-
Method Details
-
loadAdditional
- Overrides:
loadAdditionalin classBlockEntity
-
saveAdditional
- Overrides:
saveAdditionalin classBlockEntity
-
getName
-
getDisplayName
- Specified by:
getDisplayNamein interfaceMenuProvider- Specified by:
getDisplayNamein interfaceNameable
-
getCustomName
- Specified by:
getCustomNamein interfaceNameable
-
getDefaultName
-
canOpen
-
canUnlock
-
getItems
-
setItems
-
isEmpty
public boolean isEmpty() -
getItem
Returns the stack in the given slot. -
removeItem
Removes up to a specified number of items from an inventory slot and returns them in a new stack.- Specified by:
removeItemin interfaceContainer
-
removeItemNoUpdate
Removes a stack from the given slot and returns it.- Specified by:
removeItemNoUpdatein interfaceContainer
-
setItem
Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). -
stillValid
Don't rename this method to canInteractWith due to conflicts with Container- Specified by:
stillValidin interfaceContainer
-
clearContent
public void clearContent()- Specified by:
clearContentin interfaceClearable
-
createMenu
@Nullable public AbstractContainerMenu createMenu(int pContainerId, Inventory pPlayerInventory, Player pPlayer) - Specified by:
createMenuin interfaceMenuConstructor
-
createMenu
-
applyImplicitComponents
- Overrides:
applyImplicitComponentsin classBlockEntity
-
collectImplicitComponents
- Overrides:
collectImplicitComponentsin classBlockEntity
-
removeComponentsFromTag
- Overrides:
removeComponentsFromTagin classBlockEntity
-