Package net.minecraft.block.entity
Class ChestBlockEntity
java.lang.Object
net.minecraft.block.entity.BlockEntity
net.minecraft.block.entity.LockableContainerBlockEntity
net.minecraft.block.entity.LootableContainerBlockEntity
net.minecraft.block.entity.ChestBlockEntity
- All Implemented Interfaces:
ChestAnimationProgress,Inventory,NamedScreenHandlerFactory,ScreenHandlerFactory,Clearable,Nameable
- Direct Known Subclasses:
TrappedChestBlockEntity
@EnvironmentInterfaces(@EnvironmentInterface(value=CLIENT,itf=ChestAnimationProgress.class)) public class ChestBlockEntity extends LootableContainerBlockEntity implements ChestAnimationProgress
-
Field Summary
Fields Modifier and Type Field Description private DefaultedList<ItemStack>inventoryprivate ChestLidAnimatorlidAnimatorprivate ChestStateManagerstateManagerFields inherited from class net.minecraft.block.entity.LootableContainerBlockEntity
lootTableId, lootTableSeedFields inherited from class net.minecraft.block.entity.BlockEntity
pos, removed, world -
Constructor Summary
Constructors Modifier Constructor Description protectedChestBlockEntity(BlockEntityType<?> blockEntityType, BlockPos blockPos, BlockState blockState)ChestBlockEntity(BlockPos pos, BlockState state) -
Method Summary
Modifier and Type Method Description static voidclientTick(World world, BlockPos pos, BlockState state, ChestBlockEntity blockEntity)static voidcopyInventory(ChestBlockEntity from, ChestBlockEntity to)protected ScreenHandlercreateScreenHandler(int syncId, PlayerInventory playerInventory)voidfromTag(CompoundTag tag)floatgetAnimationProgress(float tickDelta)protected TextgetContainerName()protected DefaultedList<ItemStack>getInvStackList()static intgetPlayersLookingInChestCount(BlockView world, BlockPos pos)voidonClose(PlayerEntity player)protected voidonInvOpenOrClose(World world, BlockPos pos, BlockState state, int oldViewerCount, int newViewerCount)voidonOpen(PlayerEntity player)voidonScheduledTick()booleanonSyncedBlockEvent(int type, int data)private static voidplaySound(World world, BlockPos pos, BlockState state, SoundEvent soundEvent)protected voidsetInvStackList(DefaultedList<ItemStack> list)intsize()CompoundTagtoTag(CompoundTag tag)Methods inherited from class net.minecraft.block.entity.LootableContainerBlockEntity
canPlayerUse, checkLootInteraction, checkUnlocked, clear, createMenu, deserializeLootTable, getStack, isEmpty, removeStack, removeStack, serializeLootTable, setLootTable, setLootTable, setStackMethods inherited from class net.minecraft.block.entity.LockableContainerBlockEntity
checkUnlocked, getCustomName, getDisplayName, getName, setCustomNameMethods inherited from class net.minecraft.block.entity.BlockEntity
cancelRemoval, copyItemDataRequiresOperator, createFromTag, getCachedState, getPos, getSquaredRenderDistance, getType, getWorld, hasWorld, isRemoved, markDirty, markDirty, markRemoved, 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, markDirtyMethods inherited from interface net.minecraft.util.Nameable
hasCustomName
-
Field Details
-
inventory
-
stateManager
-
lidAnimator
-
-
Constructor Details
-
ChestBlockEntity
protected ChestBlockEntity(BlockEntityType<?> blockEntityType, BlockPos blockPos, BlockState blockState) -
ChestBlockEntity
-
-
Method Details
-
size
public int size() -
getContainerName
- Specified by:
getContainerNamein classLockableContainerBlockEntity
-
fromTag
- Overrides:
fromTagin classLockableContainerBlockEntity
-
toTag
- Overrides:
toTagin classLockableContainerBlockEntity
-
clientTick
public static void clientTick(World world, BlockPos pos, BlockState state, ChestBlockEntity blockEntity) -
playSound
-
onSyncedBlockEvent
public boolean onSyncedBlockEvent(int type, int data)- Overrides:
onSyncedBlockEventin classBlockEntity
-
onOpen
-
onClose
-
getInvStackList
- Specified by:
getInvStackListin classLootableContainerBlockEntity
-
setInvStackList
- Specified by:
setInvStackListin classLootableContainerBlockEntity
-
getAnimationProgress
@Environment(CLIENT) public float getAnimationProgress(float tickDelta)- Specified by:
getAnimationProgressin interfaceChestAnimationProgress
-
getPlayersLookingInChestCount
-
copyInventory
-
createScreenHandler
- Specified by:
createScreenHandlerin classLockableContainerBlockEntity
-
onScheduledTick
public void onScheduledTick() -
onInvOpenOrClose
protected void onInvOpenOrClose(World world, BlockPos pos, BlockState state, int oldViewerCount, int newViewerCount)
-