Record Class QuestTask

java.lang.Object
java.lang.Record
fr.pacdu.pacpackquests.QuestTask
Record Components:
type - The TaskType defining the nature of the objective.
target - The target registry ID, tag, or dimension/biome identifier to match.
requiredAmount - The amount of times the objective must be completed.

public record QuestTask(TaskType type, String target, int requiredAmount) extends Record
Represents an individual task or objective within a quest (e.g. mine a block, craft an item, visit a biome). A quest can contain one or multiple tasks.
  • Constructor Details

    • QuestTask

      public QuestTask(TaskType type, String target, int requiredAmount)
      Creates an instance of a QuestTask record class.
      Parameters:
      type - the value for the type record component
      target - the value for the target record component
      requiredAmount - the value for the requiredAmount record component
  • Method Details

    • of

      public static QuestTask of(TaskType type, String target, int requiredAmount)
      Creates a new QuestTask instance.
      Parameters:
      type - The type of task.
      target - The target identifier.
      requiredAmount - The target count required.
      Returns:
      A new QuestTask instance.
    • write

      public void write(net.minecraft.network.FriendlyByteBuf buf)
      Serializes this task into a FriendlyByteBuf.
      Parameters:
      buf - The buffer to write into.
    • read

      public static QuestTask read(net.minecraft.network.FriendlyByteBuf buf)
      Deserializes a QuestTask from a FriendlyByteBuf.
      Parameters:
      buf - The buffer to read from.
      Returns:
      The deserialized QuestTask.
    • 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.
    • type

      public TaskType type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • target

      public String target()
      Returns the value of the target record component.
      Returns:
      the value of the target record component
    • requiredAmount

      public int requiredAmount()
      Returns the value of the requiredAmount record component.
      Returns:
      the value of the requiredAmount record component