Class GuideReader
java.lang.Object
net.ixdarklord.folios.internal.client.GuideReader
- All Implemented Interfaces:
AbstractPainter.Navigator
- Direct Known Subclasses:
HandheldBook
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordLeaves in the air: what was open and what is opening (their pages and spreads), and which way they turn.static final recordA place in the book: a part of it ("home", "category:", "entry: ", "search: ", "bookmarks", "index") and the left page of a spread. -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal GuideBook@Nullable GuideReader.Flipstatic final floatfinal GuideMemoryfinal GuideSessionfinal TabMotionHow the book's ribbon tabs move. -
Constructor Summary
ConstructorsConstructorDescriptionGuideReader(GuideBook book, GuideSession session, @Nullable GuideBook.Location at) GuideReader(GuideBook book, GuideSession session, @Nullable GuideBook.Location at, @Nullable net.minecraft.world.InteractionHand hand) A reader of a book opened from a copy inhand(null for none: a command, a link, from code): a book that keeps its own progress reads and keeps that copy's. -
Method Summary
Modifier and TypeMethodDescriptionvoidback()voidprotected booleancanMove()Whether the reader can move about now (a handheld book can't while it is being raised or shut).booleancanTurn(int direction) @Nullable GuideCategorycategory()The category the reader is in: open, or the one of the entry open.voidvoidchrome(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.voiddrawRevealed(GuidePainter painter, GuidePage.Laid page, GuideReader.Spot at, boolean right) Draws a page of the spread atat(its right page, or its left) as its reveal has it now, with what its effect draws over it.@Nullable GuideEntryentry()The entry open, if an entry is.floatHow far the leaf in the air has turned, 0 to 1; 1 when none is.voidvoidgo(GuideReader.Spot next) boolean@Nullable GuideBook.Locationhere()The page shown, to tell links to it apart from links elsewhere; null when none.voidhome()voidindex()voidmoveAlong(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.voidopen(GuideBook.Location location) @Nullable GuidePage.Laidpage(GuideReader.Spot at, int offset) int[]Entries read and entries open, in a category or (for null) the whole book.voidreveal()Starts the open spread's reveal again from the beginning (as a handheld book comes open).protected booleanWhether the open spread's reveal waits to start: its pages aren't shown yet.revealing(GuidePainter painter, GuideReader.Spot at, boolean right) The painter to draw a page's content through, for a page of the spread atat: 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 reveal a spread's pages use: its entry's own, or the book's.voidsave()Remembers where the reader left off.voidShows what a search finds.floatseconds()inttabColor(@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.inttabColor(@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(java.lang.String, boolean, boolean)).@Nullable net.minecraft.network.chat.ComponenttabDetail(@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.static StringtabKey(@Nullable GuideCategory category, String part) The key a tab moves by: its category, or the part of the book it opens ("home", "bookmarks", "index").voidturn(int direction) voidturnTo(int page) Goes to a spread of the open part, by its left page.
-
Field Details
-
FLIP_MILLIS
public static final float FLIP_MILLIS- See Also:
-
book
-
session
-
memory
-
spot
-
tabs
How the book's ribbon tabs move. -
flip
-
-
Constructor Details
-
GuideReader
-
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 inhand(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
The reveal a spread's pages use: its entry's own, or the book's. -
revealing
The painter to draw a page's content through, for a page of the spread atat: 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 atat(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
-
page
-
chrome
public void chrome(GuidePainter painter, GuideReader.Spot spot, boolean right, boolean pressable, @Nullable @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 @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
A tab's colour as it moves: from its resting colour at 0 to its full one at 1 (TabMotion.out(java.lang.String, boolean, boolean)). -
tabDetail
@Nullable public @Nullable net.minecraft.network.chat.Component tabDetail(@Nullable @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
The key a tab moves by: its category, or the part of the book it opens ("home", "bookmarks", "index"). -
progress
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
-
moveAlong
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
-
search
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
- Specified by:
followin interfaceAbstractPainter.Navigator
-
open
- Specified by:
openin interfaceAbstractPainter.Navigator
-
here
Description copied from interface:AbstractPainter.NavigatorThe page shown, to tell links to it apart from links elsewhere; null when none.- Specified by:
herein interfaceAbstractPainter.Navigator
-
entry
The entry open, if an entry is. -
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.
-