Class AbstractJobCrafter<AI extends AbstractEntityAIBasic<J,? extends AbstractBuilding>,J extends AbstractJobCrafter<AI,J>>
java.lang.Object
com.minecolonies.core.colony.jobs.AbstractJob<AI,J>
com.minecolonies.core.colony.jobs.AbstractJobCrafter<AI,J>
- All Implemented Interfaces:
IJob<AI>,net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
- Direct Known Subclasses:
JobAlchemist,JobBaker,JobBlacksmith,JobChef,JobConcreteMixer,JobCrusher,JobDyer,JobEnchanter,JobFarmer,JobFletcher,JobGlassblower,JobLumberjack,JobMechanic,JobNetherWorker,JobPlanter,JobSawmill,JobSifter,JobStonemason,JobStoneSmeltery,JobUndertaker
public abstract class AbstractJobCrafter<AI extends AbstractEntityAIBasic<J,? extends AbstractBuilding>,J extends AbstractJobCrafter<AI,J>>
extends AbstractJob<AI,J>
Class of the crafter job.
-
Field Summary
Fields inherited from class com.minecolonies.core.colony.jobs.AbstractJob
workBuilding, workBuildingPos, workModule -
Constructor Summary
ConstructorsConstructorDescriptionAbstractJobCrafter(ICitizenData entity) Instantiates the job for the crafter. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRequest(@NotNull IToken<?> token) Method used to add a request to the queuevoiddeserializeNBT(net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound) voidfinishRequest(boolean successful) Method called to mark the current request as finished.intGet the current craft counter.<R extends PublicCrafting>
IRequest<R> Returns theIRequestof the current Task.intGet the max crafting count for the current recipe.@NotNull net.minecraft.resources.ResourceLocationgetModel()Get the RenderBipedCitizen.Model to use when the Citizen performs this job role.intGet the crafting progress.@NotNull it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap<ItemStorage> Get the secondary outputs that have yet to be picked up.Method to get the task queue of this job.booleanhasTask()Returns whether or not the job has a currentTask.voidWhen job removed (death of citizen or job change).voidonTaskBeingResolved(@NotNull IToken<?> token) voidonTaskBeingScheduled(@NotNull IToken<?> token) voidonTaskDeletion(@NotNull IToken<?> token) Called when a task that is being scheduled is being canceled.voidplaySound(net.minecraft.core.BlockPos blockPos, EntityCitizen worker) Play a job specific work sound at a pos.net.minecraft.nbt.CompoundTagserializeNBT(net.minecraft.core.HolderLookup.Provider provider) voidserializeToView(net.minecraft.network.RegistryFriendlyByteBuf buffer) Serialize the job to a buffer.voidsetCraftCounter(int craftCounter) Set the current craft counter.voidsetMaxCraftingCount(int maxCraftingCount) Set the max crafting count for the current recipe.voidsetProgress(int progress) Set the crafting progress.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
generateAI, getIdleSeverity, getInactivityLimit, getSaturationFactor, initEntityValues, isGuard, onLevelUp, triggerActivityChangeAction
-
Constructor Details
-
AbstractJobCrafter
Instantiates the job for the crafter.- Parameters:
entity- the citizen who becomes a Sawmill
-
-
Method Details
-
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<AI extends AbstractEntityAIBasic<J,? extends AbstractBuilding>> - Overrides:
getModelin classAbstractJob<AI extends AbstractEntityAIBasic<J,? extends AbstractBuilding>, J extends AbstractJobCrafter<AI, J>> - Returns:
- Model of the citizen.
-
serializeToView
public void serializeToView(net.minecraft.network.RegistryFriendlyByteBuf buffer) Description copied from interface:IJobSerialize the job to a buffer.- Specified by:
serializeToViewin interfaceIJob<AI extends AbstractEntityAIBasic<J,? extends AbstractBuilding>> - Overrides:
serializeToViewin classAbstractJob<AI extends AbstractEntityAIBasic<J,? extends AbstractBuilding>, J extends AbstractJobCrafter<AI, J>> - Parameters:
buffer- the buffer to serialize it to.
-
serializeNBT
public net.minecraft.nbt.CompoundTag serializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider) - Specified by:
serializeNBTin interfacenet.neoforged.neoforge.common.util.INBTSerializable<AI extends AbstractEntityAIBasic<J,? extends AbstractBuilding>> - Overrides:
serializeNBTin classAbstractJob<AI extends AbstractEntityAIBasic<J,? extends AbstractBuilding>, J extends AbstractJobCrafter<AI, J>>
-
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<AI extends AbstractEntityAIBasic<J,? extends AbstractBuilding>> - Overrides:
deserializeNBTin classAbstractJob<AI extends AbstractEntityAIBasic<J,? extends AbstractBuilding>, J extends AbstractJobCrafter<AI, J>>
-
getAssignedTasksFromDataStore
-
hasTask
public boolean hasTask()Returns whether or not the job has a currentTask.- Returns:
- true if has currentTask, otherwise false.
-
getCurrentTask
Returns theIRequestof the current Task.- Type Parameters:
R- the request type.- Returns:
IRequestof the current Task.
-
addRequest
Method used to add a request to the queue- Parameters:
token- The token of the requests to add.
-
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.
-
onTaskBeingScheduled
-
onTaskBeingResolved
-
getTaskQueue
Method to get the task queue of this job.- Returns:
- The task queue.
-
getAssignedTasks
-
getMaxCraftingCount
public int getMaxCraftingCount()Get the max crafting count for the current recipe.- Returns:
- the count.
-
setMaxCraftingCount
public void setMaxCraftingCount(int maxCraftingCount) Set the max crafting count for the current recipe.- Parameters:
maxCraftingCount- the count to set.
-
getCraftCounter
public int getCraftCounter()Get the current craft counter.- Returns:
- the counter.
-
setCraftCounter
public void setCraftCounter(int craftCounter) Set the current craft counter.- Parameters:
craftCounter- the counter to set.
-
getProgress
public int getProgress()Get the crafting progress.- Returns:
- the current progress.
-
setProgress
public void setProgress(int progress) Set the crafting progress.- Parameters:
progress- the current progress.
-
getSecondaryOutputs
@NotNull public @NotNull it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap<ItemStorage> getSecondaryOutputs()Get the secondary outputs that have yet to be picked up.- Returns:
- the map of secondary outputs.
-
onRemoval
public void onRemoval()Description copied from interface:IJobWhen job removed (death of citizen or job change).- Specified by:
onRemovalin interfaceIJob<AI extends AbstractEntityAIBasic<J,? extends AbstractBuilding>> - Overrides:
onRemovalin classAbstractJob<AI extends AbstractEntityAIBasic<J,? extends AbstractBuilding>, J extends AbstractJobCrafter<AI, J>>
-
playSound
Play a job specific work sound at a pos.- Parameters:
blockPos- the pos to play it at.worker- the worker to play it for.
-