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,Tickable
- Direct Known Subclasses:
TrappedChestBlockEntity
@EnvironmentInterfaces(@EnvironmentInterface(value=CLIENT,itf=ChestAnimationProgress.class)) public class ChestBlockEntity extends LootableContainerBlockEntity implements ChestAnimationProgress, Tickable
-
Field Summary
Fields Modifier and Type Field Description protected floatanimationAngleprivate DefaultedList<ItemStack>inventoryprotected floatlastAnimationAngleprivate intticksOpenprotected intviewerCountFields 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 ChestBlockEntity()protectedChestBlockEntity(BlockEntityType<?> type) -
Method Summary
Modifier and Type Method Description static voidcopyInventory(ChestBlockEntity from, ChestBlockEntity to)static intcountViewers(World world, LockableContainerBlockEntity inventory, int x, int y, int z)protected ScreenHandlercreateScreenHandler(int syncId, PlayerInventory playerInventory)voidfromTag(BlockState state, CompoundTag tag)floatgetAnimationProgress(float tickDelta)protected TextgetContainerName()protected DefaultedList<ItemStack>getInvStackList()static intgetPlayersLookingInChestCount(BlockView world, BlockPos pos)voidonClose(PlayerEntity player)protected voidonInvOpenOrClose()voidonOpen(PlayerEntity player)booleanonSyncedBlockEvent(int type, int data)private voidplaySound(SoundEvent soundEvent)protected voidsetInvStackList(DefaultedList<ItemStack> list)intsize()voidtick()static inttickViewerCount(World world, LockableContainerBlockEntity inventory, int ticksOpen, int x, int y, int z, int viewerCount)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
applyMirror, applyRotation, cancelRemoval, copyItemDataRequiresOperator, createFromTag, getCachedState, getPos, getRenderDistance, getType, getWorld, hasWorld, isRemoved, markDirty, markInvalid, markRemoved, populateCrashReport, resetBlock, setLocation, setPos, 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
-
animationAngle
protected float animationAngle -
lastAnimationAngle
protected float lastAnimationAngle -
viewerCount
protected int viewerCount -
ticksOpen
private int ticksOpen
-
-
Constructor Details
-
ChestBlockEntity
-
ChestBlockEntity
public ChestBlockEntity()
-
-
Method Details
-
size
public int size() -
getContainerName
- Specified by:
getContainerNamein classLockableContainerBlockEntity
-
fromTag
- Overrides:
fromTagin classLockableContainerBlockEntity
-
toTag
- Overrides:
toTagin classLockableContainerBlockEntity
-
tick
public void tick() -
tickViewerCount
public static int tickViewerCount(World world, LockableContainerBlockEntity inventory, int ticksOpen, int x, int y, int z, int viewerCount) -
countViewers
public static int countViewers(World world, LockableContainerBlockEntity inventory, int x, int y, int z) -
playSound
-
onSyncedBlockEvent
public boolean onSyncedBlockEvent(int type, int data)- Overrides:
onSyncedBlockEventin classBlockEntity
-
onOpen
-
onClose
-
onInvOpenOrClose
protected void onInvOpenOrClose() -
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
-