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 aResearchrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of theabandonablerecord component.static Research.Builderbuilder()net.minecraft.network.chat.ComponentReturns the value of thedescriptionrecord component.final booleanIndicates whether some other object is "equal to" this one.booleanfinal inthashCode()Returns a hash code value for this object.net.minecraft.resources.ResourceLocationid()A utility method for getting theResourceLocationof thisResearchfrom thePixelmonRegistry.RESEARCH_REGISTRYbooleanA utility method for determining if theResearchis an assignment.booleanA utility method for determining if theResearchis a collection.net.minecraft.network.chat.Componentname()Returns the value of thenamerecord component.static Researchread(net.minecraft.network.FriendlyByteBuf buffer) Reads aResearchfrom the givenFriendlyByteBuf.booleanReturns the value of therepeatablerecord component.voidsaveToFile(File file) stages()Returns the value of thestagesrecord component.tier()Returns the value of thetierrecord component.com.google.gson.JsonElementtoJson()final StringtoString()Returns a string representation of this record class.booleanunique()Returns the value of theuniquerecord component.voidwrite(net.minecraft.network.FriendlyByteBuf buffer) Writes theResearchto 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 aResearchrecord class.- Parameters:
name- the value for thenamerecord componentdescription- the value for thedescriptionrecord componenttier- the value for thetierrecord componentstages- the value for thestagesrecord componentabandonable- the value for theabandonablerecord componentrepeatable- the value for therepeatablerecord componentunique- the value for theuniquerecord component
-
-
Method Details
-
read
Reads aResearchfrom 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- TheFriendlyByteBufto read from.- Returns:
- The read
Researchinstance.
-
id
public net.minecraft.resources.ResourceLocation id()A utility method for getting theResourceLocationof thisResearchfrom thePixelmonRegistry.RESEARCH_REGISTRY- Returns:
- The
ResourceLocationof thisResearch
-
name
public net.minecraft.network.chat.Component name()Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
hasDescription
public boolean hasDescription() -
isAssignment
public boolean isAssignment()A utility method for determining if theResearchis an assignment.- Returns:
trueif theResearchis an assignment,falseotherwise
-
isCollection
public boolean isCollection()A utility method for determining if theResearchis a collection.- Returns:
trueif theResearchis a collection,falseotherwise
-
toJson
public com.google.gson.JsonElement toJson()- Returns:
- The
Researchas aJsonElement
-
saveToFile
- Parameters:
file- The file to save theResearchto- Throws:
IOException- If an error occurs while saving the file
-
write
public void write(net.minecraft.network.FriendlyByteBuf buffer) Writes theResearchto 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 thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
tier
Returns the value of thetierrecord component.- Returns:
- the value of the
tierrecord component
-
stages
Returns the value of thestagesrecord component.- Returns:
- the value of the
stagesrecord component
-
abandonable
public boolean abandonable()Returns the value of theabandonablerecord component.- Returns:
- the value of the
abandonablerecord component
-
repeatable
public boolean repeatable()Returns the value of therepeatablerecord component.- Returns:
- the value of the
repeatablerecord component
-
unique
public boolean unique()Returns the value of theuniquerecord component.- Returns:
- the value of the
uniquerecord component
-