Class WorkOrderBuilding

java.lang.Object
com.minecolonies.core.colony.workorders.AbstractWorkOrder
com.minecolonies.core.colony.workorders.WorkOrderBuilding
All Implemented Interfaces:
IBuilderWorkOrder, IServerWorkOrder, IWorkOrder

public class WorkOrderBuilding extends AbstractWorkOrder
Represents one building order to complete. Has his own structure for the building.
  • Constructor Details

    • WorkOrderBuilding

      public WorkOrderBuilding()
      Unused constructor for reflection.
  • Method Details

    • create

      public static WorkOrderBuilding create(@NotNull @NotNull WorkOrderType type, @NotNull @NotNull IBuilding building)
    • getCustomName

      public String getCustomName()
    • getCustomParentName

      public String getCustomParentName()
    • getParentTranslationKey

      public String getParentTranslationKey()
    • setCustomName

      public void setCustomName(@NotNull @NotNull IBuilding building)
    • getDisplayName

      public net.minecraft.network.chat.Component getDisplayName()
      Description copied from class: AbstractWorkOrder
      Get the name of the work order, provides the custom name or the work order name when no custom name is given
      Specified by:
      getDisplayName in interface IWorkOrder
      Overrides:
      getDisplayName in class AbstractWorkOrder
      Returns:
      the display name for the work order
    • canBuild

      public boolean canBuild(IBuilding building)
      Description copied from class: AbstractWorkOrder
      Whether the work order can be built or not.
      Specified by:
      canBuild in interface IServerWorkOrder
      Specified by:
      canBuild in class AbstractWorkOrder
      Parameters:
      building - the citizen attempting to perform the work order
      Returns:
      true if it can be built
    • canBuildIgnoringDistance

      public boolean canBuildIgnoringDistance(@NotNull @NotNull IBuilding building, @NotNull @NotNull net.minecraft.core.BlockPos builderLocation, int builderLevel)
      Checks if a builder may accept this workOrder while ignoring the distance to the builder.
      Parameters:
      builderLocation - position of the builders own hut.
      builderLevel - level of the builders hut.
      Returns:
      true if so.
    • tooFarFromAnyBuilder

      public boolean tooFarFromAnyBuilder(IColony colony, int level)
      Description copied from class: AbstractWorkOrder
      Check if this workOrder can be resolved by an existing builder by distance.
      Specified by:
      tooFarFromAnyBuilder in interface IBuilderWorkOrder
      Overrides:
      tooFarFromAnyBuilder in class AbstractWorkOrder
      Parameters:
      colony - the colony to check in.
      level - the new level of the building.
      Returns:
      true if so.
    • isValid

      public boolean isValid(@NotNull @NotNull IColony colony)
      Is this WorkOrder still valid? If not, it will be deleted.
      Specified by:
      isValid in interface IServerWorkOrder
      Overrides:
      isValid in class AbstractWorkOrder
      Parameters:
      colony - The colony that owns the Work Order.
      Returns:
      True if the building for this work order still exists.
    • read

      public void read(@NotNull @NotNull net.minecraft.nbt.CompoundTag compound, IWorkManager manager)
      Read the WorkOrder data from the CompoundTag.
      Specified by:
      read in interface IServerWorkOrder
      Overrides:
      read in class AbstractWorkOrder
      Parameters:
      compound - NBT Tag compound.
      manager - the work manager.
    • write

      public void write(@NotNull @NotNull net.minecraft.nbt.CompoundTag compound)
      Save the Work Order to an CompoundTag.
      Specified by:
      write in interface IServerWorkOrder
      Overrides:
      write in class AbstractWorkOrder
      Parameters:
      compound - NBT tag compound.
    • serializeViewNetworkData

      public void serializeViewNetworkData(@NotNull @NotNull net.minecraft.network.FriendlyByteBuf buf)
      Description copied from class: AbstractWorkOrder
      Writes the workOrders data to a byte buf for transition.
      Specified by:
      serializeViewNetworkData in interface IServerWorkOrder
      Overrides:
      serializeViewNetworkData in class AbstractWorkOrder
      Parameters:
      buf - Buffer to write to
    • onCompleted

      public void onCompleted(IColony colony, ICitizenData citizen)
      Description copied from class: AbstractWorkOrder
      Executed when a work order is completed.

      Override this when something need to be done when the work order is completed

      Specified by:
      onCompleted in interface IBuilderWorkOrder
      Overrides:
      onCompleted in class AbstractWorkOrder
      Parameters:
      colony - in which the work order exist
      citizen - citizen that completed the work order
    • onAdded

      public void onAdded(IColony colony, boolean readingFromNbt)
      Description copied from class: AbstractWorkOrder
      Executed when a work order is added.

      Override this when something need to be done when the work order is added

      Specified by:
      onAdded in interface IServerWorkOrder
      Overrides:
      onAdded in class AbstractWorkOrder
      Parameters:
      colony - in which the work order exist
      readingFromNbt - if being read from NBT.
    • onRemoved

      public void onRemoved(IColony colony)
      Description copied from class: AbstractWorkOrder
      Executed when a work order is removed.

      Override this when something need to be done when the work order is removed

      Specified by:
      onRemoved in interface IBuilderWorkOrder
      Overrides:
      onRemoved in class AbstractWorkOrder
      Parameters:
      colony - in which the work order exist