Class LecternBlockEntity
java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.level.block.entity.BlockEntity
net.minecraft.world.level.block.entity.LecternBlockEntity
- All Implemented Interfaces:
TypedInstance<BlockEntityType<?>>, DebugValueSource, Clearable, MenuConstructor, MenuProvider, IAttachmentHolder, IBlockEntityExtension, IMenuProviderExtension
-
Nested Class Summary
Nested classes/interfaces inherited from class AttachmentHolder
AttachmentHolder.AsFieldNested classes/interfaces inherited from interface DebugValueSource
DebugValueSource.Registration, DebugValueSource.ValueGetter<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ItemStackprivate final Containerstatic final intprivate final ContainerDatastatic final intstatic final intprivate intprivate intstatic final intFields inherited from class BlockEntity
level, remove, worldPositionFields inherited from class AttachmentHolder
ATTACHMENTS_NBT_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprivate CommandSourceStackcreateCommandSourceStack(@Nullable Player player, ServerLevel level) createMenu(int containerId, Inventory inventory, Player player) getBook()intgetPage()private static intgetPageCount(ItemStack book) intbooleanhasBook()protected voidloadAdditional(ValueInput input) private voidvoidpreRemoveSideEffects(BlockPos pos, BlockState state) private ItemStackresolveBook(ItemStack book, @Nullable Player player) Resolves the contents of the passed ItemStack, if it is a bookprotected voidsaveAdditional(ValueOutput output) voidSets the ItemStack in this lectern.voidSets the ItemStack in this lectern.private voidsetPage(int page) Methods inherited from class BlockEntity
addEntityType, applyComponents, applyComponentsFromItemStack, applyImplicitComponents, clearRemoved, collectComponents, collectImplicitComponents, components, fillCrashReportCategory, getAndClearAttachmentTypesToSync, getBlockPos, getBlockState, getLevel, getNameForReporting, getPersistentData, getPosFromTag, getType, getUpdatePacket, getUpdateTag, hasLevel, isRemoved, isValidBlockState, loadCustomOnly, loadStatic, loadWithComponents, parseCustomNameSafe, problemPath, registerDebugValues, removeComponentsFromTag, 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 IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData, syncDataMethods inherited from interface IBlockEntityExtension
getModelData, handleUpdateTag, hasCustomOutlineRendering, invalidateCapabilities, onChunkUnloaded, onDataPacket, onLoad, requestModelDataUpdateMethods inherited from interface IMenuProviderExtension
shouldTriggerClientSideContainerClosingOnOpen, writeClientSideData
-
Field Details
-
DATA_PAGE
public static final int DATA_PAGE- See Also:
-
NUM_DATA
public static final int NUM_DATA- See Also:
-
SLOT_BOOK
public static final int SLOT_BOOK- See Also:
-
NUM_SLOTS
public static final int NUM_SLOTS- See Also:
-
bookAccess
-
dataAccess
-
book
-
page
private int page -
pageCount
private int pageCount
-
-
Constructor Details
-
LecternBlockEntity
-
-
Method Details
-
getBook
-
hasBook
public boolean hasBook() -
setBook
Sets the ItemStack in this lectern. Note that this does not update the block state, useLecternBlock.tryPlaceBook(LivingEntity, Level, BlockPos, BlockState, ItemStack)for that. -
onBookItemRemove
private void onBookItemRemove() -
setBook
Sets the ItemStack in this lectern. Note that this does not update the block state, useLecternBlock.tryPlaceBook(LivingEntity, Level, BlockPos, BlockState, ItemStack)for that.- Parameters:
resolutionContext- the player used for resolving the components within the book
-
setPage
private void setPage(int page) -
getPage
public int getPage() -
getRedstoneSignal
public int getRedstoneSignal() -
resolveBook
-
createCommandSourceStack
-
loadAdditional
- Overrides:
loadAdditionalin classBlockEntity
-
saveAdditional
- Overrides:
saveAdditionalin classBlockEntity
-
clearContent
public void clearContent()- Specified by:
clearContentin interfaceClearable
-
preRemoveSideEffects
- Overrides:
preRemoveSideEffectsin classBlockEntity
-
createMenu
- Specified by:
createMenuin interfaceMenuConstructor
-
getDisplayName
- Specified by:
getDisplayNamein interfaceMenuProvider
-
getPageCount
-