Class ChestBlockEntity
- All Implemented Interfaces:
LidOpenable
,Inventory
,LootableInventory
,NamedScreenHandlerFactory
,ScreenHandlerFactory
,Clearable
,Nameable
- Direct Known Subclasses:
TrappedChestBlockEntity
- Mappings:
Namespace Name official dhc
intermediary net/minecraft/class_2595
named net/minecraft/block/entity/ChestBlockEntity
-
Field Summary
Modifier and TypeFieldDescriptionprivate DefaultedList<ItemStack>
private final ChestLidAnimator
private final ViewerCountManager
private static final int
Fields inherited from class net.minecraft.block.entity.LootableContainerBlockEntity
lootTableId, lootTableSeed
Fields inherited from class net.minecraft.block.entity.BlockEntity
pos, removed, world
Fields inherited from interface net.minecraft.inventory.Inventory
field_42619, MAX_COUNT_PER_STACK
Fields inherited from interface net.minecraft.inventory.LootableInventory
LOOT_TABLE_KEY, LOOT_TABLE_SEED_KEY
-
Constructor Summary
ModifierConstructorDescriptionprotected
ChestBlockEntity
(BlockEntityType<?> type, BlockPos pos, BlockState state) ChestBlockEntity
(BlockPos pos, BlockState state) -
Method Summary
Modifier and TypeMethodDescriptionstatic void
clientTick
(World world, BlockPos pos, BlockState state, ChestBlockEntity blockEntity) static void
copyInventory
(ChestBlockEntity from, ChestBlockEntity to) protected ScreenHandler
createScreenHandler
(int syncId, PlayerInventory playerInventory) float
getAnimationProgress
(float tickDelta) protected Text
protected DefaultedList<ItemStack>
static int
getPlayersLookingInChestCount
(BlockView world, BlockPos pos) void
onClose
(PlayerEntity player) Called when the inventory is closed.void
onOpen
(PlayerEntity player) Called when the inventory is opened.void
boolean
onSyncedBlockEvent
(int type, int data) If this block entity's block extendsBlockWithEntity
, this is called insideAbstractBlock.onSyncedBlockEvent(net.minecraft.block.BlockState, net.minecraft.world.World, net.minecraft.util.math.BlockPos, int, int)
.protected void
onViewerCountUpdate
(World world, BlockPos pos, BlockState state, int oldViewerCount, int newViewerCount) (package private) static void
playSound
(World world, BlockPos pos, BlockState state, SoundEvent soundEvent) void
readNbt
(NbtCompound nbt) Reads data fromnbt
.protected void
int
size()
Returns the size of the inventory.protected void
writeNbt
(NbtCompound nbt) Writes data tonbt
.Methods inherited from class net.minecraft.block.entity.LootableContainerBlockEntity
canPlayerUse, checkUnlocked, clear, createMenu, getLootTableId, getLootTableSeed, getStack, isEmpty, removeStack, removeStack, setLootTableId, setLootTableSeed, 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, createFromNbt, createNbt, createNbtWithId, createNbtWithIdentifyingData, getCachedState, getPos, getType, getWorld, hasWorld, isRemoved, markDirty, markDirty, markRemoved, populateCrashReport, posFromNbt, setCachedState, setStackNbt, setWorld, toInitialChunkDataNbt, toUpdatePacket, writeIdToNbt
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
canTransferTo, containsAny, containsAny, count, getMaxCountPerStack, isValid, markDirty
Methods inherited from interface net.minecraft.inventory.LootableInventory
generateLoot, getPos, getWorld, readLootTable, setLootTable, writeLootTable
Methods inherited from interface net.minecraft.util.Nameable
hasCustomName
-
Field Details
-
VIEWER_COUNT_UPDATE_EVENT_TYPE
private static final int VIEWER_COUNT_UPDATE_EVENT_TYPE- See Also:
- Mappings:
Namespace Name Mixin selector official e
Ldhc;e:I
intermediary field_31332
Lnet/minecraft/class_2595;field_31332:I
named VIEWER_COUNT_UPDATE_EVENT_TYPE
Lnet/minecraft/block/entity/ChestBlockEntity;VIEWER_COUNT_UPDATE_EVENT_TYPE:I
-
inventory
- Mappings:
Namespace Name Mixin selector official f
Ldhc;f:Liq;
intermediary field_11927
Lnet/minecraft/class_2595;field_11927:Lnet/minecraft/class_2371;
named inventory
Lnet/minecraft/block/entity/ChestBlockEntity;inventory:Lnet/minecraft/util/collection/DefaultedList;
-
stateManager
- Mappings:
Namespace Name Mixin selector official g
Ldhc;g:Ldhi;
intermediary field_27209
Lnet/minecraft/class_2595;field_27209:Lnet/minecraft/class_5561;
named stateManager
Lnet/minecraft/block/entity/ChestBlockEntity;stateManager:Lnet/minecraft/block/entity/ViewerCountManager;
-
lidAnimator
- Mappings:
Namespace Name Mixin selector official h
Ldhc;h:Ldhd;
intermediary field_27210
Lnet/minecraft/class_2595;field_27210:Lnet/minecraft/class_5560;
named lidAnimator
Lnet/minecraft/block/entity/ChestBlockEntity;lidAnimator:Lnet/minecraft/block/entity/ChestLidAnimator;
-
-
Constructor Details
-
ChestBlockEntity
- Mappings:
Namespace Name Mixin selector official <init>
Ldgv;<init>(Ldgx;Lhx;Ldjh;)V
intermediary <init>
Lnet/minecraft/class_2586;<init>(Lnet/minecraft/class_2591;Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;)V
named <init>
Lnet/minecraft/block/entity/BlockEntity;<init>(Lnet/minecraft/block/entity/BlockEntityType;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)V
-
ChestBlockEntity
- Mappings:
Namespace Name Mixin selector official <init>
Ldhc;<init>(Lhx;Ldjh;)V
intermediary <init>
Lnet/minecraft/class_2595;<init>(Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;)V
named <init>
Lnet/minecraft/block/entity/ChestBlockEntity;<init>(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)V
-
-
Method Details
-
size
public int size()Returns the size of the inventory.The inventory should support the slot ID from
0
tosize() - 1
. This should remain constant throughout the inventory's lifetime. -
getContainerName
- Specified by:
getContainerName
in classLockableContainerBlockEntity
- Mappings:
Namespace Name Mixin selector official l
Ldgp;l()Lvf;
intermediary method_17823
Lnet/minecraft/class_2624;method_17823()Lnet/minecraft/class_2561;
named getContainerName
Lnet/minecraft/block/entity/LockableContainerBlockEntity;getContainerName()Lnet/minecraft/text/Text;
-
readNbt
Reads data fromnbt
. Subclasses should override this if they store a persistent data.NBT is a storage format; therefore, a data from NBT is loaded to a block entity instance's fields, which are used for other operations instead of the NBT. The data is written back to NBT when saving the block entity.
nbt
might not have all expected keys, or might have a key whose value does not meet the requirement (such as the type or the range). This method should fall back to a reasonable default value instead of throwing an exception.- Overrides:
readNbt
in classLockableContainerBlockEntity
- See Also:
- Mappings:
Namespace Name Mixin selector official a
Ldgv;a(Lsn;)V
intermediary method_11014
Lnet/minecraft/class_2586;method_11014(Lnet/minecraft/class_2487;)V
named readNbt
Lnet/minecraft/block/entity/BlockEntity;readNbt(Lnet/minecraft/nbt/NbtCompound;)V
-
writeNbt
Writes data tonbt
. Subclasses should override this if they store a persistent data.NBT is a storage format; therefore, a data from NBT is loaded to a block entity instance's fields, which are used for other operations instead of the NBT. The data is written back to NBT when saving the block entity.
- Overrides:
writeNbt
in classLockableContainerBlockEntity
- See Also:
- Mappings:
Namespace Name Mixin selector official b
Ldgv;b(Lsn;)V
intermediary method_11007
Lnet/minecraft/class_2586;method_11007(Lnet/minecraft/class_2487;)V
named writeNbt
Lnet/minecraft/block/entity/BlockEntity;writeNbt(Lnet/minecraft/nbt/NbtCompound;)V
-
clientTick
public static void clientTick(World world, BlockPos pos, BlockState state, ChestBlockEntity blockEntity) - Mappings:
Namespace Name Mixin selector official a
Ldhc;a(Lctp;Lhx;Ldjh;Ldhc;)V
intermediary method_31670
Lnet/minecraft/class_2595;method_31670(Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;Lnet/minecraft/class_2595;)V
named clientTick
Lnet/minecraft/block/entity/ChestBlockEntity;clientTick(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Lnet/minecraft/block/entity/ChestBlockEntity;)V
-
playSound
- Mappings:
Namespace Name Mixin selector official a
Ldhc;a(Lctp;Lhx;Ldjh;Larr;)V
intermediary method_11050
Lnet/minecraft/class_2595;method_11050(Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;Lnet/minecraft/class_3414;)V
named playSound
Lnet/minecraft/block/entity/ChestBlockEntity;playSound(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Lnet/minecraft/sound/SoundEvent;)V
-
onSyncedBlockEvent
public boolean onSyncedBlockEvent(int type, int data) If this block entity's block extendsBlockWithEntity
, this is called insideAbstractBlock.onSyncedBlockEvent(net.minecraft.block.BlockState, net.minecraft.world.World, net.minecraft.util.math.BlockPos, int, int)
.- Overrides:
onSyncedBlockEvent
in classBlockEntity
- See Also:
- Mappings:
Namespace Name Mixin selector official a_
Ldgv;a_(II)Z
intermediary method_11004
Lnet/minecraft/class_2586;method_11004(II)Z
named onSyncedBlockEvent
Lnet/minecraft/block/entity/BlockEntity;onSyncedBlockEvent(II)Z
-
onOpen
Called when the inventory is opened. Specifically, this is called inside theScreenHandler
constructor. This does nothing by default.The method is called in both the client and the server. However, because clientside screen handler is created with a
SimpleInventory
, other implementations can (and the vanilla code does) assume that the method is called in the server.- Specified by:
onOpen
in interfaceInventory
- Mappings:
Namespace Name Mixin selector official d_
Lbju;d_(Lcfi;)V
intermediary method_5435
Lnet/minecraft/class_1263;method_5435(Lnet/minecraft/class_1657;)V
named onOpen
Lnet/minecraft/inventory/Inventory;onOpen(Lnet/minecraft/entity/player/PlayerEntity;)V
-
onClose
Called when the inventory is closed. Specifically, this is called insideScreenHandler.onClosed(net.minecraft.entity.player.PlayerEntity)
. This does nothing by default.The method is called in both the client and the server. However, because clientside screen handler is created with a
SimpleInventory
, other implementations can (and the vanilla code does) assume that the method is called in the server.- Specified by:
onClose
in interfaceInventory
- Mappings:
Namespace Name Mixin selector official c
Lbju;c(Lcfi;)V
intermediary method_5432
Lnet/minecraft/class_1263;method_5432(Lnet/minecraft/class_1657;)V
named onClose
Lnet/minecraft/inventory/Inventory;onClose(Lnet/minecraft/entity/player/PlayerEntity;)V
-
getHeldStacks
- Specified by:
getHeldStacks
in classLootableContainerBlockEntity
-
setInvStackList
- Specified by:
setInvStackList
in classLootableContainerBlockEntity
- Mappings:
Namespace Name Mixin selector official a
Ldhz;a(Liq;)V
intermediary method_11281
Lnet/minecraft/class_2621;method_11281(Lnet/minecraft/class_2371;)V
named setInvStackList
Lnet/minecraft/block/entity/LootableContainerBlockEntity;setInvStackList(Lnet/minecraft/util/collection/DefaultedList;)V
-
getAnimationProgress
public float getAnimationProgress(float tickDelta) - Specified by:
getAnimationProgress
in interfaceLidOpenable
- Mappings:
Namespace Name Mixin selector official a
Ldhy;a(F)F
intermediary method_11274
Lnet/minecraft/class_2618;method_11274(F)F
named getAnimationProgress
Lnet/minecraft/block/entity/LidOpenable;getAnimationProgress(F)F
-
getPlayersLookingInChestCount
- Mappings:
Namespace Name Mixin selector official a
Ldhc;a(Lcsv;Lhx;)I
intermediary method_11048
Lnet/minecraft/class_2595;method_11048(Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;)I
named getPlayersLookingInChestCount
Lnet/minecraft/block/entity/ChestBlockEntity;getPlayersLookingInChestCount(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)I
-
copyInventory
- Mappings:
Namespace Name Mixin selector official a
Ldhc;a(Ldhc;Ldhc;)V
intermediary method_11047
Lnet/minecraft/class_2595;method_11047(Lnet/minecraft/class_2595;Lnet/minecraft/class_2595;)V
named copyInventory
Lnet/minecraft/block/entity/ChestBlockEntity;copyInventory(Lnet/minecraft/block/entity/ChestBlockEntity;Lnet/minecraft/block/entity/ChestBlockEntity;)V
-
createScreenHandler
- Specified by:
createScreenHandler
in classLockableContainerBlockEntity
- Mappings:
Namespace Name Mixin selector official a
Ldgp;a(ILcfh;)Lcib;
intermediary method_5465
Lnet/minecraft/class_2624;method_5465(ILnet/minecraft/class_1661;)Lnet/minecraft/class_1703;
named createScreenHandler
Lnet/minecraft/block/entity/LockableContainerBlockEntity;createScreenHandler(ILnet/minecraft/entity/player/PlayerInventory;)Lnet/minecraft/screen/ScreenHandler;
-
onScheduledTick
public void onScheduledTick()- Mappings:
Namespace Name Mixin selector official m
Ldhc;m()V
intermediary method_31671
Lnet/minecraft/class_2595;method_31671()V
named onScheduledTick
Lnet/minecraft/block/entity/ChestBlockEntity;onScheduledTick()V
-
onViewerCountUpdate
protected void onViewerCountUpdate(World world, BlockPos pos, BlockState state, int oldViewerCount, int newViewerCount) - Mappings:
Namespace Name Mixin selector official a
Ldhc;a(Lctp;Lhx;Ldjh;II)V
intermediary method_11049
Lnet/minecraft/class_2595;method_11049(Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;II)V
named onViewerCountUpdate
Lnet/minecraft/block/entity/ChestBlockEntity;onViewerCountUpdate(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;II)V
-