Class ChiseledBookShelfBlockEntity
java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.level.block.entity.BlockEntity
net.minecraft.world.level.block.entity.ChiseledBookShelfBlockEntity
- All Implemented Interfaces:
Iterable<ItemStack>
,Clearable
,Container
,IAttachmentHolder
,IBlockEntityExtension
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.level.block.entity.BlockEntity
BlockEntity.BlockEntityPathElement
Nested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
AttachmentHolder.AsField
Nested classes/interfaces inherited from interface net.minecraft.world.Container
Container.ContainerIterator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private final NonNullList
<ItemStack> private int
private static final org.slf4j.Logger
static final int
Fields inherited from class net.minecraft.world.level.block.entity.BlockEntity
level, remove, worldPosition
Fields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
ATTACHMENTS_NBT_KEY
Fields inherited from interface net.minecraft.world.Container
DEFAULT_DISTANCE_BUFFER
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
applyImplicitComponents
(DataComponentGetter pComponentGetter) boolean
canPlaceItem
(int pSlot, ItemStack pStack) Returnstrue
if automation is allowed to insert the given stack (ignoring stack size) into the given slot.boolean
canTakeItem
(Container pTarget, int pSlot, ItemStack pStack) Returnstrue
if the given stack can be extracted into the target inventory.void
protected void
collectImplicitComponents
(DataComponentMap.Builder pComponents) int
count()
int
getItem
(int pSlot) Returns the stack in the given slot.int
int
boolean
isEmpty()
protected void
loadAdditional
(ValueInput pInput) void
removeComponentsFromTag
(ValueOutput pOutput) removeItem
(int pSlot, int pAmount) Removes up to a specified number of items from an inventory slot and returns them in a new stack.removeItemNoUpdate
(int pSlot) Removes a stack from the given slot and returns it.protected void
saveAdditional
(ValueOutput pOutput) void
Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).boolean
stillValid
(Player pPlayer) Don't rename this method to canInteractWith due to conflicts with Containerprivate void
updateState
(int pSlot) Methods inherited from class net.minecraft.world.level.block.entity.BlockEntity
addEntityType, applyComponents, applyComponentsFromItemStack, clearRemoved, collectComponents, components, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getNameForReporting, getPersistentData, getPosFromTag, getType, getUpdatePacket, getUpdateTag, hasLevel, isRemoved, isValidBlockState, loadCustomOnly, loadStatic, loadWithComponents, parseCustomNameSafe, preRemoveSideEffects, problemPath, removeData, saveCustomOnly, saveCustomOnly, saveWithFullMetadata, saveWithFullMetadata, saveWithId, saveWithoutMetadata, saveWithoutMetadata, setBlockState, setChanged, setChanged, setComponents, setData, setLevel, setRemoved, triggerEvent
Methods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
deserializeAttachments, getData, getExistingDataOrNull, hasAttachments, hasData, serializeAttachments
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.world.Container
countItem, getMaxStackSize, hasAnyMatching, hasAnyOf, iterator, setChanged, startOpen, stopOpen
Methods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData
Methods inherited from interface net.neoforged.neoforge.common.extensions.IBlockEntityExtension
getModelData, handleUpdateTag, invalidateCapabilities, onChunkUnloaded, onDataPacket, onLoad, requestModelDataUpdate
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
MAX_BOOKS_IN_STORAGE
public static final int MAX_BOOKS_IN_STORAGE- See Also:
-
LOGGER
private static final org.slf4j.Logger LOGGER -
DEFAULT_LAST_INTERACTED_SLOT
private static final int DEFAULT_LAST_INTERACTED_SLOT- See Also:
-
items
-
lastInteractedSlot
private int lastInteractedSlot
-
-
Constructor Details
-
ChiseledBookShelfBlockEntity
-
-
Method Details
-
updateState
private void updateState(int pSlot) -
loadAdditional
- Overrides:
loadAdditional
in classBlockEntity
-
saveAdditional
- Overrides:
saveAdditional
in classBlockEntity
-
count
public int count() -
clearContent
public void clearContent()- Specified by:
clearContent
in interfaceClearable
-
getContainerSize
public int getContainerSize()- Specified by:
getContainerSize
in interfaceContainer
-
isEmpty
public boolean isEmpty() -
getItem
Returns the stack in the given slot. -
removeItem
Removes up to a specified number of items from an inventory slot and returns them in a new stack.- Specified by:
removeItem
in interfaceContainer
-
removeItemNoUpdate
Removes a stack from the given slot and returns it.- Specified by:
removeItemNoUpdate
in interfaceContainer
-
setItem
Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). -
canTakeItem
Returnstrue
if the given stack can be extracted into the target inventory.- Specified by:
canTakeItem
in interfaceContainer
- Parameters:
pTarget
- the container into which the item should be extractedpSlot
- the slot from which to extract the itempStack
- the item to extract- Returns:
true
if the given stack can be extracted into the target inventory
-
getMaxStackSize
public int getMaxStackSize()- Specified by:
getMaxStackSize
in interfaceContainer
-
stillValid
Don't rename this method to canInteractWith due to conflicts with Container- Specified by:
stillValid
in interfaceContainer
-
canPlaceItem
Returnstrue
if automation is allowed to insert the given stack (ignoring stack size) into the given slot. For guis use Slot.isItemValid- Specified by:
canPlaceItem
in interfaceContainer
-
getLastInteractedSlot
public int getLastInteractedSlot() -
applyImplicitComponents
- Overrides:
applyImplicitComponents
in classBlockEntity
-
collectImplicitComponents
- Overrides:
collectImplicitComponents
in classBlockEntity
-
removeComponentsFromTag
- Overrides:
removeComponentsFromTag
in classBlockEntity
-