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>
inventory
private ChestLidAnimator
lidAnimator
private ChestStateManager
stateManager
Fields inherited from class net.minecraft.block.entity.LootableContainerBlockEntity
lootTableId, lootTableSeed
Fields inherited from class net.minecraft.block.entity.BlockEntity
pos, removed, world
-
Constructor Summary
Constructors Modifier Constructor Description protected
ChestBlockEntity(BlockEntityType<?> blockEntityType, BlockPos blockPos, BlockState blockState)
ChestBlockEntity(BlockPos pos, BlockState state)
-
Method Summary
Modifier and Type Method Description static void
clientTick(World world, BlockPos pos, BlockState state, ChestBlockEntity blockEntity)
static void
copyInventory(ChestBlockEntity from, ChestBlockEntity to)
protected ScreenHandler
createScreenHandler(int syncId, PlayerInventory playerInventory)
void
fromTag(CompoundTag tag)
float
getAnimationProgress(float tickDelta)
protected Text
getContainerName()
protected DefaultedList<ItemStack>
getInvStackList()
static int
getPlayersLookingInChestCount(BlockView world, BlockPos pos)
void
onClose(PlayerEntity player)
protected void
onInvOpenOrClose(World world, BlockPos pos, BlockState state, int oldViewerCount, int newViewerCount)
void
onOpen(PlayerEntity player)
void
onScheduledTick()
boolean
onSyncedBlockEvent(int type, int data)
private static void
playSound(World world, BlockPos pos, BlockState state, SoundEvent soundEvent)
protected void
setInvStackList(DefaultedList<ItemStack> list)
int
size()
CompoundTag
toTag(CompoundTag tag)
Methods inherited from class net.minecraft.block.entity.LootableContainerBlockEntity
canPlayerUse, checkLootInteraction, checkUnlocked, clear, createMenu, deserializeLootTable, getStack, isEmpty, removeStack, removeStack, serializeLootTable, setLootTable, setLootTable, setStack
Methods inherited from class net.minecraft.block.entity.LockableContainerBlockEntity
checkUnlocked, getCustomName, getDisplayName, getName, setCustomName
Methods 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, toUpdatePacket
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.inventory.Inventory
containsAny, count, getMaxCountPerStack, isValid, markDirty
Methods 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:
getContainerName
in classLockableContainerBlockEntity
-
fromTag
- Overrides:
fromTag
in classLockableContainerBlockEntity
-
toTag
- Overrides:
toTag
in classLockableContainerBlockEntity
-
clientTick
public static void clientTick(World world, BlockPos pos, BlockState state, ChestBlockEntity blockEntity) -
playSound
-
onSyncedBlockEvent
public boolean onSyncedBlockEvent(int type, int data)- Overrides:
onSyncedBlockEvent
in classBlockEntity
-
onOpen
-
onClose
-
getInvStackList
- Specified by:
getInvStackList
in classLootableContainerBlockEntity
-
setInvStackList
- Specified by:
setInvStackList
in classLootableContainerBlockEntity
-
getAnimationProgress
@Environment(CLIENT) public float getAnimationProgress(float tickDelta)- Specified by:
getAnimationProgress
in interfaceChestAnimationProgress
-
getPlayersLookingInChestCount
-
copyInventory
-
createScreenHandler
- Specified by:
createScreenHandler
in classLockableContainerBlockEntity
-
onScheduledTick
public void onScheduledTick() -
onInvOpenOrClose
protected void onInvOpenOrClose(World world, BlockPos pos, BlockState state, int oldViewerCount, int newViewerCount)
-