Class ShelfBlockEntity
- All Implemented Interfaces:
Iterable<ItemStack>,Inventory,ListInventory,Clearable,HeldItemContext,DebugTrackable
- Mappings:
Namespace Name named net/minecraft/block/entity/ShelfBlockEntityintermediary net/minecraft/class_11597official ehv
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.world.debug.DebugTrackable
DebugTrackable.DebugDataSupplier<T>, DebugTrackable.TrackerNested classes/interfaces inherited from interface net.minecraft.util.HeldItemContext
HeldItemContext.OffsetNested classes/interfaces inherited from interface net.minecraft.inventory.Inventory
Inventory.Iterator -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate booleanprivate final DefaultedList<ItemStack> private static final Loggerstatic final intFields inherited from class net.minecraft.block.entity.BlockEntity
pos, removed, worldFields inherited from interface net.minecraft.inventory.Inventory
DEFAULT_MAX_INTERACTION_RANGE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddComponents(ComponentMap.Builder builder) booleancanPlayerUse(PlayerEntity player) Returns whetherplayercan use this inventory.floatvoidMarks this block entity as dirty and that it needs to be saved.voidmarkDirty(RegistryEntry.Reference<GameEvent> gameEvent) protected voidreadComponents(ComponentsAccess components) protected voidReads data fromnbt.voidbooleanswapStackNoMarkDirty(int slot, ItemStack stack) toInitialChunkDataNbt(RegistryWrapper.WrapperLookup registries) 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, ornullto not send the packet.protected voidWrites data tonbt.Methods inherited from class net.minecraft.block.entity.BlockEntity
cancelRemoval, createComponentlessNbt, createComponentMap, createFromNbt, createNbt, createNbtWithIdentifyingData, getCachedState, getComponents, getNameForReport, getPos, getReporterContext, getType, getWorld, hasWorld, isRemoved, markDirty, markRemoved, onBlockReplaced, onSyncedBlockEvent, populateCrashReport, posFromNbt, read, readComponentlessData, readComponents, readComponents, registerTracking, setCachedState, setComponents, setWorld, supports, tryParseCustomName, writeComponentlessData, writeDataWithId, writeDataWithoutId, writeFullData, writeIdMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.util.HeldItemContext
getEntityMethods inherited from interface net.minecraft.inventory.Inventory
canTransferTo, containsAny, containsAny, count, getMaxCount, getMaxCountPerStack, getViewingUsers, iterator, onClose, onOpenMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface net.minecraft.inventory.ListInventory
canAccept, clear, getFilledSlotCount, getStack, isEmpty, isValid, removeStack, removeStack, setStack, setStackNoMarkDirty, size
-
Field Details
-
SLOT_COUNT
public static final int SLOT_COUNT- See Also:
- Mappings:
Namespace Name Mixin selector named SLOT_COUNTLnet/minecraft/block/entity/ShelfBlockEntity;SLOT_COUNT:Iintermediary field_61441Lnet/minecraft/class_11597;field_61441:Iofficial bLehv;b:I
-
LOGGER
- Mappings:
Namespace Name Mixin selector named LOGGERLnet/minecraft/block/entity/ShelfBlockEntity;LOGGER:Lorg/slf4j/Logger;intermediary field_61442Lnet/minecraft/class_11597;field_61442:Lorg/slf4j/Logger;official cLehv;c:Lorg/slf4j/Logger;
-
ALIGN_ITEMS_TO_BOTTOM_KEY
- See Also:
- Mappings:
Namespace Name Mixin selector named ALIGN_ITEMS_TO_BOTTOM_KEYLnet/minecraft/block/entity/ShelfBlockEntity;ALIGN_ITEMS_TO_BOTTOM_KEY:Ljava/lang/String;intermediary field_62078Lnet/minecraft/class_11597;field_62078:Ljava/lang/String;official dLehv;d:Ljava/lang/String;
-
heldStacks
- Mappings:
Namespace Name Mixin selector named heldStacksLnet/minecraft/block/entity/ShelfBlockEntity;heldStacks:Lnet/minecraft/util/collection/DefaultedList;intermediary field_61443Lnet/minecraft/class_11597;field_61443:Lnet/minecraft/class_2371;official eLehv;e:Ljt;
-
alignItemsToBottom
private boolean alignItemsToBottom- Mappings:
Namespace Name Mixin selector named alignItemsToBottomLnet/minecraft/block/entity/ShelfBlockEntity;alignItemsToBottom:Zintermediary field_62079Lnet/minecraft/class_11597;field_62079:Zofficial fLehv;f:Z
-
-
Constructor Details
-
ShelfBlockEntity
- Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/block/entity/ShelfBlockEntity;<init>(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)Vintermediary <init>Lnet/minecraft/class_11597;<init>(Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;)Vofficial <init>Lehv;<init>(Lja;Lejm;)V
-
-
Method Details
-
readData
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.
nbtmight 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:
readDatain classBlockEntity- See Also:
- Mappings:
Namespace Name Mixin selector named readDataLnet/minecraft/block/entity/BlockEntity;readData(Lnet/minecraft/storage/ReadView;)Vintermediary method_11014Lnet/minecraft/class_2586;method_11014(Lnet/minecraft/class_11368;)Vofficial aLegg;a(Lfip;)V
-
writeData
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:
writeDatain classBlockEntity- See Also:
- Mappings:
Namespace Name Mixin selector named writeDataLnet/minecraft/block/entity/BlockEntity;writeData(Lnet/minecraft/storage/WriteView;)Vintermediary method_11007Lnet/minecraft/class_2586;method_11007(Lnet/minecraft/class_11372;)Vofficial aLegg;a(Lfir;)V
-
toUpdatePacket
Description copied from class:BlockEntityReturns the packet to send to nearby players when the block entity's observable state changes, ornullto not send the packet.If the data returned by
initial chunk datais suitable for updates, the following shortcut can be used to create an update packet:BlockEntityUpdateS2CPacket.create(this). The NBT will be passed toon the client.invalid reference
#readNbt"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:
toUpdatePacketin classBlockEntity- Returns:
- the packet to send to nearby players when the block entity's observable
state changes, or
nullto not send the packet - See Also:
- Mappings:
Namespace Name Mixin selector named toUpdatePacketLnet/minecraft/block/entity/ShelfBlockEntity;toUpdatePacket()Lnet/minecraft/network/packet/s2c/play/BlockEntityUpdateS2CPacket;intermediary method_72667Lnet/minecraft/class_11597;method_72667()Lnet/minecraft/class_2622;official kLehv;k()Lacx;
-
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
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(net.minecraft.registry.RegistryWrapper.WrapperLookup).- Overrides:
toInitialChunkDataNbtin classBlockEntity- Returns:
- the serialized state of this block entity that is observable by clients
- See Also:
- Mappings:
Namespace Name Mixin selector named toInitialChunkDataNbtLnet/minecraft/block/entity/BlockEntity;toInitialChunkDataNbt(Lnet/minecraft/registry/RegistryWrapper$WrapperLookup;)Lnet/minecraft/nbt/NbtCompound;intermediary method_16887Lnet/minecraft/class_2586;method_16887(Lnet/minecraft/class_7225$class_7874;)Lnet/minecraft/class_2487;official aLegg;a(Ljm$a;)Lup;
-
getHeldStacks
- Specified by:
getHeldStacksin interfaceListInventory- Mappings:
Namespace Name Mixin selector named getHeldStacksLnet/minecraft/inventory/ListInventory;getHeldStacks()Lnet/minecraft/util/collection/DefaultedList;intermediary method_72652Lnet/minecraft/class_11596;method_72652()Lnet/minecraft/class_2371;official hLehp;h()Ljt;
-
canPlayerUse
Returns whetherplayercan use this inventory.This is called by
ScreenHandler.canUse(net.minecraft.screen.ScreenHandlerContext, net.minecraft.entity.player.PlayerEntity, net.minecraft.block.Block).- Specified by:
canPlayerUsein interfaceInventory- Returns:
- whether
playercan use this inventory - See Also:
- API Note:
- Implementations should check the distance between the inventory
holder and
player. For convenience, this interface offers two methods used by block entities to implement this check. - Mappings:
Namespace Name Mixin selector named canPlayerUseLnet/minecraft/inventory/Inventory;canPlayerUse(Lnet/minecraft/entity/player/PlayerEntity;)Zintermediary method_5443Lnet/minecraft/class_1263;method_5443(Lnet/minecraft/class_1657;)Zofficial aLcbj;a(Lczl;)Z
-
swapStackNoMarkDirty
- Mappings:
Namespace Name Mixin selector named swapStackNoMarkDirtyLnet/minecraft/block/entity/ShelfBlockEntity;swapStackNoMarkDirty(ILnet/minecraft/item/ItemStack;)Lnet/minecraft/item/ItemStack;intermediary method_72666Lnet/minecraft/class_11597;method_72666(ILnet/minecraft/class_1799;)Lnet/minecraft/class_1799;official dLehv;d(ILdhp;)Ldhp;
-
markDirty
- Mappings:
Namespace Name Mixin selector named markDirtyLnet/minecraft/block/entity/ShelfBlockEntity;markDirty(Lnet/minecraft/registry/entry/RegistryEntry$Reference;)Vintermediary method_72665Lnet/minecraft/class_11597;method_72665(Lnet/minecraft/class_6880$class_6883;)Vofficial aLehv;a(Ljk$c;)V
-
markDirty
public void markDirty()Marks this block entity as dirty and that it needs to be saved. This also triggers comparator update.This must be called when something changed in a way that affects the saved NBT; otherwise, the game might not save the block entity.
- Specified by:
markDirtyin interfaceInventory- Overrides:
markDirtyin classBlockEntity- See Also:
- Mappings:
Namespace Name Mixin selector named markDirtyLnet/minecraft/block/entity/BlockEntity;markDirty()Vintermediary method_5431Lnet/minecraft/class_2586;method_5431()Vofficial eLegg;e()V
-
readComponents
- Overrides:
readComponentsin classBlockEntity- Mappings:
Namespace Name Mixin selector named readComponentsLnet/minecraft/block/entity/BlockEntity;readComponents(Lnet/minecraft/component/ComponentsAccess;)Vintermediary method_57568Lnet/minecraft/class_2586;method_57568(Lnet/minecraft/class_9473;)Vofficial aLegg;a(Lkk;)V
-
addComponents
- Overrides:
addComponentsin classBlockEntity- Mappings:
Namespace Name Mixin selector named addComponentsLnet/minecraft/block/entity/BlockEntity;addComponents(Lnet/minecraft/component/ComponentMap$Builder;)Vintermediary method_57567Lnet/minecraft/class_2586;method_57567(Lnet/minecraft/class_9323$class_9324;)Vofficial aLegg;a(Lkm$a;)V
-
removeFromCopiedStackData
- Overrides:
removeFromCopiedStackDatain classBlockEntity- Mappings:
Namespace Name Mixin selector named removeFromCopiedStackDataLnet/minecraft/block/entity/BlockEntity;removeFromCopiedStackData(Lnet/minecraft/storage/WriteView;)Vintermediary method_57569Lnet/minecraft/class_2586;method_57569(Lnet/minecraft/class_11372;)Vofficial bLegg;b(Lfir;)V
-
getEntityWorld
- Specified by:
getEntityWorldin interfaceHeldItemContext- Mappings:
Namespace Name Mixin selector named getEntityWorldLnet/minecraft/util/HeldItemContext;getEntityWorld()Lnet/minecraft/world/World;intermediary method_73183Lnet/minecraft/class_11566;method_73183()Lnet/minecraft/class_1937;official anLces;an()Ldrq;
-
getEntityPos
- Specified by:
getEntityPosin interfaceHeldItemContext- Mappings:
Namespace Name Mixin selector named getEntityPosLnet/minecraft/util/HeldItemContext;getEntityPos()Lnet/minecraft/util/math/Vec3d;intermediary method_73189Lnet/minecraft/class_11566;method_73189()Lnet/minecraft/class_243;official dDLces;dD()Lfoh;
-
getBodyYaw
public float getBodyYaw()- Specified by:
getBodyYawin interfaceHeldItemContext- Mappings:
Namespace Name Mixin selector named getBodyYawLnet/minecraft/util/HeldItemContext;getBodyYaw()Fintermediary method_73188Lnet/minecraft/class_11566;method_73188()Fofficial dYLces;dY()F
-
shouldAlignItemsToBottom
public boolean shouldAlignItemsToBottom()- Mappings:
Namespace Name Mixin selector named shouldAlignItemsToBottomLnet/minecraft/block/entity/ShelfBlockEntity;shouldAlignItemsToBottom()Zintermediary method_73326Lnet/minecraft/class_11597;method_73326()Zofficial lLehv;l()Z
-