Record Class Research
java.lang.Object
java.lang.Record
com.pixelmonmod.pixelmon.api.research.Research
- Record Components:
name
- The name of the research, displayed in the UI.description
- The description of the research, displayed in the UI.tier
- The tier of the research, used to determine the difficulty and rewards.stages
- The stages of the research, each containing objectives that must be completed.abandonable
- Whether the research can be abandoned by the player.repeatable
- Whether the research can be repeated by the player.unique
- If the player can have multiple copies of this research.
public record Research(net.minecraft.network.chat.Component name, net.minecraft.network.chat.Component description, ResearchTier tier, List<ResearchStage> stages, boolean abandonable, boolean repeatable, boolean unique)
extends Record
Research is a set of tiers, with each tier containing objectives that must be completed in order to
progress to the next tier.
Single tier, single objective research is considered an assignment.
Single tier, multiple objective research is considered a collection.
Single tier, single objective research is considered an assignment.
Single tier, multiple objective research is considered a collection.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionResearch
(net.minecraft.network.chat.Component name, net.minecraft.network.chat.Component description, ResearchTier tier, List<ResearchStage> stages, boolean abandonable, boolean repeatable, boolean unique) Creates an instance of aResearch
record class. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns the value of theabandonable
record component.static Research.Builder
builder()
net.minecraft.network.chat.Component
Returns the value of thedescription
record component.final boolean
Indicates whether some other object is "equal to" this one.boolean
final int
hashCode()
Returns a hash code value for this object.net.minecraft.resources.ResourceLocation
id()
A utility method for getting theResourceLocation
of thisResearch
from thePixelmonRegistry.RESEARCH_REGISTRY
boolean
A utility method for determining if theResearch
is an assignment.boolean
A utility method for determining if theResearch
is a collection.net.minecraft.network.chat.Component
name()
Returns the value of thename
record component.static Research
read
(net.minecraft.network.FriendlyByteBuf buffer) Reads aResearch
from the givenFriendlyByteBuf
.boolean
Returns the value of therepeatable
record component.void
saveToFile
(File file) stages()
Returns the value of thestages
record component.tier()
Returns the value of thetier
record component.com.google.gson.JsonElement
toJson()
final String
toString()
Returns a string representation of this record class.boolean
unique()
Returns the value of theunique
record component.void
write
(net.minecraft.network.FriendlyByteBuf buffer) Writes theResearch
to a given buffer.
-
Field Details
-
REGISTRY_CODEC
-
CODEC
-
-
Constructor Details
-
Research
public Research(net.minecraft.network.chat.Component name, net.minecraft.network.chat.Component description, ResearchTier tier, List<ResearchStage> stages, boolean abandonable, boolean repeatable, boolean unique) Creates an instance of aResearch
record class.- Parameters:
name
- the value for thename
record componentdescription
- the value for thedescription
record componenttier
- the value for thetier
record componentstages
- the value for thestages
record componentabandonable
- the value for theabandonable
record componentrepeatable
- the value for therepeatable
record componentunique
- the value for theunique
record component
-
-
Method Details
-
read
Reads aResearch
from the givenFriendlyByteBuf
. This will be a client representation of the research, and as such will be missing details not required for client usage.- Parameters:
buffer
- TheFriendlyByteBuf
to read from.- Returns:
- The read
Research
instance.
-
id
public net.minecraft.resources.ResourceLocation id()A utility method for getting theResourceLocation
of thisResearch
from thePixelmonRegistry.RESEARCH_REGISTRY
- Returns:
- The
ResourceLocation
of thisResearch
-
name
public net.minecraft.network.chat.Component name()Returns the value of thename
record component.- Returns:
- the value of the
name
record component
-
hasDescription
public boolean hasDescription() -
isAssignment
public boolean isAssignment()A utility method for determining if theResearch
is an assignment.- Returns:
true
if theResearch
is an assignment,false
otherwise
-
isCollection
public boolean isCollection()A utility method for determining if theResearch
is a collection.- Returns:
true
if theResearch
is a collection,false
otherwise
-
toJson
public com.google.gson.JsonElement toJson()- Returns:
- The
Research
as aJsonElement
-
saveToFile
- Parameters:
file
- The file to save theResearch
to- Throws:
IOException
- If an error occurs while saving the file
-
write
public void write(net.minecraft.network.FriendlyByteBuf buffer) Writes theResearch
to a given buffer.- Parameters:
buffer
- The buffer to write to.
-
builder
-
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. -
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. -
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 '=='. -
description
public net.minecraft.network.chat.Component description()Returns the value of thedescription
record component.- Returns:
- the value of the
description
record component
-
tier
Returns the value of thetier
record component.- Returns:
- the value of the
tier
record component
-
stages
Returns the value of thestages
record component.- Returns:
- the value of the
stages
record component
-
abandonable
public boolean abandonable()Returns the value of theabandonable
record component.- Returns:
- the value of the
abandonable
record component
-
repeatable
public boolean repeatable()Returns the value of therepeatable
record component.- Returns:
- the value of the
repeatable
record component
-
unique
public boolean unique()Returns the value of theunique
record component.- Returns:
- the value of the
unique
record component
-