Class BookViewScreen

All Implemented Interfaces:
ContainerEventHandler, GuiEventListener, Renderable, TabOrderedElement
Direct Known Subclasses:
LecternScreen

public class BookViewScreen extends Screen
  • Field Details

    • PAGE_INDICATOR_TEXT_Y_OFFSET

      public static final int PAGE_INDICATOR_TEXT_Y_OFFSET
      See Also:
    • PAGE_TEXT_X_OFFSET

      public static final int PAGE_TEXT_X_OFFSET
      See Also:
    • PAGE_TEXT_Y_OFFSET

      public static final int PAGE_TEXT_Y_OFFSET
      See Also:
    • BACKGROUND_TEXTURE_WIDTH

      private static final int BACKGROUND_TEXTURE_WIDTH
      See Also:
    • BACKGROUND_TEXTURE_HEIGHT

      private static final int BACKGROUND_TEXTURE_HEIGHT
      See Also:
    • TITLE

      private static final Component TITLE
    • PAGE_TEXT_STYLE

      private static final Style PAGE_TEXT_STYLE
    • EMPTY_ACCESS

      public static final BookViewScreen.BookAccess EMPTY_ACCESS
    • BOOK_LOCATION

      public static final Identifier BOOK_LOCATION
    • TEXT_WIDTH

      protected static final int TEXT_WIDTH
      See Also:
    • TEXT_HEIGHT

      protected static final int TEXT_HEIGHT
      See Also:
    • IMAGE_WIDTH

      protected static final int IMAGE_WIDTH
      See Also:
    • PAGE_INDICATOR_X_OFFSET

      private static final int PAGE_INDICATOR_X_OFFSET
      See Also:
    • IMAGE_HEIGHT

      protected static final int IMAGE_HEIGHT
      See Also:
    • PAGE_BUTTON_Y

      private static final int PAGE_BUTTON_Y
      See Also:
    • PAGE_BACK_BUTTON_X

      private static final int PAGE_BACK_BUTTON_X
      See Also:
    • PAGE_FORWARD_BUTTON_X

      private static final int PAGE_FORWARD_BUTTON_X
      See Also:
    • bookAccess

      private BookViewScreen.BookAccess bookAccess
    • currentPage

      private int currentPage
    • cachedPageComponents

      private List<FormattedCharSequence> cachedPageComponents
      Holds a copy of the page text, split into page width lines
    • cachedPage

      private int cachedPage
    • pageMsg

      private Component pageMsg
    • forwardButton

      private PageButton forwardButton
    • backButton

      private PageButton backButton
    • playTurnSound

      private final boolean playTurnSound
      Determines if a sound is played when the page is turned
  • Constructor Details

  • Method Details

    • setBookAccess

      public void setBookAccess(BookViewScreen.BookAccess pBookAccess)
    • setPage

      public boolean setPage(int pPageNum)
      Moves the book to the specified page and returns true if it exists, false otherwise.
    • forcePage

      protected boolean forcePage(int pPageNum)
      I'm not sure why this exists. The function it calls is public and does all the work.
    • init

      protected void init()
      Overrides:
      init in class Screen
    • getNarrationMessage

      public Component getNarrationMessage()
      Overrides:
      getNarrationMessage in class Screen
    • getPageNumberMessage

      private Component getPageNumberMessage()
    • createMenuControls

      protected void createMenuControls()
    • createPageControlButtons

      protected void createPageControlButtons()
    • getNumPages

      private int getNumPages()
    • pageBack

      protected void pageBack()
    • pageForward

      protected void pageForward()
    • updateButtonVisibility

      private void updateButtonVisibility()
    • keyPressed

      public boolean keyPressed(KeyEvent p_445531_)
      Specified by:
      keyPressed in interface ContainerEventHandler
      Specified by:
      keyPressed in interface GuiEventListener
      Overrides:
      keyPressed in class Screen
    • render

      public void render(GuiGraphics p_281997_, int p_281262_, int p_283321_, float p_282251_)
      Description copied from interface: Renderable
      Renders the graphical user interface (GUI) element.
      Specified by:
      render in interface Renderable
      Overrides:
      render in class Screen
      Parameters:
      p_281997_ - the GuiGraphics object used for rendering.
      p_281262_ - the x-coordinate of the mouse cursor.
      p_283321_ - the y-coordinate of the mouse cursor.
      p_282251_ - the partial tick time.
    • visitText

      private void visitText(ActiveTextCollector pActiveTextCollector, boolean pContentOnly)
    • renderBackground

      public void renderBackground(GuiGraphics p_295678_, int p_296491_, int p_294260_, float p_294869_)
      Overrides:
      renderBackground in class Screen
    • backgroundLeft

      private int backgroundLeft()
    • backgroundTop

      private int backgroundTop()
    • mouseClicked

      public boolean mouseClicked(MouseButtonEvent p_446030_, boolean p_434370_)
    • handleClickEvent

      protected boolean handleClickEvent(@Nullable ClickEvent pClickEvent)
    • closeContainerOnServer

      protected void closeContainerOnServer()
    • isInGameUi

      public boolean isInGameUi()
      Overrides:
      isInGameUi in class Screen