Class WorkOrderBuilding
java.lang.Object
com.minecolonies.core.colony.workorders.AbstractWorkOrder
com.minecolonies.core.colony.workorders.WorkOrderBuilding
- All Implemented Interfaces:
IBuilderWorkOrder,IServerWorkOrder,IWorkOrder
Represents one building order to complete. Has his own structure for the building.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether the work order can be built or not.booleancanBuildIgnoringDistance(@NotNull IBuilding building, @NotNull net.minecraft.core.BlockPos builderLocation, int builderLevel) Checks if a builder may accept this workOrder while ignoring the distance to the builder.static WorkOrderBuildingcreate(@NotNull WorkOrderType type, @NotNull IBuilding building) net.minecraft.network.chat.ComponentGet the name of the work order, provides the custom name or the work order name when no custom name is givenbooleanIs this WorkOrder still valid? If not, it will be deleted.voidExecuted when a work order is added.voidonCompleted(IColony colony, ICitizenData citizen) Executed when a work order is completed.voidExecuted when a work order is removed.voidread(@NotNull net.minecraft.nbt.CompoundTag compound, IWorkManager manager) Read the WorkOrder data from the CompoundTag.voidserializeViewNetworkData(@NotNull net.minecraft.network.RegistryFriendlyByteBuf buf) Writes the workOrders data to a byte buf for transition.voidsetCustomName(@NotNull IBuilding building) booleantooFarFromAnyBuilder(IColony colony, int level) Check if this workOrder can be resolved by an existing builder by distance.voidwrite(@NotNull net.minecraft.nbt.CompoundTag compound) Save the Work Order to an CompoundTag.Methods inherited from class com.minecolonies.core.colony.workorders.AbstractWorkOrder
canBeResolved, clearBlueprint, createFromNBT, createWorkOrderView, getAmountOfResources, getBlueprint, getBoundingBox, getClaimedBy, getColony, getCurrentLevel, getID, getIteratorType, getLocation, getPriority, getRotationMirror, getStage, getStructurePack, getStructurePath, getTargetLevel, getTranslationKey, getWorkOrderType, isClaimed, isCleared, isDirty, isRequested, loadBlueprint, resetChange, setAmountOfResources, setBlueprint, setClaimedBy, setCleared, setColony, setID, setIteratorType, setPriority, setRequested, setStageMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.minecolonies.api.colony.workorders.IWorkOrder
getFileName
-
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
-
getCustomParentName
-
getParentTranslationKey
-
setCustomName
-
getDisplayName
public net.minecraft.network.chat.Component getDisplayName()Description copied from class:AbstractWorkOrderGet the name of the work order, provides the custom name or the work order name when no custom name is given- Specified by:
getDisplayNamein interfaceIWorkOrder- Overrides:
getDisplayNamein classAbstractWorkOrder- Returns:
- the display name for the work order
-
canBuild
Description copied from class:AbstractWorkOrderWhether the work order can be built or not.- Specified by:
canBuildin interfaceIServerWorkOrder- Specified by:
canBuildin classAbstractWorkOrder- 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
Description copied from class:AbstractWorkOrderCheck if this workOrder can be resolved by an existing builder by distance.- Specified by:
tooFarFromAnyBuilderin interfaceIBuilderWorkOrder- Overrides:
tooFarFromAnyBuilderin classAbstractWorkOrder- Parameters:
colony- the colony to check in.level- the new level of the building.- Returns:
- true if so.
-
isValid
Is this WorkOrder still valid? If not, it will be deleted.- Specified by:
isValidin interfaceIServerWorkOrder- Overrides:
isValidin classAbstractWorkOrder- Parameters:
colony- The colony that owns the Work Order.- Returns:
- True if the building for this work order still exists.
-
read
Read the WorkOrder data from the CompoundTag.- Specified by:
readin interfaceIServerWorkOrder- Overrides:
readin classAbstractWorkOrder- 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:
writein interfaceIServerWorkOrder- Overrides:
writein classAbstractWorkOrder- Parameters:
compound- NBT tag compound.
-
serializeViewNetworkData
public void serializeViewNetworkData(@NotNull @NotNull net.minecraft.network.RegistryFriendlyByteBuf buf) Description copied from class:AbstractWorkOrderWrites the workOrders data to a byte buf for transition.- Specified by:
serializeViewNetworkDatain interfaceIServerWorkOrder- Overrides:
serializeViewNetworkDatain classAbstractWorkOrder- Parameters:
buf- Buffer to write to
-
onCompleted
Description copied from class:AbstractWorkOrderExecuted when a work order is completed.Override this when something need to be done when the work order is completed
- Specified by:
onCompletedin interfaceIBuilderWorkOrder- Overrides:
onCompletedin classAbstractWorkOrder- Parameters:
colony- in which the work order existcitizen- citizen that completed the work order
-
onAdded
Description copied from class:AbstractWorkOrderExecuted when a work order is added.Override this when something need to be done when the work order is added
- Specified by:
onAddedin interfaceIServerWorkOrder- Overrides:
onAddedin classAbstractWorkOrder- Parameters:
colony- in which the work order existreadingFromNbt- if being read from NBT.
-
onRemoved
Description copied from class:AbstractWorkOrderExecuted when a work order is removed.Override this when something need to be done when the work order is removed
- Specified by:
onRemovedin interfaceIBuilderWorkOrder- Overrides:
onRemovedin classAbstractWorkOrder- Parameters:
colony- in which the work order exist
-