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:
Clearable
,MenuConstructor
,MenuProvider
,IAttachmentHolder
,IMenuProviderExtension
,IBlockEntityExtension
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.level.block.entity.BlockEntity
BlockEntity.ComponentHelper, BlockEntity.DataComponentInput
Nested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
AttachmentHolder.AsField
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) ItemStack
private final Container
static final int
private final ContainerData
static final int
static final int
(package private) int
private int
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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
private CommandSourceStack
createCommandSourceStack
(Player player) Creates a CommandSourceStack for resolving the contents of a book.createMenu
(int containerId, Inventory playerInventory, Player player) getBook()
int
getPage()
private static int
getPageCount
(ItemStack stack) int
boolean
hasBook()
protected void
loadAdditional
(CompoundTag tag, HolderLookup.Provider registries) (package private) void
boolean
private ItemStack
resolveBook
(ItemStack stack, Player player) Resolves the contents of the passed ItemStack, if it is a bookprotected void
saveAdditional
(CompoundTag tag, HolderLookup.Provider registries) void
Sets the ItemStack in this lectern.void
Sets the ItemStack in this lectern.(package private) void
setPage
(int page) Methods inherited from class net.minecraft.world.level.block.entity.BlockEntity
addEntityType, applyComponents, applyComponentsFromItemStack, applyImplicitComponents, clearRemoved, collectComponents, collectImplicitComponents, components, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getPersistentData, getPosFromTag, getType, getUpdatePacket, getUpdateTag, hasLevel, isRemoved, isValidBlockState, loadCustomOnly, loadStatic, loadWithComponents, parseCustomNameSafe, removeComponentsFromTag, removeData, saveCustomAndMetadata, saveCustomOnly, saveToItem, saveWithFullMetadata, saveWithId, 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.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData
Methods inherited from interface net.neoforged.neoforge.common.extensions.IBlockEntityExtension
getModelData, handleUpdateTag, hasCustomOutlineRendering, invalidateCapabilities, onChunkUnloaded, onDataPacket, onLoad, requestModelDataUpdate
Methods inherited from interface net.neoforged.neoforge.client.extensions.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
ItemStack book -
page
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(net.minecraft.world.entity.LivingEntity, net.minecraft.world.level.Level, net.minecraft.core.BlockPos, net.minecraft.world.level.block.state.BlockState, net.minecraft.world.item.ItemStack)
for that. -
onBookItemRemove
void onBookItemRemove() -
setBook
Sets the ItemStack in this lectern. Note that this does not update the block state, useLecternBlock.tryPlaceBook(net.minecraft.world.entity.LivingEntity, net.minecraft.world.level.Level, net.minecraft.core.BlockPos, net.minecraft.world.level.block.state.BlockState, net.minecraft.world.item.ItemStack)
for that.- Parameters:
player
- the player used for resolving the components within the book
-
setPage
void setPage(int page) -
getPage
public int getPage() -
getRedstoneSignal
public int getRedstoneSignal() -
resolveBook
Resolves the contents of the passed ItemStack, if it is a book -
createCommandSourceStack
Creates a CommandSourceStack for resolving the contents of a book. If the player is null, a CommandSourceStack with the generic name"Lectern"
is used. -
onlyOpCanSetNbt
public boolean onlyOpCanSetNbt()- Overrides:
onlyOpCanSetNbt
in classBlockEntity
-
loadAdditional
- Overrides:
loadAdditional
in classBlockEntity
-
saveAdditional
- Overrides:
saveAdditional
in classBlockEntity
-
clearContent
public void clearContent()- Specified by:
clearContent
in interfaceClearable
-
createMenu
- Specified by:
createMenu
in interfaceMenuConstructor
-
getDisplayName
- Specified by:
getDisplayName
in interfaceMenuProvider
-
getPageCount
-