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.Identifier 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 -
Constructor Summary
ConstructorsConstructorDescriptionFoliosLock(@Nullable net.minecraft.resources.Identifier 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.Identifier book, List<FoliosObjective> requires, boolean secret, boolean showUnlock) A lock that gives a glimpse of what it keeps.FoliosLock(@Nullable net.minecraft.resources.Identifier book, List<FoliosObjective> requires, boolean secret, boolean showUnlock, float peek) Creates an instance of aFoliosLockrecord class. -
Method Summary
Modifier and TypeMethodDescription@Nullable net.minecraft.resources.Identifierbook()Returns the value of thebookrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisOpen()booleanWhether it is shown at all: open, or locked but not secret.floatpeek()Returns the value of thepeekrecord component.static FoliosLockread(com.google.gson.JsonObject json, @Nullable net.minecraft.resources.Identifier book) The lock an object of a book's JSON (a category, an entry, a page or an element) has.requires()Returns the value of therequiresrecord component.booleansecret()Returns the value of thesecretrecord component.booleanReturns the value of theshowUnlockrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
NONE
-
-
Constructor Details
-
FoliosLock
public FoliosLock(@Nullable net.minecraft.resources.Identifier 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 net.minecraft.resources.Identifier book, List<FoliosObjective> requires, boolean secret, boolean showUnlock) A lock that gives a glimpse of what it keeps. -
FoliosLock
public FoliosLock(@Nullable net.minecraft.resources.Identifier book, List<FoliosObjective> requires, boolean secret, boolean showUnlock, float peek) Creates an instance of aFoliosLockrecord class.- Parameters:
book- the value for thebookrecord componentrequires- the value for therequiresrecord componentsecret- the value for thesecretrecord componentshowUnlock- the value for theshowUnlockrecord componentpeek- the value for thepeekrecord component
-
-
Method Details
-
read
public static FoliosLock read(com.google.gson.JsonObject json, @Nullable net.minecraft.resources.Identifier 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
-
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. -
book
-
requires
Returns the value of therequiresrecord component.- Returns:
- the value of the
requiresrecord component
-
secret
public boolean secret()Returns the value of thesecretrecord component.- Returns:
- the value of the
secretrecord component
-
showUnlock
public boolean showUnlock()Returns the value of theshowUnlockrecord component.- Returns:
- the value of the
showUnlockrecord component
-
peek
public float peek()Returns the value of thepeekrecord component.- Returns:
- the value of the
peekrecord component
-