Package net.minecraft.block.entity
Class LootableContainerBlockEntity
java.lang.Object
net.minecraft.block.entity.BlockEntity
net.minecraft.block.entity.LockableContainerBlockEntity
net.minecraft.block.entity.LootableContainerBlockEntity
- All Implemented Interfaces:
Inventory,NamedScreenHandlerFactory,ScreenHandlerFactory,Clearable,Nameable
- Direct Known Subclasses:
BarrelBlockEntity,ChestBlockEntity,DispenserBlockEntity,HopperBlockEntity,ShulkerBoxBlockEntity
public abstract class LootableContainerBlockEntity extends LockableContainerBlockEntity
-
Field Summary
Fields Modifier and Type Field Description protected IdentifierlootTableIdprotected longlootTableSeedFields inherited from class net.minecraft.block.entity.BlockEntity
pos, removed, world -
Constructor Summary
Constructors Modifier Constructor Description protectedLootableContainerBlockEntity(BlockEntityType<?> blockEntityType, BlockPos blockPos, BlockState blockState) -
Method Summary
Modifier and Type Method Description booleancanPlayerUse(PlayerEntity player)voidcheckLootInteraction(PlayerEntity player)booleancheckUnlocked(PlayerEntity player)voidclear()ScreenHandlercreateMenu(int syncId, PlayerInventory inv, PlayerEntity player)protected booleandeserializeLootTable(CompoundTag compoundTag)protected abstract DefaultedList<ItemStack>getInvStackList()ItemStackgetStack(int slot)Fetches the stack currently stored at the given slot.booleanisEmpty()ItemStackremoveStack(int slot)Removes the stack currently stored at the indicated slot.ItemStackremoveStack(int slot, int amount)Removes a specific number of items from the given slot.protected booleanserializeLootTable(CompoundTag compoundTag)protected abstract voidsetInvStackList(DefaultedList<ItemStack> list)voidsetLootTable(Identifier id, long seed)static voidsetLootTable(BlockView world, Random random, BlockPos pos, Identifier id)voidsetStack(int slot, ItemStack stack)Methods inherited from class net.minecraft.block.entity.LockableContainerBlockEntity
checkUnlocked, createScreenHandler, fromTag, getContainerName, getCustomName, getDisplayName, getName, setCustomName, toTagMethods inherited from class net.minecraft.block.entity.BlockEntity
cancelRemoval, copyItemDataRequiresOperator, createFromTag, getCachedState, getPos, getSquaredRenderDistance, getType, getWorld, hasWorld, isRemoved, markDirty, markDirty, markRemoved, onSyncedBlockEvent, populateCrashReport, setCachedState, setWorld, toInitialChunkDataTag, toUpdatePacketMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.inventory.Inventory
containsAny, count, getMaxCountPerStack, isValid, markDirty, onClose, onOpen, sizeMethods inherited from interface net.minecraft.util.Nameable
hasCustomName
-
Field Details
-
lootTableId
-
lootTableSeed
protected long lootTableSeed
-
-
Constructor Details
-
LootableContainerBlockEntity
protected LootableContainerBlockEntity(BlockEntityType<?> blockEntityType, BlockPos blockPos, BlockState blockState)
-
-
Method Details
-
setLootTable
-
deserializeLootTable
-
serializeLootTable
-
checkLootInteraction
-
setLootTable
-
isEmpty
public boolean isEmpty() -
getStack
Fetches the stack currently stored at the given slot. If the slot is empty, or is outside the bounds of this inventory, returns seeItemStack.EMPTY. -
removeStack
Removes a specific number of items from the given slot.- Returns:
- the removed items as a stack
-
removeStack
Removes the stack currently stored at the indicated slot.- Returns:
- the stack previously stored at the indicated slot.
-
setStack
-
canPlayerUse
-
clear
public void clear() -
getInvStackList
-
setInvStackList
-
checkUnlocked
- Overrides:
checkUnlockedin classLockableContainerBlockEntity
-
createMenu
- Specified by:
createMenuin interfaceScreenHandlerFactory- Overrides:
createMenuin classLockableContainerBlockEntity
-