Class GuideReader

java.lang.Object
net.ixdarklord.folios.internal.client.GuideReader
All Implemented Interfaces:
AbstractPainter.Navigator
Direct Known Subclasses:
HandheldBook

public class GuideReader extends Object implements AbstractPainter.Navigator
  • Field Details

  • Constructor Details

    • GuideReader

      public GuideReader(GuideBook book, GuideSession session, @Nullable GuideBook.Location at)
    • GuideReader

      public GuideReader(GuideBook book, GuideSession session, @Nullable GuideBook.Location at, @Nullable net.minecraft.world.InteractionHand hand)
      A reader of a book opened from a copy in hand (null for none: a command, a link, from code): a book that keeps its own progress reads and keeps that copy's.
  • Method Details

    • seconds

      public float seconds()
    • revealHeld

      protected boolean revealHeld()
      Whether the open spread's reveal waits to start: its pages aren't shown yet.
    • reveal

      public void reveal()
      Starts the open spread's reveal again from the beginning (as a handheld book comes open).
    • revealOf

      public GuideReveal.Use revealOf(GuideReader.Spot at)
      The reveal a spread's pages use: its entry's own, or the book's.
    • revealing

      public GuidePainter revealing(GuidePainter painter, GuideReader.Spot at, boolean right)
      The painter to draw a page's content through, for a page of the spread at at: while a leaf turns, the spread it brings is hidden (its effect at the start), and once it is down its content shows as the effect has it. The page's own painter when there is nothing to reveal.
    • drawRevealed

      public void drawRevealed(GuidePainter painter, GuidePage.Laid page, GuideReader.Spot at, boolean right)
      Draws a page of the spread at at (its right page, or its left) as its reveal has it now, with what its effect draws over it.
    • canMove

      protected boolean canMove()
      Whether the reader can move about now (a handheld book can't while it is being raised or shut).
    • chapter

      public List<GuidePage.Laid> chapter(String key)
    • page

      public @Nullable GuidePage.Laid page(GuideReader.Spot at, int offset)
    • chrome

      public void chrome(GuidePainter painter, GuideReader.Spot spot, boolean right, boolean pressable, @Nullable Runnable shut)
      What is printed round a page's content: its number, the clasp in its lower outer corner that turns back (on a left page) or on (on a right page), and on a right page of a book that can be shut, the clasp at its head that shuts it. They belong to the page, so they turn with it; they are pressable only on a settled spread. Where the book's layout puts them (GuideBook.Layout).
      Parameters:
      shut - what the shut clasp does; null for a book with none
    • tabColor

      public int tabColor(@Nullable GuideCategory category, GuidePalette palette, boolean here, boolean hovered)
      A tab's colour: its category's own (or the book's accent, for the front, bookmarks and categories without one), full where the reader is, a little deeper under the pointer, and deeper still towards the cover otherwise.
    • tabColor

      public int tabColor(@Nullable GuideCategory category, GuidePalette palette, float out)
      A tab's colour as it moves: from its resting colour at 0 to its full one at 1 (TabMotion.out(String, boolean, boolean)).
    • tabDetail

      public @Nullable net.minecraft.network.chat.Component tabDetail(@Nullable GuideCategory category, String part)
      What a tab's tooltip says under its name: how much of a category has been read, what the others hold.
    • tabKey

      public static String tabKey(@Nullable GuideCategory category, String part)
      The key a tab moves by: its category, or the part of the book it opens ("home", "bookmarks", "index").
    • progress

      public int[] progress(@Nullable String category)
      Entries read and entries open, in a category or (for null) the whole book.
    • canTurn

      public boolean canTurn(int direction)
    • turn

      public void turn(int direction)
    • turnTo

      public void turnTo(int page)
      Goes to a spread of the open part, by its left page.
    • back

      public void back()
    • go

      public void go(GuideReader.Spot next)
    • moveAlong

      public void moveAlong(GuideReader.Spot next)
      Goes where someone this book is read along with has gone, turning a leaf the way theirs turned: onwards through the part they are in, back within it, onwards to another. Quiet: the sound is theirs, heard where they are.
    • flipProgress

      public float flipProgress()
      How far the leaf in the air has turned, 0 to 1; 1 when none is.
    • home

      public void home()
    • category

      public void category(String id)
    • search

      public void search(String query)
      Shows what a search finds. The leaf turns once, as the results first open; while they are open, a changed search changes them where they lie.
    • bookmarks

      public void bookmarks()
    • index

      public void index()
    • hasHistory

      public boolean hasHistory()
    • follow

      public void follow(String link)
      Specified by:
      follow in interface AbstractPainter.Navigator
    • open

      public void open(GuideBook.Location location)
      Specified by:
      open in interface AbstractPainter.Navigator
    • here

      public @Nullable GuideBook.Location here()
      Description copied from interface: AbstractPainter.Navigator
      The page shown, to tell links to it apart from links elsewhere; null when none.
      Specified by:
      here in interface AbstractPainter.Navigator
    • entry

      public @Nullable GuideEntry entry()
      The entry open, if an entry is.
    • category

      public @Nullable GuideCategory category()
      The category the reader is in: open, or the one of the entry open.
    • save

      public void save()
      Remembers where the reader left off.