Record Class FoliosLock

java.lang.Object
java.lang.Record
net.ixdarklord.folios.api.client.FoliosLock
Record Components:
book - the book it is in, whose reading its conditions ask about

public record FoliosLock(@Nullable net.minecraft.resources.ResourceLocation book, List<FoliosObjective> requires, boolean secret, boolean showUnlock, float peek) extends Record
What keeps a category, entry, page or element closed until the player has earned it. In JSON these are fields of the thing locked:
  • "requires": a condition, written as a quest objective is (FoliosObjective), or a list of them all of which must hold: "requires": {"advancement": "mymod:story/found_ore"}, "requires": [{"read": "basics/first_steps"}, {"obtained": "minecraft:diamond"}];
  • "secret": true: left out until it opens, where it would otherwise be shown locked (???).
  • "show_list": false: a locked page or element shown without the list of what opens it.
  • "peek": a float, how plainly a locked page or element shows a glimpse of itself behind its seal, 1.0 by default: 0.5 half as plainly, 2.0 twice as plainly, 0.0 not at all.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final FoliosLock
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    FoliosLock(@Nullable net.minecraft.resources.ResourceLocation book, List<FoliosObjective> requires, boolean secret)
    A lock that shows what opens it, and gives a glimpse of what it keeps.
    FoliosLock(@Nullable net.minecraft.resources.ResourceLocation book, List<FoliosObjective> requires, boolean secret, boolean showUnlock)
    A lock that gives a glimpse of what it keeps.
    FoliosLock(@Nullable net.minecraft.resources.ResourceLocation book, List<FoliosObjective> requires, boolean secret, boolean showUnlock, float peek)
    Creates an instance of a FoliosLock record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable net.minecraft.resources.ResourceLocation
    Returns the value of the book record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
     
    boolean
    Whether it is shown at all: open, or locked but not secret.
    float
    Returns the value of the peek record component.
    static FoliosLock
    read(com.google.gson.JsonObject json, @Nullable net.minecraft.resources.ResourceLocation book)
    The lock an object of a book's JSON (a category, an entry, a page or an element) has.
    Returns the value of the requires record component.
    boolean
    Returns the value of the secret record component.
    boolean
    Returns the value of the showUnlock record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • FoliosLock

      public FoliosLock(@Nullable @Nullable net.minecraft.resources.ResourceLocation book, List<FoliosObjective> requires, boolean secret)
      A lock that shows what opens it, and gives a glimpse of what it keeps.
    • FoliosLock

      public FoliosLock(@Nullable @Nullable net.minecraft.resources.ResourceLocation book, List<FoliosObjective> requires, boolean secret, boolean showUnlock)
      A lock that gives a glimpse of what it keeps.
    • FoliosLock

      public FoliosLock(@Nullable @Nullable net.minecraft.resources.ResourceLocation book, List<FoliosObjective> requires, boolean secret, boolean showUnlock, float peek)
      Creates an instance of a FoliosLock record class.
      Parameters:
      book - the value for the book record component
      requires - the value for the requires record component
      secret - the value for the secret record component
      showUnlock - the value for the showUnlock record component
      peek - the value for the peek record component
  • Method Details

    • read

      public static FoliosLock read(com.google.gson.JsonObject json, @Nullable @Nullable net.minecraft.resources.ResourceLocation book)
      The lock an object of a book's JSON (a category, an entry, a page or an element) has.
    • isOpen

      public boolean isOpen()
    • isVisible

      public boolean isVisible()
      Whether it is shown at all: open, or locked but not secret.
    • 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 '=='.
      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.
    • book

      @Nullable public @Nullable net.minecraft.resources.ResourceLocation book()
      Returns the value of the book record component.
      Returns:
      the value of the book record component
    • requires

      public List<FoliosObjective> requires()
      Returns the value of the requires record component.
      Returns:
      the value of the requires record component
    • secret

      public boolean secret()
      Returns the value of the secret record component.
      Returns:
      the value of the secret record component
    • showUnlock

      public boolean showUnlock()
      Returns the value of the showUnlock record component.
      Returns:
      the value of the showUnlock record component
    • peek

      public float peek()
      Returns the value of the peek record component.
      Returns:
      the value of the peek record component