Class BreedAnimalsObjective

java.lang.Object
com.ryankshah.questapi.api.quest.objective.impl.BreedAnimalsObjective
All Implemented Interfaces:
ObjectiveDefinition

public final class BreedAnimalsObjective extends Object implements ObjectiveDefinition
Poll-based objective tracking the vanilla minecraft:animals_bred custom statistic, relative to a baseline captured when the quest became active. Counts any successful animal breeding, matching what the vanilla statistics screen reports - not limited to a single species.
  • Field Details

  • Constructor Details

    • BreedAnimalsObjective

      public BreedAnimalsObjective(int amount)
  • Method Details

    • typeId

      public net.minecraft.resources.Identifier typeId()
      Description copied from interface: ObjectiveDefinition
      The registered ObjectiveType identifier for this definition.
      Specified by:
      typeId in interface ObjectiveDefinition
    • describe

      public net.minecraft.network.chat.Component describe()
      Description copied from interface: ObjectiveDefinition
      Human-readable description of the objective, e.g. "Obtain 10 Diamond".
      Specified by:
      describe in interface ObjectiveDefinition
    • targetAmount

      public int targetAmount()
      Description copied from interface: ObjectiveDefinition
      The amount of progress required to complete this objective.
      Specified by:
      targetAmount in interface ObjectiveDefinition
    • icon

      public net.minecraft.world.item.ItemStack icon()
      Description copied from interface: ObjectiveDefinition
      Icon rendered next to this objective in the default GUI.
      Specified by:
      icon in interface ObjectiveDefinition
    • evaluate

      public int evaluate(QuestContext context, ObjectiveProgress progress, net.minecraft.resources.Identifier eventKey, int eventValue)
      Description copied from interface: ObjectiveDefinition
      Computes the new absolute progress amount for this objective.
      Specified by:
      evaluate in interface ObjectiveDefinition
      Parameters:
      context - the evaluating player's context
      progress - the current runtime progress (must not be mutated directly; return the new value)
      eventKey - ObjectiveEventKeys.TICK for a periodic poll, or a specific event key for a push-based update
      eventValue - an event-specific magnitude (e.g. the number of blocks placed in this event), meaningless for poll-based evaluation
      Returns:
      the new absolute progress amount, which will be clamped to [0, targetAmount()]
    • captureBaseline

      public int captureBaseline(QuestContext context)
      Description copied from interface: ObjectiveDefinition
      Called once when the objective's quest becomes ACTIVE. Used by stat-delta objectives (mining, crafting, kills) to record a baseline so that pre-existing statistics do not instantly complete the objective.
      Specified by:
      captureBaseline in interface ObjectiveDefinition