Class ChiseledBookshelfBlockEntity
- Mappings:
Namespace Name official cwp
intermediary net/minecraft/class_7716
named net/minecraft/block/entity/ChiseledBookshelfBlockEntity
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DefaultedList<ItemStack>
private static final Logger
static final int
Fields inherited from class net.minecraft.block.entity.BlockEntity
pos, removed, world
Fields inherited from interface net.minecraft.inventory.Inventory
MAX_COUNT_PER_STACK
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
canPlayerUse
(PlayerEntity player) void
clear()
int
Returns the maximum number of items a stack can contain when placed inside this inventory.int
getStack
(int slot) Fetches the stack currently stored at the given slot.boolean
isEmpty()
boolean
Returns whether the given stack is a valid for the indicated slot position.void
readNbt
(NbtCompound nbt) Reads data fromnbt
.removeStack
(int slot) Removes the stack currently stored at the indicated slot.removeStack
(int slot, int amount) Removes a specific number of items from the given slot.void
int
size()
Returns the serialized state of this block entity that is observable by clients.Returns the packet to send to nearby players when the block entity's observable state changes, ornull
to not send the packet.private void
updateState
(int interactedSlot) protected void
writeNbt
(NbtCompound nbt) Writes data tonbt
.Methods inherited from class net.minecraft.block.entity.BlockEntity
cancelRemoval, copyItemDataRequiresOperator, createFromNbt, createNbt, createNbtWithId, createNbtWithIdentifyingData, getCachedState, getPos, getType, getWorld, hasWorld, isRemoved, markDirty, markDirty, markRemoved, onSyncedBlockEvent, populateCrashReport, posFromNbt, setCachedState, setStackNbt, setWorld, 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
containsAny, containsAny, count, markDirty, onClose, onOpen
-
Field Details
-
MAX_BOOKS
public static final int MAX_BOOKS- See Also:
- Mappings:
Namespace Name Mixin selector official b
Lcwp;b:I
intermediary field_40331
Lnet/minecraft/class_7716;field_40331:I
named MAX_BOOKS
Lnet/minecraft/block/entity/ChiseledBookshelfBlockEntity;MAX_BOOKS:I
-
LOGGER
- Mappings:
Namespace Name Mixin selector official c
Lcwp;c:Lorg/slf4j/Logger;
intermediary field_40898
Lnet/minecraft/class_7716;field_40898:Lorg/slf4j/Logger;
named LOGGER
Lnet/minecraft/block/entity/ChiseledBookshelfBlockEntity;LOGGER:Lorg/slf4j/Logger;
-
inventory
- Mappings:
Namespace Name Mixin selector official d
Lcwp;d:Lhi;
intermediary field_41314
Lnet/minecraft/class_7716;field_41314:Lnet/minecraft/class_2371;
named inventory
Lnet/minecraft/block/entity/ChiseledBookshelfBlockEntity;inventory:Lnet/minecraft/util/collection/DefaultedList;
-
-
Constructor Details
-
ChiseledBookshelfBlockEntity
- Mappings:
Namespace Name Mixin selector official <init>
Lcwp;<init>(Lgp;Lcyq;)V
intermediary <init>
Lnet/minecraft/class_7716;<init>(Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;)V
named <init>
Lnet/minecraft/block/entity/ChiseledBookshelfBlockEntity;<init>(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)V
-
-
Method Details
-
updateState
private void updateState(int interactedSlot) - Mappings:
Namespace Name Mixin selector official c
Lcwp;c(I)V
intermediary method_47585
Lnet/minecraft/class_7716;method_47585(I)V
named updateState
Lnet/minecraft/block/entity/ChiseledBookshelfBlockEntity;updateState(I)V
-
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 classBlockEntity
- See Also:
- Mappings:
Namespace Name Mixin selector official a
Lcwi;a(Lqp;)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 classBlockEntity
- See Also:
- Mappings:
Namespace Name Mixin selector official b
Lcwi;b(Lqp;)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
-
toUpdatePacket
Description copied from class:BlockEntity
Returns the packet to send to nearby players when the block entity's observable state changes, ornull
to not send the packet.If the data returned by
initial chunk data
is suitable for updates, the following shortcut can be used to create an update packet:BlockEntityUpdateS2CPacket.create(this)
. The NBT will be passed toBlockEntity.readNbt(net.minecraft.nbt.NbtCompound)
on the client."Observable state" is a state that clients can observe without specific interaction. For example,
CampfireBlockEntity
's cooked items are observable states, but chests' inventories are not observable states, since the player must first open that chest before they can see the contents.To sync block entity data using this method, use
serverWorld.getChunkManager().markForUpdate(this.getPos());
.- Overrides:
toUpdatePacket
in classBlockEntity
- Returns:
- the packet to send to nearby players when the block entity's observable
state changes, or
null
to not send the packet - See Also:
- Mappings:
Namespace Name Mixin selector official f
Lcwp;f()Lus;
intermediary method_47586
Lnet/minecraft/class_7716;method_47586()Lnet/minecraft/class_2622;
named toUpdatePacket
Lnet/minecraft/block/entity/ChiseledBookshelfBlockEntity;toUpdatePacket()Lnet/minecraft/network/packet/s2c/play/BlockEntityUpdateS2CPacket;
-
toInitialChunkDataNbt
Returns the serialized state of this block entity that is observable by clients.This is sent alongside the initial chunk data, as well as when the block entity implements
BlockEntity.toUpdatePacket()
and decides to use the defaultBlockEntityUpdateS2CPacket
."Observable state" is a state that clients can observe without specific interaction. For example,
CampfireBlockEntity
's cooked items are observable states, but chests' inventories are not observable states, since the player must first open that chest before they can see the contents.To send all NBT data of this block entity saved to disk, return
BlockEntity.createNbt()
.- Overrides:
toInitialChunkDataNbt
in classBlockEntity
- Returns:
- the serialized state of this block entity that is observable by clients
- See Also:
- Mappings:
Namespace Name Mixin selector official ab_
Lcwi;ab_()Lqp;
intermediary method_16887
Lnet/minecraft/class_2586;method_16887()Lnet/minecraft/class_2487;
named toInitialChunkDataNbt
Lnet/minecraft/block/entity/BlockEntity;toInitialChunkDataNbt()Lnet/minecraft/nbt/NbtCompound;
-
getOpenSlotCount
public int getOpenSlotCount()- Mappings:
Namespace Name Mixin selector official g
Lcwp;g()I
intermediary method_47587
Lnet/minecraft/class_7716;method_47587()I
named getOpenSlotCount
Lnet/minecraft/block/entity/ChiseledBookshelfBlockEntity;getOpenSlotCount()I
-
clear
public void clear() -
size
public int size() -
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.- Specified by:
removeStack
in interfaceInventory
- Returns:
- the removed items as a stack
- Mappings:
Namespace Name Mixin selector official a
Lbce;a(II)Lcdq;
intermediary method_5434
Lnet/minecraft/class_1263;method_5434(II)Lnet/minecraft/class_1799;
named removeStack
Lnet/minecraft/inventory/Inventory;removeStack(II)Lnet/minecraft/item/ItemStack;
-
removeStack
Removes the stack currently stored at the indicated slot.- Specified by:
removeStack
in interfaceInventory
- Returns:
- the stack previously stored at the indicated slot.
- Mappings:
Namespace Name Mixin selector official b
Lbce;b(I)Lcdq;
intermediary method_5441
Lnet/minecraft/class_1263;method_5441(I)Lnet/minecraft/class_1799;
named removeStack
Lnet/minecraft/inventory/Inventory;removeStack(I)Lnet/minecraft/item/ItemStack;
-
setStack
-
getMaxCountPerStack
public int getMaxCountPerStack()Returns the maximum number of items a stack can contain when placed inside this inventory. No slots may have more than this number of items. It is effectively the stacking limit for this inventory's slots.- Specified by:
getMaxCountPerStack
in interfaceInventory
- Returns:
- the max
count
of item stacks in this inventory - Mappings:
Namespace Name Mixin selector official P_
Lbce;P_()I
intermediary method_5444
Lnet/minecraft/class_1263;method_5444()I
named getMaxCountPerStack
Lnet/minecraft/inventory/Inventory;getMaxCountPerStack()I
-
canPlayerUse
- Specified by:
canPlayerUse
in interfaceInventory
- Mappings:
Namespace Name Mixin selector official a
Lbce;a(Lbwm;)Z
intermediary method_5443
Lnet/minecraft/class_1263;method_5443(Lnet/minecraft/class_1657;)Z
named canPlayerUse
Lnet/minecraft/inventory/Inventory;canPlayerUse(Lnet/minecraft/entity/player/PlayerEntity;)Z
-
isValid
Returns whether the given stack is a valid for the indicated slot position.
-