Class McbsSivGoal

java.lang.Object
com.thecsdev.betterstats.api.mcbs.model.goal.McbsGoal
com.thecsdev.betterstats.api.mcbs.model.goal.McbsSivGoal
All Implemented Interfaces:
Cloneable

public final class McbsSivGoal extends McbsGoal
McbsGoal implementation whose goal is to achieve a specific stat integer value.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.MapCodec<McbsSivGoal>
    MapCodec implementation for serializing McbsSivGoal instances.
    static final net.minecraft.resources.Identifier
    getStatType() value that is used for McbsSivGoal instances constructed using the default McbsSivGoal() constructor.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    McbsSivGoal(@NotNull McbsSivGoal copyFrom)
     
    McbsSivGoal(@NotNull net.minecraft.resources.Identifier statType, @NotNull net.minecraft.resources.Identifier statSubject, int targetValue)
     
    McbsSivGoal(@NotNull net.minecraft.resources.Identifier statType, @NotNull net.minecraft.resources.Identifier statSubject, int fromValue, int targetValue)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final @NonNull McbsSivGoal
     
    final void
    copyFrom(@NotNull McbsSivGoal other)
    Copies values of all fields from the provided McbsSivGoal into this McbsSivGoal.
    final int
    The "starting point" value for this goal.
    final @NotNull net.minecraft.network.chat.Component
    Returns the user-friendy display text for what the goal's "objective" is.
    For example "Mine 100 Stone" or "Kill 30 Zombie" or "Travel 500 meters".
    final double
    getProgress(@NotNull McbsFile mcbsFile)
    Returns a value ranging from 0 to 1, that indicates current progress towards completing the goal.
    final @NotNull net.minecraft.network.chat.Component
    getProgressText(@NotNull McbsFile mcbsFile)
    Returns visual user-friendly text that indicates current progress towards completing the goal.
    final @NotNull net.minecraft.resources.Identifier
    The statistic subject's unique identifier.
    final @NotNull net.minecraft.resources.Identifier
    Returns the StatType's unique Identifier.
    final int
    The "target" value for this goal.
    final void
    setFromValue(int fromValue)
    Sets the value of getFromValue().
    final void
    setStatSubject(@NotNull net.minecraft.resources.Identifier statSubject)
    Sets the value of getStatSubject()
    final void
    setStatType(@NotNull net.minecraft.resources.Identifier statType)
    Sets the value of getStatType().
    final void
    setTargetValue(int targetValue)
    Sets the value of getTargetValue().

    Methods inherited from class McbsGoal

    getType, isDone

    Methods inherited from class Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • CODEC

      public static final com.mojang.serialization.MapCodec<McbsSivGoal> CODEC
      MapCodec implementation for serializing McbsSivGoal instances.
    • STID_EDITTHISGOAL

      public static final net.minecraft.resources.Identifier STID_EDITTHISGOAL
      getStatType() value that is used for McbsSivGoal instances constructed using the default McbsSivGoal() constructor.
  • Constructor Details

    • McbsSivGoal

      public McbsSivGoal()
    • McbsSivGoal

      public McbsSivGoal(@NotNull @NotNull net.minecraft.resources.Identifier statType, @NotNull @NotNull net.minecraft.resources.Identifier statSubject, int targetValue) throws NullPointerException
      Throws:
      NullPointerException
    • McbsSivGoal

      public McbsSivGoal(@NotNull @NotNull net.minecraft.resources.Identifier statType, @NotNull @NotNull net.minecraft.resources.Identifier statSubject, int fromValue, int targetValue) throws NullPointerException
      Throws:
      NullPointerException
    • McbsSivGoal

      public McbsSivGoal(@NotNull @NotNull McbsSivGoal copyFrom)
  • Method Details

    • clone

      public final @NonNull McbsSivGoal clone()
      Overrides:
      clone in class McbsGoal
    • getStatType

      @NotNull public final @NotNull net.minecraft.resources.Identifier getStatType()
      Returns the StatType's unique Identifier.
      See Also:
    • getStatSubject

      @NotNull public final @NotNull net.minecraft.resources.Identifier getStatSubject()
      The statistic subject's unique identifier.
      See Also:
    • getFromValue

      public final int getFromValue()
      The "starting point" value for this goal. This is the value that the progress calculation will consider as "0% progress".
    • getTargetValue

      public final int getTargetValue()
      The "target" value for this goal. This is the value that the progress calculation will consider as "100% progress".
    • setStatType

      public final void setStatType(@NotNull @NotNull net.minecraft.resources.Identifier statType) throws NullPointerException
      Sets the value of getStatType().
      Parameters:
      statType - The StatType's unique identifier.
      Throws:
      NullPointerException - If the argument is null.
    • setStatSubject

      public final void setStatSubject(@NotNull @NotNull net.minecraft.resources.Identifier statSubject) throws NullPointerException
      Sets the value of getStatSubject()
      Parameters:
      statSubject - The statistic subject.
      Throws:
      NullPointerException - If the argument is null.
    • setFromValue

      public final void setFromValue(int fromValue)
      Sets the value of getFromValue().
      Parameters:
      fromValue - The "starting point" value for this goal.
    • setTargetValue

      public final void setTargetValue(int targetValue)
      Sets the value of getTargetValue().
      Parameters:
      targetValue - The "target" value for this goal.
    • getProgress

      public final double getProgress(@NotNull @NotNull McbsFile mcbsFile) throws NullPointerException
      Description copied from class: McbsGoal
      Returns a value ranging from 0 to 1, that indicates current progress towards completing the goal. A value of 1 indicates that the goal is completed.
      Specified by:
      getProgress in class McbsGoal
      Parameters:
      mcbsFile - The McbsFile to check the progress for.
      Throws:
      NullPointerException - If the argument is null.
    • getProgressText

      @NotNull public final @NotNull net.minecraft.network.chat.Component getProgressText(@NotNull @NotNull McbsFile mcbsFile) throws NullPointerException
      Description copied from class: McbsGoal
      Returns visual user-friendly text that indicates current progress towards completing the goal. For example "15 / 25" or "1 / 3" and so on.
      Specified by:
      getProgressText in class McbsGoal
      Parameters:
      mcbsFile - The McbsFile to get the progress text for.
      Throws:
      NullPointerException - If the argument is null.
    • getObjectiveText

      @NotNull public final @NotNull net.minecraft.network.chat.Component getObjectiveText()
      Description copied from class: McbsGoal
      Returns the user-friendy display text for what the goal's "objective" is.
      For example "Mine 100 Stone" or "Kill 30 Zombie" or "Travel 500 meters".

      This differs from McbsGoalType.getName() in the fact that goal type name is a generic name that applies to all corresponding McbsGoal instances.

      Overrides:
      getObjectiveText in class McbsGoal
      See Also:
    • copyFrom

      public final void copyFrom(@NotNull @NotNull McbsSivGoal other) throws NullPointerException
      Copies values of all fields from the provided McbsSivGoal into this McbsSivGoal.
      Parameters:
      other - The McbsSivGoal to copy values from.
      Throws:
      NullPointerException - If the argument is null.