Class BookScreen
java.lang.Object
net.minecraft.client.gui.DrawableHelper
net.minecraft.client.gui.AbstractParentElement
net.minecraft.client.gui.screen.Screen
net.minecraft.client.gui.screen.ingame.BookScreen
- All Implemented Interfaces:
Drawable,Element,ParentElement,TickableElement
- Direct Known Subclasses:
LecternScreen
@Environment(CLIENT) public class BookScreen extends Screen
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceBookScreen.Contentsstatic classBookScreen.WritableBookContentsstatic classBookScreen.WrittenBookContents -
Field Summary
Fields Modifier and Type Field Description static IdentifierBOOK_TEXTUREprivate List<StringRenderable>cachedPageprivate intcachedPageIndexprivate BookScreen.Contentscontentsstatic BookScreen.ContentsEMPTY_PROVIDERprivate PageTurnWidgetnextPageButtonprivate intpageIndexprivate booleanpageTurnSoundprivate PageTurnWidgetpreviousPageButtonFields inherited from class net.minecraft.client.gui.screen.Screen
buttons, children, client, height, itemRenderer, passEvents, textRenderer, title, widthFields inherited from class net.minecraft.client.gui.DrawableHelper
BACKGROUND_TEXTURE, GUI_ICONS_TEXTURE, STATS_ICON_TEXTURE -
Constructor Summary
Constructors Modifier Constructor Description BookScreen()BookScreen(BookScreen.Contents pageProvider)privateBookScreen(BookScreen.Contents contents, boolean playPageTurnSound) -
Method Summary
Modifier and Type Method Description protected voidaddCloseButton()protected voidaddPageButtons()private intgetPageCount()private intgetStringWidth(String string)StylegetTextAt(double x, double y)protected voidgoToNextPage()protected voidgoToPreviousPage()booleanhandleTextClick(Style style)protected voidinit()protected booleanjumpToPage(int page)booleankeyPressed(int keyCode, int scanCode, int modifiers)booleanmouseClicked(double mouseX, double mouseY, int button)static List<String>readPages(CompoundTag tag)voidrender(MatrixStack matrices, int mouseX, int mouseY, float delta)booleansetPage(int index)voidsetPageProvider(BookScreen.Contents pageProvider)private voidupdatePageButtons()Methods inherited from class net.minecraft.client.gui.screen.Screen
addButton, addChild, children, getNarrationMessage, getTitle, getTooltipFromItem, hasAltDown, hasControlDown, hasShiftDown, init, insertText, isCopy, isCut, isMouseOver, isPaste, isPauseScreen, isSelectAll, isValidCharacterForName, method_29638, onClose, removed, renderBackground, renderBackground, renderBackgroundTexture, renderTextHoverEffect, renderTooltip, renderTooltip, renderTooltip, resize, sendMessage, sendMessage, shouldCloseOnEsc, tick, wrapScreenErrorMethods inherited from class net.minecraft.client.gui.AbstractParentElement
getFocused, isDragging, setDragging, setFocusedMethods inherited from class net.minecraft.client.gui.DrawableHelper
drawCenteredString, drawCenteredText, drawHorizontalLine, drawSprite, drawStringWithShadow, drawTexture, drawTexture, drawTexture, drawTexture, drawTextWithShadow, drawVerticalLine, fill, fillGradient, fillGradient, getZOffset, method_29343, setZOffsetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.client.gui.ParentElement
changeFocus, charTyped, focusOn, hoveredElement, keyReleased, mouseDragged, mouseReleased, mouseScrolled, setInitialFocus
-
Field Details
-
EMPTY_PROVIDER
-
BOOK_TEXTURE
-
contents
-
pageIndex
private int pageIndex -
cachedPage
-
cachedPageIndex
private int cachedPageIndex -
nextPageButton
-
previousPageButton
-
pageTurnSound
private final boolean pageTurnSound
-
-
Constructor Details
-
BookScreen
-
BookScreen
public BookScreen() -
BookScreen
-
-
Method Details
-
setPageProvider
-
setPage
public boolean setPage(int index) -
jumpToPage
protected boolean jumpToPage(int page) -
init
protected void init() -
addCloseButton
protected void addCloseButton() -
addPageButtons
protected void addPageButtons() -
getPageCount
private int getPageCount() -
goToPreviousPage
protected void goToPreviousPage() -
goToNextPage
protected void goToNextPage() -
updatePageButtons
private void updatePageButtons() -
keyPressed
public boolean keyPressed(int keyCode, int scanCode, int modifiers)- Specified by:
keyPressedin interfaceElement- Specified by:
keyPressedin interfaceParentElement- Overrides:
keyPressedin classScreen
-
render
-
getStringWidth
-
mouseClicked
public boolean mouseClicked(double mouseX, double mouseY, int button) -
handleTextClick
- Overrides:
handleTextClickin classScreen
-
getTextAt
-
readPages
-