Class QuestInstance

java.lang.Object
com.minecolonies.core.quests.QuestInstance
All Implemented Interfaces:
IQuestInstance, net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>

public class QuestInstance extends Object implements IQuestInstance
Instance of a specific quest type
  • 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

      public QuestInstance(IColony colony)
      Create an empty colony quest obj to deserialize the data from.
      Parameters:
      colony - the colony it is assigned to.
  • Method Details

    • getColony

      public IColony getColony()
      Description copied from interface: IQuestInstance
      Get the colony matching the quest.
      Specified by:
      getColony in interface IQuestInstance
      Returns:
      the colony.
    • getAssignedPlayer

      public UUID getAssignedPlayer()
      Description copied from interface: IQuestInstance
      Get the player UUID that accepted the quest.
      Specified by:
      getAssignedPlayer in interface IQuestInstance
      Returns:
      the player uuid.
    • onStart

      public void onStart(net.minecraft.world.entity.player.Player player, IColony colony)
      Description copied from interface: IQuestInstance
      Triggered when the quest is accepted
      Specified by:
      onStart in interface IQuestInstance
      Parameters:
      player - player accepting
    • getQuestGiver

      public IQuestGiver getQuestGiver()
      Description copied from interface: IQuestInstance
      Get the id of the quest giver. Server only!
      Specified by:
      getQuestGiver in interface IQuestInstance
      Returns:
      the id of the quest giver.
    • getQuestGiverId

      public int getQuestGiverId()
      Description copied from interface: IQuestInstance
      Id of questgiver.
      Specified by:
      getQuestGiverId in interface IQuestInstance
      Returns:
      the id.
    • isValid

      public boolean isValid(IColony colony)
      Description copied from interface: IQuestInstance
      Check if the expiration date relative to the colony day count was reached.
      Specified by:
      isValid in interface IQuestInstance
      Parameters:
      colony - the colony to check the validity for.
      Returns:
      true if so.
    • getId

      public net.minecraft.resources.ResourceLocation getId()
      Description copied from interface: IQuestInstance
      Get the quest id of the quest.
      Specified by:
      getId in interface IQuestInstance
      Returns:
      the id.
    • onDeletion

      public void onDeletion()
      Description copied from interface: IQuestInstance
      On deletion of the quest.
      Specified by:
      onDeletion in interface IQuestInstance
    • advanceObjective

      public void advanceObjective(net.minecraft.world.entity.player.Player player)
      Description copied from interface: IQuestInstance
      Simple advance objective by one.
      Specified by:
      advanceObjective in interface IQuestInstance
      Parameters:
      player - the player involved.
    • onWorldLoad

      public void onWorldLoad()
      Description copied from interface: IQuestInstance
      On world load trigger.
      Specified by:
      onWorldLoad in interface IQuestInstance
    • advanceObjective

      public IObjectiveInstance advanceObjective(net.minecraft.world.entity.player.Player player, int nextObjective)
      Description copied from interface: IQuestInstance
      Advance the quest objective to this id.
      Specified by:
      advanceObjective in interface IQuestInstance
      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: IQuestInstance
      On question completion call.
      Specified by:
      onCompletion in interface IQuestInstance
    • serializeNBT

      public net.minecraft.nbt.CompoundTag serializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider)
      Specified by:
      serializeNBT in interface net.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:
      deserializeNBT in interface net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
    • getObjectiveIndex

      public int getObjectiveIndex()
      Description copied from interface: IQuestInstance
      Get the current objective index.
      Specified by:
      getObjectiveIndex in interface IQuestInstance
      Returns:
      the index number.
    • getParticipant

      public IQuestParticipant getParticipant(int target)
      Description copied from interface: IQuestInstance
      Get one of the other participants by index.
      Specified by:
      getParticipant in interface IQuestInstance
      Parameters:
      target - the target participant id.
      Returns:
      the quest participant.
    • getParticipants

      public List<Integer> getParticipants()
      Description copied from interface: IQuestInstance
      Get the full list of quest participants.
      Specified by:
      getParticipants in interface IQuestInstance
      Returns:
      the list of participants.
    • getQuestTarget

      public int getQuestTarget()
      Description copied from interface: IQuestInstance
      Get the id of the current task holder in the quest.
      Specified by:
      getQuestTarget in interface IQuestInstance
      Returns:
      the quest participant.
    • getCurrentObjectiveInstance

      @Nullable public @Nullable IObjectiveInstance getCurrentObjectiveInstance()
      Description copied from interface: IQuestInstance
      Get the objective data of the current objective.
      Specified by:
      getCurrentObjectiveInstance in interface IQuestInstance
      Returns:
      the data.