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
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionResearch(net.minecraft.network.chat.Component name, 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()final booleanIndicates whether some other object is "equal to" this one.final 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, ResearchTier tier, List<ResearchStage> stages, boolean abandonable, boolean repeatable, boolean unique) Creates an instance of aResearchrecord class.- Parameters:
name- the value for thenamerecord 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
-
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 '=='. -
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
-