Class JobDeliveryman
java.lang.Object
com.minecolonies.core.colony.jobs.AbstractJob<EntityAIWorkDeliveryman,JobDeliveryman>
com.minecolonies.core.colony.jobs.JobDeliveryman
- All Implemented Interfaces:
IJob<EntityAIWorkDeliveryman>,net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
Class of the deliveryman job.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleWalking speed bonus per levelFields inherited from class com.minecolonies.core.colony.jobs.AbstractJob
workBuilding, workBuildingPos, workModule -
Constructor Summary
ConstructorsConstructorDescriptionJobDeliveryman(ICitizenData entity) Instantiates the job for the deliveryman. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConcurrentDelivery(IToken<?> requestToken) Add a concurrent delivery that is going on.voiddeserializeNBT(net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound) Finds the warehouse our dman is assigned tovoidfinishRequest(boolean successful) Method called to mark the current request as finished.@NotNull EntityAIWorkDeliverymanGenerate your AI class to register.Returns theIRequestof the current Task.intGet the time limit in seconds after which the job considers itself inactive.intCalculate the max parallel deliveries the courier can do.@NotNull net.minecraft.resources.ResourceLocationgetModel()Get the RenderBipedCitizen.Model to use when the Citizen performs this job role.doubleJob saturation factor.getTaskListWithSameDestination(IRequest<? extends Delivery> request) Build a list of all requests that have the same source/dest pair.Method to get the task queue of this job.voidLevelup actions on citizen levelup, allows custom actions based on JobsvoidWhen job removed (death of citizen or job change).voidonTaskDeletion(@NotNull IToken<?> token) Called when a task that is being scheduled is being canceled.voidremoveConcurrentDelivery(IToken<?> requestToken) Remove a concurrent delivery that is going on.net.minecraft.nbt.CompoundTagserializeNBT(net.minecraft.core.HolderLookup.Provider provider) voidserializeToView(net.minecraft.network.RegistryFriendlyByteBuf buffer) Serialize the job to a buffer.voidtriggerActivityChangeAction(boolean newState) Trigger a job based action on activity change (active to inactive, or inactive to active).Methods inherited from class com.minecolonies.core.colony.jobs.AbstractJob
allowsAvoidance, assignTo, canAIBeInterrupted, clearActionsDone, createAI, equals, getActionsDone, getAsyncRequests, getBuildingPos, getCitizen, getColony, getDiseaseModifier, getJobRegistryEntry, getNameTagDescription, getWorkBuilding, getWorkerAI, getWorkModule, hasCheckedForFoodToday, hashCode, ignoresDamage, incrementActionsDone, incrementActionsDone, isIdling, markRequestSync, onStackPickUp, onWakeUp, pickupSuccess, processOfflineTime, resetAI, setCheckedForFood, setNameTag, setRegistryEntry, triggerDeathAchievementMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.minecolonies.api.colony.jobs.IJob
getIdleSeverity, initEntityValues, isGuard
-
Field Details
-
BONUS_SPEED_PER_LEVEL
public static final double BONUS_SPEED_PER_LEVELWalking speed bonus per level- See Also:
-
-
Constructor Details
-
JobDeliveryman
Instantiates the job for the deliveryman.- Parameters:
entity- the citizen who becomes a deliveryman
-
-
Method Details
-
onLevelUp
public void onLevelUp()Description copied from interface:IJobLevelup actions on citizen levelup, allows custom actions based on Jobs -
getModel
@NotNull public @NotNull net.minecraft.resources.ResourceLocation getModel()Description copied from interface:IJobGet the RenderBipedCitizen.Model to use when the Citizen performs this job role.- Specified by:
getModelin interfaceIJob<EntityAIWorkDeliveryman>- Overrides:
getModelin classAbstractJob<EntityAIWorkDeliveryman,JobDeliveryman> - Returns:
- Model of the citizen.
-
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>- Overrides:
serializeNBTin classAbstractJob<EntityAIWorkDeliveryman,JobDeliveryman>
-
deserializeNBT
public void deserializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound) - Specified by:
deserializeNBTin interfacenet.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>- Overrides:
deserializeNBTin classAbstractJob<EntityAIWorkDeliveryman,JobDeliveryman>
-
generateAI
Generate your AI class to register.- Returns:
- your personal AI instance.
-
serializeToView
public void serializeToView(net.minecraft.network.RegistryFriendlyByteBuf buffer) Description copied from interface:IJobSerialize the job to a buffer.- Specified by:
serializeToViewin interfaceIJob<EntityAIWorkDeliveryman>- Overrides:
serializeToViewin classAbstractJob<EntityAIWorkDeliveryman,JobDeliveryman> - Parameters:
buffer- the buffer to serialize it to.
-
getInactivityLimit
public int getInactivityLimit()Description copied from interface:IJobGet 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:IJobTrigger 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
Returns theIRequestof the current Task.- Returns:
IRequestof 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
Called when a task that is being scheduled is being canceled.- Parameters:
token- token of the task to be deleted.
-
getTaskQueue
Method to get the task queue of this job.- Returns:
- The task queue.
-
onRemoval
public void onRemoval()Description copied from interface:IJobWhen job removed (death of citizen or job change).- Specified by:
onRemovalin interfaceIJob<EntityAIWorkDeliveryman>- Overrides:
onRemovalin classAbstractJob<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
Finds the warehouse our dman is assigned to- Returns:
- warehouse building or null
-
addConcurrentDelivery
Add a concurrent delivery that is going on.- Parameters:
requestToken- the token of the request.
-
removeConcurrentDelivery
Remove a concurrent delivery that is going on.- Parameters:
requestToken- the token of the request.
-
getSaturationFactor
public double getSaturationFactor()Description copied from interface:IJobJob saturation factor.- Returns:
- increase in saturation consumption based on job.
-