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>,DebugValueSource,Clearable,Container,ListBackedContainer,IAttachmentHolder,ContainerExtension,IBlockEntityExtension
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.level.block.entity.BlockEntity
BlockEntity.BlockEntityPathElementNested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
AttachmentHolder.AsFieldNested classes/interfaces inherited from interface net.minecraft.world.Container
Container.ContainerIteratorNested classes/interfaces inherited from interface net.minecraft.util.debug.DebugValueSource
DebugValueSource.Registration, DebugValueSource.ValueGetter<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate final NonNullList<ItemStack> private intprivate final SnapshotJournal<Integer> private static final org.slf4j.Loggerstatic final intFields inherited from class net.minecraft.world.level.block.entity.BlockEntity
level, remove, worldPositionFields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
ATTACHMENTS_NBT_KEYFields inherited from interface net.minecraft.world.Container
DEFAULT_DISTANCE_BUFFER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanacceptsItemType(ItemStack p_433750_) protected voidapplyImplicitComponents(DataComponentGetter p_396989_) booleancanTakeItem(Container p_437377_, int p_437398_, ItemStack p_437308_) Returnstrueif the given stack can be extracted into the target inventory.protected voidgetItems()intintprotected voidloadAdditional(ValueInput p_422122_) voidonTransfer(int slot, int amountChange, TransactionContext transaction) Perform additional logic during the transaction, immediately after a successful transfer (i.e.voidremoveComponentsFromTag(ValueOutput p_421863_) removeItem(int p_255828_, int p_255673_) Removes up to a specified number of items from an inventory slot and returns them in a new stack.protected voidsaveAdditional(ValueOutput p_422265_) voidSets the given item stack to the specified slot in the inventory (can be crafting or armor sections).voidAn extension ofContainer.setItem(int, ItemStack)that allows non-transactional side-effects to be skipped.booleanstillValid(Player p_256481_) Don't rename this method to canInteractWith due to conflicts with Containerprivate voidupdateState(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, registerDebugValues, removeData, saveCustomOnly, saveCustomOnly, saveWithFullMetadata, saveWithFullMetadata, saveWithId, saveWithoutMetadata, saveWithoutMetadata, setBlockState, setChanged, setChanged, setComponents, setData, setLevel, setRemoved, syncData, triggerEventMethods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
deserializeAttachments, getData, getExistingDataOrNull, hasAttachments, hasData, serializeAttachmentsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.world.Container
countItem, getEntitiesWithContainerOpen, getMaxStackSize, hasAnyMatching, hasAnyOf, iterator, setChanged, startOpen, stopOpenMethods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData, syncDataMethods inherited from interface net.neoforged.neoforge.common.extensions.IBlockEntityExtension
getModelData, handleUpdateTag, hasCustomOutlineRendering, invalidateCapabilities, onChunkUnloaded, onDataPacket, onLoad, requestModelDataUpdateMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface net.minecraft.world.level.block.entity.ListBackedContainer
canPlaceItem, clearContent, count, getContainerSize, getItem, isEmpty, removeItemNoUpdate, setItemNoUpdate
-
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 -
lastInteractedSlotJournal
-
-
Constructor Details
-
ChiseledBookShelfBlockEntity
-
-
Method Details
-
updateState
private void updateState(int pSlot) -
loadAdditional
- Overrides:
loadAdditionalin classBlockEntity
-
saveAdditional
- Overrides:
saveAdditionalin classBlockEntity
-
getMaxStackSize
public int getMaxStackSize()- Specified by:
getMaxStackSizein interfaceContainer
-
acceptsItemType
- Specified by:
acceptsItemTypein interfaceListBackedContainer
-
removeItem
Description copied from interface:ContainerRemoves up to a specified number of items from an inventory slot and returns them in a new stack.- Specified by:
removeItemin interfaceContainer- Specified by:
removeItemin interfaceListBackedContainer
-
setItem
Description copied from interface:ContainerSets the given item stack to the specified slot in the inventory (can be crafting or armor sections).- Specified by:
setItemin interfaceContainer- Specified by:
setItemin interfaceListBackedContainer
-
setItem
Description copied from interface:ContainerExtensionAn extension ofContainer.setItem(int, ItemStack)that allows non-transactional side-effects to be skipped. Non-transactional side-effects include for example callingsetChangedor making changes to the world.- Specified by:
setItemin interfaceContainerExtension- Parameters:
insideTransaction- Whentrue, non-transactional actions should be deferred. Whenfalse, non-transactional actions can be performed immediately.- See Also:
-
onTransfer
Description copied from interface:ContainerExtensionPerform additional logic during the transaction, immediately after a successful transfer (i.e. insert or extract with result > 0). Any logic performed by this method should be fully transactional, and support being rolled back. In other words, the transaction is still ongoing.- Specified by:
onTransferin interfaceContainerExtension- Parameters:
amountChange- If positive, the amount of items that were just inserted into this slot. If negative, minus the amount of items that were just extracted from this slot.
-
canTakeItem
Description copied from interface:ContainerReturnstrueif the given stack can be extracted into the target inventory.- Specified by:
canTakeItemin interfaceContainer- Parameters:
p_437377_- the container into which the item should be extractedp_437398_- the slot from which to extract the itemp_437308_- the item to extract- Returns:
trueif the given stack can be extracted into the target inventory
-
getItems
- Specified by:
getItemsin interfaceListBackedContainer
-
stillValid
Description copied from interface:ContainerDon't rename this method to canInteractWith due to conflicts with Container- Specified by:
stillValidin interfaceContainer
-
getLastInteractedSlot
public int getLastInteractedSlot() -
applyImplicitComponents
- Overrides:
applyImplicitComponentsin classBlockEntity
-
collectImplicitComponents
- Overrides:
collectImplicitComponentsin classBlockEntity
-
removeComponentsFromTag
- Overrides:
removeComponentsFromTagin classBlockEntity
-