Interface IJob<AI extends ITickingStateAI>

All Superinterfaces:
net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
All Known Implementing Classes:
AbstractJob, AbstractJobCrafter, AbstractJobGuard, AbstractJobStructure, JobAlchemist, JobArcherTraining, JobBaker, JobBeekeeper, JobBlacksmith, JobBuilder, JobCavalry, JobChef, JobChickenHerder, JobCombatTraining, JobComposter, JobConcreteMixer, JobCook, JobCowboy, JobCrusher, JobDeliveryman, JobDruid, JobDyer, JobEnchanter, JobFarmer, JobFisherman, JobFletcher, JobFlorist, JobGlassblower, JobHealer, JobHuscarl, JobKnight, JobLumberjack, JobMarksman, JobMechanic, JobMiner, JobNetherWorker, JobPlaceholder, JobPlanter, JobPupil, JobQuarrier, JobRabbitHerder, JobRanger, JobResearch, JobSawmill, JobShepherd, JobSifter, JobSmelter, JobStablemaster, JobStonemason, JobStoneSmeltery, JobStudent, JobSwineHerder, JobTeacher, JobUndertaker

public interface IJob<AI extends ITickingStateAI> extends net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Method to check if the colony job allows avoidance.
    boolean
    Assigns the job to its specific work module
    boolean
    Check if it is okay to eat
    void
    Clear the actions done counter.
    void
    Creates the work AI
    Generate your AI class to register.
    int
    Getter for the amount of actions done.
    Get a set of async requests connected to this job.
    net.minecraft.core.BlockPos
    Gets the position of the building the job is assigned to
    Get the CitizenData that this Job belongs to.
    Get the Colony that this Job is associated with (shortcut for getAssignedCitizen().getColonyByPosFromWorld()).
    double
    Disease modifier of the job.
    default int
    getIdleSeverity(boolean isDemand)
    Get the days before complaining or demanding solution for being idle
    default int
    Get the time limit in seconds after which the job considers itself inactive.
    The JobEntry for this job.
    net.minecraft.resources.ResourceLocation
    Get the RenderBipedCitizen.Model to use when the Citizen performs this job role.
    This method can be used to display the current status.
    default double
    Job saturation factor.
    Gets the work building
    Get the worker AI associated to this job
    Gets the module this job is assigned to
    boolean
    Check if the citizen already checked for food in his chest today.
    boolean
    ignoresDamage(@NotNull net.minecraft.world.damagesource.DamageSource damageSource)
    Check if the particular job ignores a particular damage type.
    void
    Increase the actions done since the last reset by 1 Used for example to detect if and when the inventory has to be dumped.
    void
    incrementActionsDone(int numberOfActions)
    Increase the actions done since the last reset by numberOfActions Used for example to detect if and when the inventory has to be dumped.
    default void
    Initizalizes values for an entity when the entity is spawned/assigned to the job
    default boolean
    Whether the job is a guard
    boolean
    Check if the citizen is in an idle state.
    void
    Mark a request as a synchronous (blocking request).
    default void
    Levelup actions on citizen levelup, allows custom actions based on Jobs
    void
    When job removed (death of citizen or job change).
    boolean
    onStackPickUp(@NotNull net.minecraft.world.item.ItemStack pickedUpStack)
    Method called when a stack is pickup by the entity.
    void
    Executed every time the colony woke up.
    boolean
    pickupSuccess(@NotNull net.minecraft.world.item.ItemStack pickedUpStack)
    If the worker can pick up the stack.
    void
    processOfflineTime(long time)
    Process time the colony was offline.
    void
    Reset the AI.
    void
    serializeToView(net.minecraft.network.FriendlyByteBuf buffer)
    Serialize the job to a buffer.
    void
    Sets that the citizen on this day already searched for food in his chest.
    void
    setNameTag(String nameTag)
    Used by the AI skeleton to change a citizens name.
    void
    Set the registry entry of the job.
    default void
    triggerActivityChangeAction(boolean newState)
    Trigger a job based action on activity change (active to inactive, or inactive to active).
    void
    triggerDeathAchievement(net.minecraft.world.damagesource.DamageSource source, AbstractEntityCitizen citizen)
    Override this to implement Job specific death achievements.

    Methods inherited from interface net.minecraftforge.common.util.INBTSerializable

    deserializeNBT, serializeNBT
  • Method Details

    • getJobRegistryEntry

      JobEntry getJobRegistryEntry()
      The JobEntry for this job.
      Returns:
      The JobEntry.
    • getModel

      net.minecraft.resources.ResourceLocation getModel()
      Get the RenderBipedCitizen.Model to use when the Citizen performs this job role.
      Returns:
      Model of the citizen.
    • getColony

      IColony getColony()
      Get the Colony that this Job is associated with (shortcut for getAssignedCitizen().getColonyByPosFromWorld()).
      Returns:
      IColony of the citizen.
    • getAsyncRequests

      Set<IToken<?>> getAsyncRequests()
      Get a set of async requests connected to this job.
      Returns:
      a set of ITokens.
    • createAI

      void createAI()
      Creates the work AI
    • generateAI

      AI generateAI()
      Generate your AI class to register.

      Suppressing Sonar Rule squid:S1452 This rule does "Generic wildcard types should not be used in return parameters" But in this case the rule does not apply because We are fine with all AbstractJob implementations and need generics only for java

      Returns:
      your personal AI instance.
    • hasCheckedForFoodToday

      boolean hasCheckedForFoodToday()
      Check if the citizen already checked for food in his chest today.
      Returns:
      true if so.
    • setCheckedForFood

      void setCheckedForFood()
      Sets that the citizen on this day already searched for food in his chest.
    • getNameTagDescription

      String getNameTagDescription()
      This method can be used to display the current status. That a citizen is having.
      Returns:
      Small string to display info in name tag
    • setNameTag

      void setNameTag(String nameTag)
      Used by the AI skeleton to change a citizens name. Mostly used to update debugging information.
      Parameters:
      nameTag - The name tag to display.
    • triggerDeathAchievement

      void triggerDeathAchievement(net.minecraft.world.damagesource.DamageSource source, AbstractEntityCitizen citizen)
      Override this to implement Job specific death achievements.
      Parameters:
      source - of the death
      citizen - which just died
    • onStackPickUp

      boolean onStackPickUp(@NotNull @NotNull net.minecraft.world.item.ItemStack pickedUpStack)
      Method called when a stack is pickup by the entity.
      Parameters:
      pickedUpStack - The stack that is being picked up.
      Returns:
      true when the stack has been used to resolve a request, false when not.
    • onLevelUp

      default void onLevelUp()
      Levelup actions on citizen levelup, allows custom actions based on Jobs
    • initEntityValues

      default void initEntityValues(AbstractEntityCitizen citizen)
      Initizalizes values for an entity when the entity is spawned/assigned to the job
      Parameters:
      citizen -
    • getCitizen

      ICitizenData getCitizen()
      Get the CitizenData that this Job belongs to.
      Returns:
      CitizenData that owns this Job.
    • onWakeUp

      void onWakeUp()
      Executed every time the colony woke up.
    • canAIBeInterrupted

      boolean canAIBeInterrupted()
      Check if it is okay to eat
      Returns:
      true if so.
    • getActionsDone

      int getActionsDone()
      Getter for the amount of actions done.
      Returns:
      the quantity.
    • incrementActionsDone

      void incrementActionsDone()
      Increase the actions done since the last reset by 1 Used for example to detect if and when the inventory has to be dumped.
    • incrementActionsDone

      void incrementActionsDone(int numberOfActions)
      Increase the actions done since the last reset by numberOfActions Used for example to detect if and when the inventory has to be dumped.
    • clearActionsDone

      void clearActionsDone()
      Clear the actions done counter. Call this when dumping into the chest.
    • getWorkerAI

      AI getWorkerAI()
      Get the worker AI associated to this job
      Returns:
      worker AI
    • isIdling

      boolean isIdling()
      Check if the citizen is in an idle state.
      Returns:
      true if so.
    • resetAI

      void resetAI()
      Reset the AI.
    • allowsAvoidance

      boolean allowsAvoidance()
      Method to check if the colony job allows avoidance.
      Returns:
      true if so.
    • getDiseaseModifier

      double getDiseaseModifier()
      Disease modifier of the job.
      Returns:
      the modifier of the job.
    • onRemoval

      void onRemoval()
      When job removed (death of citizen or job change).
    • ignoresDamage

      boolean ignoresDamage(@NotNull @NotNull net.minecraft.world.damagesource.DamageSource damageSource)
      Check if the particular job ignores a particular damage type.
      Parameters:
      damageSource - the damage source to check.
      Returns:
      true if so.
    • markRequestSync

      void markRequestSync(IToken<?> id)
      Mark a request as a synchronous (blocking request).
      Parameters:
      id - the id.
    • pickupSuccess

      boolean pickupSuccess(@NotNull @NotNull net.minecraft.world.item.ItemStack pickedUpStack)
      If the worker can pick up the stack.
      Parameters:
      pickedUpStack - the stack to check.
      Returns:
      true if so.
    • processOfflineTime

      void processOfflineTime(long time)
      Process time the colony was offline.
      Parameters:
      time - the time in seconds.
    • serializeToView

      void serializeToView(net.minecraft.network.FriendlyByteBuf buffer)
      Serialize the job to a buffer.
      Parameters:
      buffer - the buffer to serialize it to.
    • getInactivityLimit

      default int getInactivityLimit()
      Get the time limit in seconds after which the job considers itself inactive.
      Returns:
      the limit, or -1 if not applicable.
    • getIdleSeverity

      default int getIdleSeverity(boolean isDemand)
      Get the days before complaining or demanding solution for being idle
      Parameters:
      isDemand - true if looking for the demand time
      Returns:
      number of days
    • triggerActivityChangeAction

      default void triggerActivityChangeAction(boolean newState)
      Trigger a job based action on activity change (active to inactive, or inactive to active).
      Parameters:
      newState - the new state (true for active, false for inactive).
    • setRegistryEntry

      void setRegistryEntry(JobEntry jobEntry)
      Set the registry entry of the job.
      Parameters:
      jobEntry - the job entry belonging to it.
    • isGuard

      default boolean isGuard()
      Whether the job is a guard
      Returns:
    • getBuildingPos

      net.minecraft.core.BlockPos getBuildingPos()
      Gets the position of the building the job is assigned to
      Returns:
    • getWorkBuilding

      IBuilding getWorkBuilding()
      Gets the work building
      Returns:
    • getWorkModule

      IAssignsJob getWorkModule()
      Gets the module this job is assigned to
    • assignTo

      boolean assignTo(IAssignsJob module)
      Assigns the job to its specific work module
      Parameters:
      module -
      Returns:
    • getSaturationFactor

      default double getSaturationFactor()
      Job saturation factor.
      Returns:
      increase in saturation consumption based on job.