Class BreedAnimalsObjective
java.lang.Object
com.ryankshah.questapi.api.quest.objective.impl.BreedAnimalsObjective
- All Implemented Interfaces:
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<BreedAnimalsObjective> static final ObjectiveType<BreedAnimalsObjective> static final net.minecraft.resources.Identifier -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcaptureBaseline(QuestContext context) Called once when the objective's quest becomesACTIVE.net.minecraft.network.chat.Componentdescribe()Human-readable description of the objective, e.g.intevaluate(QuestContext context, ObjectiveProgress progress, net.minecraft.resources.Identifier eventKey, int eventValue) Computes the new absolute progress amount for this objective.net.minecraft.world.item.ItemStackicon()Icon rendered next to this objective in the default GUI.intThe amount of progress required to complete this objective.net.minecraft.resources.IdentifiertypeId()The registeredObjectiveTypeidentifier for this definition.
-
Field Details
-
TYPE_ID
public static final net.minecraft.resources.Identifier TYPE_ID -
CODEC
-
TYPE
-
-
Constructor Details
-
BreedAnimalsObjective
public BreedAnimalsObjective(int amount)
-
-
Method Details
-
typeId
public net.minecraft.resources.Identifier typeId()Description copied from interface:ObjectiveDefinitionThe registeredObjectiveTypeidentifier for this definition.- Specified by:
typeIdin interfaceObjectiveDefinition
-
describe
public net.minecraft.network.chat.Component describe()Description copied from interface:ObjectiveDefinitionHuman-readable description of the objective, e.g. "Obtain 10 Diamond".- Specified by:
describein interfaceObjectiveDefinition
-
targetAmount
public int targetAmount()Description copied from interface:ObjectiveDefinitionThe amount of progress required to complete this objective.- Specified by:
targetAmountin interfaceObjectiveDefinition
-
icon
public net.minecraft.world.item.ItemStack icon()Description copied from interface:ObjectiveDefinitionIcon rendered next to this objective in the default GUI.- Specified by:
iconin interfaceObjectiveDefinition
-
evaluate
public int evaluate(QuestContext context, ObjectiveProgress progress, net.minecraft.resources.Identifier eventKey, int eventValue) Description copied from interface:ObjectiveDefinitionComputes the new absolute progress amount for this objective.- Specified by:
evaluatein interfaceObjectiveDefinition- Parameters:
context- the evaluating player's contextprogress- the current runtime progress (must not be mutated directly; return the new value)eventKey-ObjectiveEventKeys.TICKfor a periodic poll, or a specific event key for a push-based updateeventValue- 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
Description copied from interface:ObjectiveDefinitionCalled once when the objective's quest becomesACTIVE. 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:
captureBaselinein interfaceObjectiveDefinition
-