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>, TypedInstance<BlockEntityType<?>>, DebugValueSource, Clearable, Container, SlotProvider, ListBackedContainer, IAttachmentHolder, ContainerExtension, IBlockEntityExtension
-
Nested Class Summary
Nested classes/interfaces inherited from class AttachmentHolder
AttachmentHolder.AsFieldNested classes/interfaces inherited from interface Container
Container.ContainerIteratorNested classes/interfaces inherited from interface 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 BlockEntity
level, remove, worldPositionFields inherited from class AttachmentHolder
ATTACHMENTS_NBT_KEYFields inherited from interface Container
DEFAULT_DISTANCE_BUFFER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanacceptsItemType(ItemStack itemStack) protected voidapplyImplicitComponents(DataComponentGetter components) booleancanTakeItem(Container into, int slot, ItemStack itemStack) Returnstrueif the given stack can be extracted into the target inventory.protected voidcollectImplicitComponents(DataComponentMap.Builder components) getItems()intintprotected voidloadAdditional(ValueInput input) voidonTransfer(int slot, int amountChange, TransactionContext transaction) Perform additional logic during the transaction, immediately after a successful transfer (i.e.voidremoveComponentsFromTag(ValueOutput output) removeItem(int slot, int count) Removes up to a specified number of items from an inventory slot and returns them in a new stack.protected voidsaveAdditional(ValueOutput output) 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 player) Don't rename this method to canInteractWith due to conflicts with Containerprivate voidupdateState(int interactedSlot) Methods inherited from class BlockEntity
addEntityType, applyComponents, applyComponentsFromItemStack, clearRemoved, collectComponents, components, fillCrashReportCategory, getAndClearAttachmentTypesToSync, 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, triggerEvent, typeHolderMethods inherited from class AttachmentHolder
deserializeAttachments, getData, getExistingDataOrNull, hasAttachments, hasData, serializeAttachmentsMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Container
countItem, getEntitiesWithContainerOpen, getMaxStackSize, getSlot, hasAnyMatching, hasAnyOf, iterator, setChanged, startOpen, stopOpenMethods inherited from interface IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData, syncDataMethods inherited from interface IBlockEntityExtension
getModelData, handleUpdateTag, hasCustomOutlineRendering, invalidateCapabilities, onChunkUnloaded, onDataPacket, onLoad, requestModelDataUpdateMethods inherited from interface Iterable
forEach, spliteratorMethods inherited from interface ListBackedContainer
canPlaceItem, clearContent, count, getContainerSize, getItem, isEmpty, removeItemNoUpdate, setItemNoUpdateMethods inherited from interface SlotProvider
getSlotsFromRange
-
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 interactedSlot) -
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
-
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:
into- the container into which the item should be extractedslot- the slot from which to extract the itemitemStack- 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
-