Package com.minecolonies.core.quests
Class QuestInstance
java.lang.Object
com.minecolonies.core.quests.QuestInstance
- All Implemented Interfaces:
IQuestInstance,net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
Instance of a specific quest type
-
Constructor Summary
ConstructorsConstructorDescriptionQuestInstance(IColony colony) Create an empty colony quest obj to deserialize the data from.QuestInstance(net.minecraft.resources.ResourceLocation questTemplateID, IColony colony, List<ITriggerReturnData<?>> triggerReturnData) Create a new colony quest. -
Method Summary
Modifier and TypeMethodDescriptionvoidadvanceObjective(net.minecraft.world.entity.player.Player player) Simple advance objective by one.advanceObjective(net.minecraft.world.entity.player.Player player, int nextObjective) Advance the quest objective to this id.voiddeserializeNBT(net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag nbt) Get the player UUID that accepted the quest.Get the colony matching the quest.@Nullable IObjectiveInstanceGet the objective data of the current objective.net.minecraft.resources.ResourceLocationgetId()Get the quest id of the quest.intGet the current objective index.getParticipant(int target) Get one of the other participants by index.Get the full list of quest participants.Get the id of the quest giver.intId of questgiver.intGet the id of the current task holder in the quest.booleanCheck if the expiration date relative to the colony day count was reached.voidOn question completion call.voidOn deletion of the quest.voidTriggered when the quest is acceptedvoidOn world load trigger.net.minecraft.nbt.CompoundTagserializeNBT(net.minecraft.core.HolderLookup.Provider provider)
-
Constructor Details
-
QuestInstance
public QuestInstance(net.minecraft.resources.ResourceLocation questTemplateID, IColony colony, List<ITriggerReturnData<?>> triggerReturnData) Create a new colony quest.- Parameters:
questTemplateID- the global id of the quest.colony- the colony it belongs to.triggerReturnData- the trigger return data that made this quest available.
-
QuestInstance
Create an empty colony quest obj to deserialize the data from.- Parameters:
colony- the colony it is assigned to.
-
-
Method Details
-
getColony
Description copied from interface:IQuestInstanceGet the colony matching the quest.- Specified by:
getColonyin interfaceIQuestInstance- Returns:
- the colony.
-
getAssignedPlayer
Description copied from interface:IQuestInstanceGet the player UUID that accepted the quest.- Specified by:
getAssignedPlayerin interfaceIQuestInstance- Returns:
- the player uuid.
-
onStart
Description copied from interface:IQuestInstanceTriggered when the quest is accepted- Specified by:
onStartin interfaceIQuestInstance- Parameters:
player- player accepting
-
getQuestGiver
Description copied from interface:IQuestInstanceGet the id of the quest giver. Server only!- Specified by:
getQuestGiverin interfaceIQuestInstance- Returns:
- the id of the quest giver.
-
getQuestGiverId
public int getQuestGiverId()Description copied from interface:IQuestInstanceId of questgiver.- Specified by:
getQuestGiverIdin interfaceIQuestInstance- Returns:
- the id.
-
isValid
Description copied from interface:IQuestInstanceCheck if the expiration date relative to the colony day count was reached.- Specified by:
isValidin interfaceIQuestInstance- Parameters:
colony- the colony to check the validity for.- Returns:
- true if so.
-
getId
public net.minecraft.resources.ResourceLocation getId()Description copied from interface:IQuestInstanceGet the quest id of the quest.- Specified by:
getIdin interfaceIQuestInstance- Returns:
- the id.
-
onDeletion
public void onDeletion()Description copied from interface:IQuestInstanceOn deletion of the quest.- Specified by:
onDeletionin interfaceIQuestInstance
-
advanceObjective
public void advanceObjective(net.minecraft.world.entity.player.Player player) Description copied from interface:IQuestInstanceSimple advance objective by one.- Specified by:
advanceObjectivein interfaceIQuestInstance- Parameters:
player- the player involved.
-
onWorldLoad
public void onWorldLoad()Description copied from interface:IQuestInstanceOn world load trigger.- Specified by:
onWorldLoadin interfaceIQuestInstance
-
advanceObjective
public IObjectiveInstance advanceObjective(net.minecraft.world.entity.player.Player player, int nextObjective) Description copied from interface:IQuestInstanceAdvance the quest objective to this id.- Specified by:
advanceObjectivein interfaceIQuestInstance- Parameters:
player- the player advancing this objective.nextObjective- the id to advance it to.- Returns:
- the next objective instance.
-
onCompletion
public void onCompletion()Description copied from interface:IQuestInstanceOn question completion call.- Specified by:
onCompletionin interfaceIQuestInstance
-
serializeNBT
public net.minecraft.nbt.CompoundTag serializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider) - Specified by:
serializeNBTin interfacenet.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
-
deserializeNBT
public void deserializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag nbt) - Specified by:
deserializeNBTin interfacenet.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
-
getObjectiveIndex
public int getObjectiveIndex()Description copied from interface:IQuestInstanceGet the current objective index.- Specified by:
getObjectiveIndexin interfaceIQuestInstance- Returns:
- the index number.
-
getParticipant
Description copied from interface:IQuestInstanceGet one of the other participants by index.- Specified by:
getParticipantin interfaceIQuestInstance- Parameters:
target- the target participant id.- Returns:
- the quest participant.
-
getParticipants
Description copied from interface:IQuestInstanceGet the full list of quest participants.- Specified by:
getParticipantsin interfaceIQuestInstance- Returns:
- the list of participants.
-
getQuestTarget
public int getQuestTarget()Description copied from interface:IQuestInstanceGet the id of the current task holder in the quest.- Specified by:
getQuestTargetin interfaceIQuestInstance- Returns:
- the quest participant.
-
getCurrentObjectiveInstance
Description copied from interface:IQuestInstanceGet the objective data of the current objective.- Specified by:
getCurrentObjectiveInstancein interfaceIQuestInstance- Returns:
- the data.
-