Class FoliosReader

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

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

  • Constructor Details

    • FoliosReader

      public FoliosReader(FoliosBook book, FoliosSession session, @Nullable FoliosBook.Location at)
    • FoliosReader

      public FoliosReader(FoliosBook book, FoliosSession session, @Nullable FoliosBook.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

    • keepCurrent

      public void keepCurrent()
      Reads on from pages laid out again when what they were laid out from changed (a live list a page observes, the reader's progress, the language), at the same place; not while a leaf is turning.
    • useSession

      public void useSession(FoliosSession next)
      Reads on from pages laid out to another size (the screen's GUI scale or window changed): at the same place, an entry's page found again by the page of its JSON it came from, any other part at the same page as far as it goes.
    • 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 FoliosReveal.Use revealOf(FoliosReader.Spot at)
      The reveal a spread's pages use: its entry's own, or the book's.
    • revealing

      public FoliosPainter revealing(FoliosPainter painter, FoliosReader.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(FoliosPainter painter, FoliosPageElement.Laid page, FoliosReader.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<FoliosPageElement.Laid> chapter(String key)
    • page

      public @Nullable FoliosPageElement.Laid page(FoliosReader.Spot at, int offset)
    • chrome

      public void chrome(FoliosPainter painter, FoliosReader.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 (FoliosBook.Layout).
      Parameters:
      shut - what the shut clasp does; null for a book with none
    • tabColor

      public int tabColor(@Nullable FoliosCategory category, FoliosPalette 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 FoliosCategory category, FoliosPalette 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 FoliosCategory 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 FoliosCategory 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(FoliosReader.Spot next)
    • moveAlong

      public void moveAlong(FoliosReader.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()
    • pinned

      public @Nullable FoliosPopup pinned()
    • unpin

      public void unpin()
    • mention

      public boolean mention(boolean right)
      Mentions a page of the open spread in chat (FoliosMentions): the right one, or the left; the book's front from its front spread. False where there is no page to mention (a list of entries, a search).
    • follow

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

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

      public @Nullable FoliosBook.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 FoliosEntry entry()
      The entry open, if an entry is.
    • category

      public @Nullable FoliosCategory 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.