Record Class Research
java.lang.Object
java.lang.Record
com.pixelmonmod.pixelmon.api.research.Research
- Record Components:
name
-tier
-stages
-abandonable
-repeatable
-
public record Research(net.minecraft.network.chat.Component name, ResearchTier tier, List<ResearchStage> stages, boolean abandonable, boolean repeatable, boolean unique)
extends Record
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
ConstructorDescriptionResearch
(net.minecraft.network.chat.Component name, 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()
final boolean
Indicates whether some other object is "equal to" this one.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, 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 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
-
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 '=='. -
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
-