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.minecraftforge.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.
  • Constructor Details

    • AbstractJobCrafter

      public AbstractJobCrafter(ICitizenData entity)
      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: IJob
      Get the RenderBipedCitizen.Model to use when the Citizen performs this job role.
      Specified by:
      getModel in interface IJob<AI extends AbstractEntityAIBasic<J,? extends AbstractBuilding>>
      Overrides:
      getModel in class AbstractJob<AI extends AbstractEntityAIBasic<J,? extends AbstractBuilding>,J extends AbstractJobCrafter<AI,J>>
      Returns:
      Model of the citizen.
    • 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<AI extends AbstractEntityAIBasic<J,? extends AbstractBuilding>>
      Overrides:
      serializeToView in class AbstractJob<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()
      Specified by:
      serializeNBT in interface net.minecraftforge.common.util.INBTSerializable<AI extends AbstractEntityAIBasic<J,? extends AbstractBuilding>>
      Overrides:
      serializeNBT in class AbstractJob<AI extends AbstractEntityAIBasic<J,? extends AbstractBuilding>,J extends AbstractJobCrafter<AI,J>>
    • deserializeNBT

      public void deserializeNBT(net.minecraft.nbt.CompoundTag compound)
      Specified by:
      deserializeNBT in interface net.minecraftforge.common.util.INBTSerializable<AI extends AbstractEntityAIBasic<J,? extends AbstractBuilding>>
      Overrides:
      deserializeNBT in class AbstractJob<AI extends AbstractEntityAIBasic<J,? extends AbstractBuilding>,J extends AbstractJobCrafter<AI,J>>
    • getAssignedTasksFromDataStore

      public List<IToken<?>> getAssignedTasksFromDataStore()
    • hasTask

      public boolean hasTask()
      Returns whether or not the job has a currentTask.
      Returns:
      true if has currentTask, otherwise false.
    • getCurrentTask

      public <R extends PublicCrafting> IRequest<R> getCurrentTask()
      Returns the IRequest of the current Task.
      Type Parameters:
      R - the request type.
      Returns:
      IRequest of the current Task.
    • addRequest

      public void addRequest(@NotNull @NotNull IToken<?> token)
      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

      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.
    • onTaskBeingScheduled

      public void onTaskBeingScheduled(@NotNull @NotNull IToken<?> token)
    • onTaskBeingResolved

      public void onTaskBeingResolved(@NotNull @NotNull IToken<?> token)
    • getTaskQueue

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

      public List<IToken<?>> 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: IJob
      When job removed (death of citizen or job change).
      Specified by:
      onRemoval in interface IJob<AI extends AbstractEntityAIBasic<J,? extends AbstractBuilding>>
      Overrides:
      onRemoval in class AbstractJob<AI extends AbstractEntityAIBasic<J,? extends AbstractBuilding>,J extends AbstractJobCrafter<AI,J>>
    • playSound

      public void playSound(net.minecraft.core.BlockPos blockPos, EntityCitizen worker)
      Play a job specific work sound at a pos.
      Parameters:
      blockPos - the pos to play it at.
      worker - the worker to play it for.