Class RandomizableContainerBlockEntity
java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.level.block.entity.BlockEntity
net.minecraft.world.level.block.entity.BaseContainerBlockEntity
net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity
- All Implemented Interfaces:
Iterable<ItemStack>, TypedInstance<BlockEntityType<?>>, DebugValueSource, Clearable, Container, SlotProvider, MenuConstructor, MenuProvider, Nameable, RandomizableContainer, IAttachmentHolder, ContainerExtension, IBlockEntityExtension, IMenuProviderExtension
- Direct Known Subclasses:
BarrelBlockEntity, ChestBlockEntity, CrafterBlockEntity, DispenserBlockEntity, HopperBlockEntity, ShulkerBoxBlockEntity
public abstract class RandomizableContainerBlockEntity
extends BaseContainerBlockEntity
implements RandomizableContainer
-
Nested Class Summary
Nested classes/interfaces inherited from class AttachmentHolder
AttachmentHolder.AsFieldNested classes/interfaces inherited from interface Container
Container.ContainerIteratorNested classes/interfaces inherited from interface DebugValueSource
DebugValueSource.Registration, DebugValueSource.ValueGetter<T> -
Field Summary
FieldsFields inherited from class BlockEntity
level, remove, worldPositionFields inherited from class AttachmentHolder
ATTACHMENTS_NBT_KEYFields inherited from interface Container
DEFAULT_DISTANCE_BUFFERFields inherited from interface RandomizableContainer
LOOT_TABLE_SEED_TAG, LOOT_TABLE_TAG -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRandomizableContainerBlockEntity(BlockEntityType<?> type, BlockPos worldPosition, BlockState blockState) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapplyImplicitComponents(DataComponentGetter components) booleanprotected voidcollectImplicitComponents(DataComponentMap.Builder components) @Nullable AbstractContainerMenucreateMenu(int containerId, Inventory inventory, Player player) getItem(int slot) Returns the stack in the given slot.@Nullable ResourceKey<LootTable> longbooleanisEmpty()voidremoveComponentsFromTag(ValueOutput output) removeItem(int slot, int count) Removes up to a specified number of items from an inventory slot and returns them in a new stack.removeItemNoUpdate(int slot) Removes a stack from the given slot and returns it.voidSets the given item stack to the specified slot in the inventory (can be crafting or armor sections).voidsetLootTable(@Nullable ResourceKey<LootTable> lootTable) voidsetLootTableSeed(long lootTableSeed) Methods inherited from class BaseContainerBlockEntity
clearContent, createMenu, getCustomName, getDefaultName, getDisplayName, getItems, getName, isLocked, loadAdditional, saveAdditional, sendChestLockedNotifications, setItem, setItems, stillValidMethods inherited from class BlockEntity
addEntityType, applyComponents, applyComponentsFromItemStack, clearRemoved, collectComponents, components, fillCrashReportCategory, getAndClearAttachmentTypesToSync, getBlockPos, getBlockState, getLevel, getNameForReporting, getPersistentData, getPosFromTag, getType, getUpdatePacket, getUpdateTag, hasLevel, isRemoved, isValidBlockState, loadCustomOnly, loadStatic, loadWithComponents, parseCustomNameSafe, preRemoveSideEffects, problemPath, registerDebugValues, removeData, saveCustomOnly, saveCustomOnly, saveWithFullMetadata, saveWithFullMetadata, saveWithId, saveWithoutMetadata, saveWithoutMetadata, setBlockState, setChanged, setChanged, setComponents, setData, setLevel, setRemoved, syncData, triggerEvent, typeHolderMethods inherited from class AttachmentHolder
deserializeAttachments, getData, getExistingDataOrNull, hasAttachments, hasData, serializeAttachmentsMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Clearable
clearContentMethods inherited from interface Container
canPlaceItem, canTakeItem, countItem, getContainerSize, getEntitiesWithContainerOpen, getMaxStackSize, getMaxStackSize, getSlot, hasAnyMatching, hasAnyOf, iterator, setChanged, startOpen, stillValid, stopOpenMethods inherited from interface ContainerExtension
onTransfer, setItemMethods inherited from interface IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData, syncDataMethods inherited from interface IBlockEntityExtension
getModelData, handleUpdateTag, hasCustomOutlineRendering, invalidateCapabilities, onChunkUnloaded, onDataPacket, onLoad, requestModelDataUpdateMethods inherited from interface IMenuProviderExtension
shouldTriggerClientSideContainerClosingOnOpen, writeClientSideDataMethods inherited from interface Iterable
forEach, spliteratorMethods inherited from interface Nameable
getPlainTextName, hasCustomNameMethods inherited from interface RandomizableContainer
getBlockPos, getLevel, setLootTable, tryLoadLootTable, trySaveLootTable, unpackLootTableMethods inherited from interface SlotProvider
getSlotsFromRange
-
Field Details
-
lootTable
-
lootTableSeed
protected long lootTableSeed
-
-
Constructor Details
-
RandomizableContainerBlockEntity
protected RandomizableContainerBlockEntity(BlockEntityType<?> type, BlockPos worldPosition, BlockState blockState)
-
-
Method Details
-
getLootTable
- Specified by:
getLootTablein interfaceRandomizableContainer
-
setLootTable
- Specified by:
setLootTablein interfaceRandomizableContainer
-
getLootTableSeed
public long getLootTableSeed()- Specified by:
getLootTableSeedin interfaceRandomizableContainer
-
setLootTableSeed
public void setLootTableSeed(long lootTableSeed) - Specified by:
setLootTableSeedin interfaceRandomizableContainer
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceContainer- Overrides:
isEmptyin classBaseContainerBlockEntity
-
getItem
-
removeItem
Description copied from interface:ContainerRemoves up to a specified number of items from an inventory slot and returns them in a new stack.- Specified by:
removeItemin interfaceContainer- Overrides:
removeItemin classBaseContainerBlockEntity
-
removeItemNoUpdate
Description copied from interface:ContainerRemoves a stack from the given slot and returns it.- Specified by:
removeItemNoUpdatein interfaceContainer- Overrides:
removeItemNoUpdatein classBaseContainerBlockEntity
-
setItem
-
canOpen
- Overrides:
canOpenin classBaseContainerBlockEntity
-
createMenu
public @Nullable AbstractContainerMenu createMenu(int containerId, Inventory inventory, Player player) - Specified by:
createMenuin interfaceMenuConstructor- Overrides:
createMenuin classBaseContainerBlockEntity
-
applyImplicitComponents
- Overrides:
applyImplicitComponentsin classBaseContainerBlockEntity
-
collectImplicitComponents
- Overrides:
collectImplicitComponentsin classBaseContainerBlockEntity
-
removeComponentsFromTag
- Overrides:
removeComponentsFromTagin classBaseContainerBlockEntity
-