@Environment(value=CLIENT) public class BookScreen extends Screen
Modifier and Type | Class and Description |
---|---|
static interface |
BookScreen.Contents |
static class |
BookScreen.WritableBookContents |
static class |
BookScreen.WrittenBookContents |
Modifier and Type | Field and Description |
---|---|
static Identifier |
BOOK_TEXTURE |
private List<Text> |
cachedPage |
private int |
cachedPageIndex |
private BookScreen.Contents |
contents |
static BookScreen.Contents |
EMPTY_PROVIDER |
private PageTurnWidget |
nextPageButton |
private int |
pageIndex |
private boolean |
pageTurnSound |
private PageTurnWidget |
previousPageButton |
buttons, children, client, height, itemRenderer, passEvents, textRenderer, title, width
BACKGROUND_TEXTURE, GUI_ICONS_TEXTURE, STATS_ICON_TEXTURE
Modifier | Constructor and Description |
---|---|
|
BookScreen() |
|
BookScreen(BookScreen.Contents pageProvider) |
private |
BookScreen(BookScreen.Contents contents,
boolean playPageTurnSound) |
Modifier and Type | Method and Description |
---|---|
protected void |
addCloseButton() |
protected void |
addPageButtons() |
private int |
getPageCount() |
private int |
getStringWidth(String string) |
Text |
getTextAt(double x,
double y) |
protected void |
goToNextPage() |
protected void |
goToPreviousPage() |
boolean |
handleTextClick(Text text) |
protected void |
init() |
protected boolean |
jumpToPage(int page) |
boolean |
keyPressed(int keyCode,
int scanCode,
int modifiers) |
boolean |
mouseClicked(double mouseX,
double mouseY,
int button) |
static List<String> |
readPages(CompoundTag tag) |
void |
render(int mouseX,
int mouseY,
float delta) |
boolean |
setPage(int index) |
void |
setPageProvider(BookScreen.Contents pageProvider) |
private void |
updatePageButtons() |
addButton, addChild, children, getNarrationMessage, getTitle, getTooltipFromItem, hasAltDown, hasControlDown, hasShiftDown, init, insertText, isCopy, isCut, isMouseOver, isPaste, isPauseScreen, isSelectAll, isValidCharacterForName, onClose, removed, renderBackground, renderBackground, renderDirtBackground, renderTextHoverEffect, renderTooltip, renderTooltip, renderTooltip, resize, sendMessage, sendMessage, shouldCloseOnEsc, tick, wrapScreenError
getFocused, isDragging, setDragging, setFocused
drawCenteredString, drawHorizontalLine, drawSprite, drawString, drawTexture, drawTexture, drawTexture, drawTexture, drawTexturedQuad, drawVerticalLine, fill, fill, fillGradient, getZOffset, setZOffset
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
changeFocus, charTyped, focusOn, hoveredElement, keyReleased, mouseDragged, mouseReleased, mouseScrolled, setInitialFocus
mouseMoved
public static final BookScreen.Contents EMPTY_PROVIDER
public static final Identifier BOOK_TEXTURE
private BookScreen.Contents contents
private int pageIndex
private int cachedPageIndex
private PageTurnWidget nextPageButton
private PageTurnWidget previousPageButton
private final boolean pageTurnSound
public BookScreen(BookScreen.Contents pageProvider)
public BookScreen()
private BookScreen(BookScreen.Contents contents, boolean playPageTurnSound)
public void setPageProvider(BookScreen.Contents pageProvider)
public boolean setPage(int index)
protected boolean jumpToPage(int page)
protected void addCloseButton()
protected void addPageButtons()
private int getPageCount()
protected void goToPreviousPage()
protected void goToNextPage()
private void updatePageButtons()
public boolean keyPressed(int keyCode, int scanCode, int modifiers)
keyPressed
in interface Element
keyPressed
in interface ParentElement
keyPressed
in class Screen
public void render(int mouseX, int mouseY, float delta)
private int getStringWidth(String string)
public boolean mouseClicked(double mouseX, double mouseY, int button)
public boolean handleTextClick(Text text)
handleTextClick
in class Screen
public static List<String> readPages(CompoundTag tag)