Interface IWorkManager
- All Known Implementing Classes:
WorkManager
public interface IWorkManager
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddWorkOrder(@NotNull IServerWorkOrder order, boolean readingFromNbt) Adds work order to the work manager.voidclearWorkForCitizen(@NotNull ICitizenData citizen) When a citizen is removed, unclaim any Work Orders that were claimed by that citizen.Get the colony where this work order has been made.<W extends IServerWorkOrder>
List<W> getOrderedList(Class<W> type, net.minecraft.core.BlockPos builder) Get an ordered list by priority of the work orders.getOrderedList(@NotNull Predicate<IServerWorkOrder> predicate, net.minecraft.core.BlockPos builder) Get an ordered list by priority of the work orders.<W extends IServerWorkOrder>
WgetUnassignedWorkOrder(@NotNull Class<W> type) Get an unclaimed work order of a specified type.getWorkOrder(int id) Get a work order of the specified id.<W extends IServerWorkOrder>
WgetWorkOrder(int id, @NotNull Class<W> type) Get a work order of the specified id, as a specific type.@NotNull Map<Integer, IServerWorkOrder> Get all work orders.<W extends IServerWorkOrder>
List<W> getWorkOrdersOfType(@NotNull Class<W> type) Get all work orders of a specified type.booleanisDirty()Checks if changes has been made.voidonColonyTick(@NotNull IColony colony) Process updates on the Colony Tick.voidread(@NotNull net.minecraft.nbt.CompoundTag compound) Restore the Work Manager.voidremoveWorkOrder(int orderId) Removes a work order from the work manager.voidremoveWorkOrder(@NotNull IServerWorkOrder order) Removes a work order from the work manager.voidsetDirty(boolean dirty) Sets if changes has been made.voidwrite(@NotNull net.minecraft.nbt.CompoundTag compound) Save the Work Manager.
-
Method Details
-
removeWorkOrder
Removes a work order from the work manager.- Parameters:
order-IServerWorkOrderto remove.
-
removeWorkOrder
void removeWorkOrder(int orderId) Removes a work order from the work manager.- Parameters:
orderId- ID of the order to remove
-
getWorkOrder
Get a work order of the specified id, as a specific type.- Type Parameters:
W- the type of work order to return.- Parameters:
id- the id of the work order.type- the class of the expected type of the work order.- Returns:
- the work order of the specified id, or null if it was not found or is of an incompatible type.
-
getWorkOrder
Get a work order of the specified id.- Parameters:
id- the id of the work order.- Returns:
- the work order of the specified id, or null.
-
getUnassignedWorkOrder
Get an unclaimed work order of a specified type.- Type Parameters:
W- the type of work order to return.- Parameters:
type- the class of the type of work order to find.- Returns:
- an unclaimed work order of the given type, or null if no unclaimed work order of the type was found.
-
getWorkOrdersOfType
Get all work orders of a specified type.- Type Parameters:
W- the type of work order to return.- Parameters:
type- the class of the type of work order to find.- Returns:
- a list of all work orders of the given type.
-
getWorkOrders
Get all work orders.- Returns:
- a list of all work orders.
-
clearWorkForCitizen
When a citizen is removed, unclaim any Work Orders that were claimed by that citizen.- Parameters:
citizen- Citizen to unclaim work for.
-
write
void write(@NotNull @NotNull net.minecraft.nbt.CompoundTag compound) Save the Work Manager.- Parameters:
compound- Compound to save to.
-
read
void read(@NotNull @NotNull net.minecraft.nbt.CompoundTag compound) Restore the Work Manager.- Parameters:
compound- Compound to read from.
-
addWorkOrder
Adds work order to the work manager.- Parameters:
order- Order to add.readingFromNbt- if being read from NBT.
-
onColonyTick
Process updates on the Colony Tick. Currently, does periodic Work Order cleanup.- Parameters:
colony- colony which ticks.
-
getOrderedList
<W extends IServerWorkOrder> List<W> getOrderedList(Class<W> type, net.minecraft.core.BlockPos builder) Get an ordered list by priority of the work orders.- Type Parameters:
W- the type.- Parameters:
type- the type of workOrder which is required.builder- the builder wanting to claim it.- Returns:
- the list.
-
getOrderedList
List<IServerWorkOrder> getOrderedList(@NotNull @NotNull Predicate<IServerWorkOrder> predicate, net.minecraft.core.BlockPos builder) Get an ordered list by priority of the work orders.- Parameters:
predicate- a predicate to check each item againstbuilder- the builder wanting to claim it.- Returns:
- the list.
-
isDirty
boolean isDirty()Checks if changes has been made.- Returns:
- true if so.
-
setDirty
void setDirty(boolean dirty) Sets if changes has been made.- Parameters:
dirty- true if so. False to reset.
-
getColony
IColony getColony()Get the colony where this work order has been made.- Returns:
- the colony.
-