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
  • Field Details

    • REGISTRY_CODEC

      public static final com.mojang.serialization.Codec<Research> REGISTRY_CODEC
    • CODEC

      public static final com.mojang.serialization.Codec<net.minecraft.core.Holder<Research>> 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 a Research record class.
      Parameters:
      name - the value for the name record component
      tier - the value for the tier record component
      stages - the value for the stages record component
      abandonable - the value for the abandonable record component
      repeatable - the value for the repeatable record component
      unique - the value for the unique record component
  • Method Details

    • read

      public static Research read(net.minecraft.network.FriendlyByteBuf buffer)
      Reads a Research from the given FriendlyByteBuf. This will be a client representation of the research, and as such will be missing details not required for client usage.
      Parameters:
      buffer - The FriendlyByteBuf to read from.
      Returns:
      The read Research instance.
    • id

      public net.minecraft.resources.ResourceLocation id()
      A utility method for getting the ResourceLocation of this Research from the PixelmonRegistry.RESEARCH_REGISTRY
      Returns:
      The ResourceLocation of this Research
    • name

      public net.minecraft.network.chat.Component name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • isAssignment

      public boolean isAssignment()
      A utility method for determining if the Research is an assignment.
      Returns:
      true if the Research is an assignment, false otherwise
    • isCollection

      public boolean isCollection()
      A utility method for determining if the Research is a collection.
      Returns:
      true if the Research is a collection, false otherwise
    • toJson

      public com.google.gson.JsonElement toJson()
      Converts the Research to a JsonElement using the REGISTRY_CODEC
      Returns:
      The Research as a JsonElement
    • saveToFile

      public void saveToFile(File file) throws IOException
      Saves the Research to a file using the toJson() method
      Parameters:
      file - The file to save the Research to
      Throws:
      IOException - If an error occurs while saving the file
    • write

      public void write(net.minecraft.network.FriendlyByteBuf buffer)
      Writes the Research to a given buffer.
      Parameters:
      buffer - The buffer to write to.
    • builder

      public static Research.Builder builder()
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • tier

      public ResearchTier tier()
      Returns the value of the tier record component.
      Returns:
      the value of the tier record component
    • stages

      public List<ResearchStage> stages()
      Returns the value of the stages record component.
      Returns:
      the value of the stages record component
    • abandonable

      public boolean abandonable()
      Returns the value of the abandonable record component.
      Returns:
      the value of the abandonable record component
    • repeatable

      public boolean repeatable()
      Returns the value of the repeatable record component.
      Returns:
      the value of the repeatable record component
    • unique

      public boolean unique()
      Returns the value of the unique record component.
      Returns:
      the value of the unique record component