Record Class GuideRecord

java.lang.Object
java.lang.Record
net.ixdarklord.folios.internal.GuideRecord
Record Components:
read - the entries read, by id
seen - the spreads shown in full, as "<chapter>|<page>" (a chapter: home, entry:<id>, category:<id>...)
questsDone - the quests whose completion has been told
celebrated - what has been celebrated: category:<id>, mastery
bookmarks - the places bookmarked, oldest first
last - the entry page last open
leftOpen - whether a handheld book was put away lying open
lastChapter - the spread last open when it wasn't an entry's (its chapter key), with lastPage

public record GuideRecord(List<String> read, List<String> seen, List<String> questsDone, List<String> celebrated, List<GuideRecord.Place> bookmarks, Optional<GuideRecord.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 (GuideRegistry.READING), or on the book's own stack for a book that keeps its own (GuideRegistry.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.
  • Field Details

    • EMPTY

      public static final GuideRecord EMPTY
    • MAX_EACH

      public static final int MAX_EACH
      How 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

      public static final com.mojang.serialization.Codec<GuideRecord> CODEC
    • STREAM_CODEC

      public static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf, GuideRecord> STREAM_CODEC
  • Constructor Details

    • GuideRecord

      public GuideRecord(List<String> read, List<String> seen, List<String> questsDone, List<String> celebrated, List<GuideRecord.Place> bookmarks, Optional<GuideRecord.Place> last, boolean leftOpen, Optional<String> lastChapter, int lastPage)
      Creates an instance of a GuideRecord record class.
      Parameters:
      read - the value for the read record component
      seen - the value for the seen record component
      questsDone - the value for the questsDone record component
      celebrated - the value for the celebrated record component
      bookmarks - the value for the bookmarks record component
      last - the value for the last record component
      leftOpen - the value for the leftOpen record component
      lastChapter - the value for the lastChapter record component
      lastPage - the value for the lastPage record component
  • Method Details

    • capped

      public GuideRecord capped()
      The record within the limits: as a client sent it, cut short where it is longer.
    • forStack

      public GuideRecord forStack()
      What a book's own stack keeps: its reading, without the player's quests and celebrations.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • read

      public List<String> read()
      Returns the value of the read record component.
      Returns:
      the value of the read record component
    • seen

      public List<String> seen()
      Returns the value of the seen record component.
      Returns:
      the value of the seen record component
    • questsDone

      public List<String> questsDone()
      Returns the value of the questsDone record component.
      Returns:
      the value of the questsDone record component
    • celebrated

      public List<String> celebrated()
      Returns the value of the celebrated record component.
      Returns:
      the value of the celebrated record component
    • bookmarks

      public List<GuideRecord.Place> bookmarks()
      Returns the value of the bookmarks record component.
      Returns:
      the value of the bookmarks record component
    • last

      public Optional<GuideRecord.Place> last()
      Returns the value of the last record component.
      Returns:
      the value of the last record component
    • leftOpen

      public boolean leftOpen()
      Returns the value of the leftOpen record component.
      Returns:
      the value of the leftOpen record component
    • lastChapter

      public Optional<String> lastChapter()
      Returns the value of the lastChapter record component.
      Returns:
      the value of the lastChapter record component
    • lastPage

      public int lastPage()
      Returns the value of the lastPage record component.
      Returns:
      the value of the lastPage record component