Record Class FoliosRecord
java.lang.Object
java.lang.Record
net.ixdarklord.folios.internal.FoliosRecord
- Record Components:
read- the entries read, by idseen- the spreads shown in full, as"<chapter>|<page>"(a chapter:home,entry:<id>,category:<id>...)questsDone- the quests whose completion has been toldcelebrated- what has been celebrated:category:<id>,masteryobtained- the items the player has had that the book's "obtained" locks and objectives ask for, by idbookmarks- the places bookmarked, oldest firstlast- the entry page last openleftOpen- whether a handheld book was put away lying openlastChapter- the spread last open when it wasn't an entry's (its chapter key), withlastPage
public record FoliosRecord(List<String> read, List<String> seen, List<String> questsDone, List<String> celebrated, List<String> obtained, List<FoliosRecord.Place> bookmarks, Optional<FoliosRecord.Place> last, boolean leftOpen, Optional<String> lastChapter, int lastPage)
extends Record
What a reader has done with one book: the entries read, the spreads shown (for reveals that play only on unread
pages), the quests done and what has been celebrated, the bookmarks, and where they left off. Kept on the server: with
the player (
FoliosRegistry.READING), or on the book's own stack for a book that keeps its own
(FoliosRegistry.BOOK_READING). Books are client resources, so the client works it out and sends it; the server
only keeps it. Immutable: a change is a new record.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<FoliosRecord> static final FoliosRecordstatic final intstatic final intHow many of each list a record keeps; more than any book has, less than a client could send to fill a save.static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf, FoliosRecord> -
Constructor Summary
ConstructorsConstructorDescriptionFoliosRecord(List<String> read, List<String> seen, List<String> questsDone, List<String> celebrated, List<String> obtained, List<FoliosRecord.Place> bookmarks, Optional<FoliosRecord.Place> last, boolean leftOpen, Optional<String> lastChapter, int lastPage) Creates an instance of aFoliosRecordrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thebookmarksrecord component.capped()The record within the limits: as a client sent it, cut short where it is longer.Returns the value of thecelebratedrecord component.final booleanIndicates whether some other object is "equal to" this one.forStack()What a book's own stack keeps: its reading, without the player's quests, celebrations and items had.final inthashCode()Returns a hash code value for this object.last()Returns the value of thelastrecord component.Returns the value of thelastChapterrecord component.intlastPage()Returns the value of thelastPagerecord component.booleanleftOpen()Returns the value of theleftOpenrecord component.obtained()Returns the value of theobtainedrecord component.Returns the value of thequestsDonerecord component.read()Returns the value of thereadrecord component.seen()Returns the value of theseenrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
EMPTY
-
MAX_EACH
public static final int MAX_EACHHow many of each list a record keeps; more than any book has, less than a client could send to fill a save.- See Also:
-
MAX_BOOKMARKS
public static final int MAX_BOOKMARKS- See Also:
-
CODEC
-
STREAM_CODEC
public static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf, FoliosRecord> STREAM_CODEC
-
-
Constructor Details
-
FoliosRecord
public FoliosRecord(List<String> read, List<String> seen, List<String> questsDone, List<String> celebrated, List<String> obtained, List<FoliosRecord.Place> bookmarks, Optional<FoliosRecord.Place> last, boolean leftOpen, Optional<String> lastChapter, int lastPage) Creates an instance of aFoliosRecordrecord class.- Parameters:
read- the value for thereadrecord componentseen- the value for theseenrecord componentquestsDone- the value for thequestsDonerecord componentcelebrated- the value for thecelebratedrecord componentobtained- the value for theobtainedrecord componentbookmarks- the value for thebookmarksrecord componentlast- the value for thelastrecord componentleftOpen- the value for theleftOpenrecord componentlastChapter- the value for thelastChapterrecord componentlastPage- the value for thelastPagerecord component
-
-
Method Details
-
capped
The record within the limits: as a client sent it, cut short where it is longer. -
forStack
What a book's own stack keeps: its reading, without the player's quests, celebrations and items had. -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
read
-
seen
-
questsDone
Returns the value of thequestsDonerecord component.- Returns:
- the value of the
questsDonerecord component
-
celebrated
Returns the value of thecelebratedrecord component.- Returns:
- the value of the
celebratedrecord component
-
obtained
-
bookmarks
-
last
-
leftOpen
-
lastChapter
Returns the value of thelastChapterrecord component.- Returns:
- the value of the
lastChapterrecord component
-
lastPage
public int lastPage()Returns the value of thelastPagerecord component.- Returns:
- the value of the
lastPagerecord component
-