Class JobDeliveryman

All Implemented Interfaces:
IJob<EntityAIWorkDeliveryman>, net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>

public class JobDeliveryman extends AbstractJob<EntityAIWorkDeliveryman,JobDeliveryman>
Class of the deliveryman job.
  • Field Details

    • BONUS_SPEED_PER_LEVEL

      public static final double BONUS_SPEED_PER_LEVEL
      Walking speed bonus per level
      See Also:
  • Constructor Details

    • JobDeliveryman

      public JobDeliveryman(ICitizenData entity)
      Instantiates the job for the deliveryman.
      Parameters:
      entity - the citizen who becomes a deliveryman
  • Method Details

    • onLevelUp

      public void onLevelUp()
      Description copied from interface: IJob
      Levelup actions on citizen levelup, allows custom actions based on Jobs
    • getModel

      @NotNull public @NotNull net.minecraft.resources.ResourceLocation getModel()
      Description copied from interface: IJob
      Get the RenderBipedCitizen.Model to use when the Citizen performs this job role.
      Specified by:
      getModel in interface IJob<EntityAIWorkDeliveryman>
      Overrides:
      getModel in class AbstractJob<EntityAIWorkDeliveryman,JobDeliveryman>
      Returns:
      Model of the citizen.
    • serializeNBT

      public net.minecraft.nbt.CompoundTag serializeNBT()
      Specified by:
      serializeNBT in interface net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
      Overrides:
      serializeNBT in class AbstractJob<EntityAIWorkDeliveryman,JobDeliveryman>
    • deserializeNBT

      public void deserializeNBT(net.minecraft.nbt.CompoundTag compound)
      Specified by:
      deserializeNBT in interface net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
      Overrides:
      deserializeNBT in class AbstractJob<EntityAIWorkDeliveryman,JobDeliveryman>
    • generateAI

      @NotNull public @NotNull EntityAIWorkDeliveryman generateAI()
      Generate your AI class to register.
      Returns:
      your personal AI instance.
    • serializeToView

      public void serializeToView(net.minecraft.network.FriendlyByteBuf buffer)
      Description copied from interface: IJob
      Serialize the job to a buffer.
      Specified by:
      serializeToView in interface IJob<EntityAIWorkDeliveryman>
      Overrides:
      serializeToView in class AbstractJob<EntityAIWorkDeliveryman,JobDeliveryman>
      Parameters:
      buffer - the buffer to serialize it to.
    • getInactivityLimit

      public int getInactivityLimit()
      Description copied from interface: IJob
      Get the time limit in seconds after which the job considers itself inactive.
      Returns:
      the limit, or -1 if not applicable.
    • triggerActivityChangeAction

      public void triggerActivityChangeAction(boolean newState)
      Description copied from interface: IJob
      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).
    • getCurrentTask

      public IRequest<IDeliverymanRequestable> getCurrentTask()
      Returns the IRequest of the current Task.
      Returns:
      IRequest of the current Task.
    • finishRequest

      public void finishRequest(boolean successful)
      Method called to mark the current request as finished.
      Parameters:
      successful - True when the processing was successful, false when not.
    • onTaskDeletion

      public void onTaskDeletion(@NotNull @NotNull IToken<?> token)
      Called when a task that is being scheduled is being canceled.
      Parameters:
      token - token of the task to be deleted.
    • getTaskQueue

      public List<IToken<?>> getTaskQueue()
      Method to get the task queue of this job.
      Returns:
      The task queue.
    • onRemoval

      public void onRemoval()
      Description copied from interface: IJob
      When job removed (death of citizen or job change).
      Specified by:
      onRemoval in interface IJob<EntityAIWorkDeliveryman>
      Overrides:
      onRemoval in class AbstractJob<EntityAIWorkDeliveryman,JobDeliveryman>
    • getTaskListWithSameDestination

      public List<IRequest<? extends Delivery>> getTaskListWithSameDestination(IRequest<? extends Delivery> request)
      Build a list of all requests that have the same source/dest pair.
      Parameters:
      request - the first request.
      Returns:
      a list.
    • getMaxParallelDeliveries

      public int getMaxParallelDeliveries()
      Calculate the max parallel deliveries the courier can do.
      Returns:
      the max.
    • findWareHouse

      public IWareHouse findWareHouse()
      Finds the warehouse our dman is assigned to
      Returns:
      warehouse building or null
    • addConcurrentDelivery

      public void addConcurrentDelivery(IToken<?> requestToken)
      Add a concurrent delivery that is going on.
      Parameters:
      requestToken - the token of the request.
    • removeConcurrentDelivery

      public void removeConcurrentDelivery(IToken<?> requestToken)
      Remove a concurrent delivery that is going on.
      Parameters:
      requestToken - the token of the request.
    • getSaturationFactor

      public double getSaturationFactor()
      Description copied from interface: IJob
      Job saturation factor.
      Returns:
      increase in saturation consumption based on job.