Package forgottentowns.mod.api
Interface ColonyWork
public interface ColonyWork
Scoped work and placeable-construction commands using native worker scheduling,
materials, placement restrictions and persistence. Accepted plans do not guarantee a worker
can reach or finish them. IDs are stable within a world and must be paired with their queue.
Each mutating call consumes one of the context's shared 128 commands, including rejected calls.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumSupported terrain and vegetation work commands.static final recordDetached native production bill; counts represent outstanding batches and desired output units.static enumLogical placeable facings, independent of sprite-sheet cell order.static final recordDetached job metadata.static enumIndependent persistent identity domains. -
Method Summary
Modifier and TypeMethodDescriptionat(ColonyContext.Position position) Queries work anchored at a tile and construction occupying it, using native spatial indexes.booleancancel(ColonyWork.Queue queue, long id) Cancels active work with native reservation release and linked-plan/refund semantics.default ColonyWork.CraftingReads a native recipe bill without queuing work.default ColonyWork.CraftingcraftingRequest(String recipeId, int batches) Adds complete batches to the normal recipe bill, after discovery, biome and station gates.get(ColonyWork.Queue queue, long id) Looks up active settlement work by its stable identity.default ColonyWork.JobhaulPlaceable(long placeableId, String destination, int priority) Requests workers to pick up settlement-owned furniture and haul it to a physical store.planPlaceable(String definitionId, ColonyContext.Position position, ColonyWork.Facing facing, int priority) Plans a registered placeable through normal discovery, room, support, collision, campaign, preparation-station and crafted-item gates.default List<ColonyWork.Job> planZone(String definitionId, List<ColonyContext.Position> tiles, int priority) Plans a registered room or stockpile through native zone construction.queue(ColonyWork.Action action, ColonyContext.Position position, int priority) Queues exposed terrain/vegetation work using normal target and protected-support rules.setPriority(ColonyWork.Queue queue, long id, int priority) Changes scheduling priority through the native queue.
-
Method Details
-
get
Looks up active settlement work by its stable identity.- Parameters:
queue- identity domainid- persistent work or blueprint identity- Returns:
- detached snapshot, or null after removal or for an unknown/foreign identity
- Throws:
NullPointerException- if queue is nullIllegalStateException- outside the owning callback or thread
-
at
Queries work anchored at a tile and construction occupying it, using native spatial indexes.- Parameters:
position- tile coordinates (z increases downward), or null- Returns:
- immutable local job snapshots; empty for null or outside the world
- Throws:
IllegalStateException- outside the owning callback or thread
-
queue
Queues exposed terrain/vegetation work using normal target and protected-support rules. Repeating the same action returns its existing job; a different order is not replaced.- Parameters:
action- supported labor commandposition- exposed target tile; features resolve to their anchor; null is rejected with no jobpriority- -1 (low), 0 (normal), or 1 (high)- Returns:
- accepted job, or null for an invalid, unexplored or conflicting target
- Throws:
NullPointerException- if action is nullIllegalArgumentException- if priority is outside -1..1IllegalStateException- outside the callback/thread or after its command budget
-
planPlaceable
ColonyWork.Job planPlaceable(String definitionId, ColonyContext.Position position, ColonyWork.Facing facing, int priority) Plans a registered placeable through normal discovery, room, support, collision, campaign, preparation-station and crafted-item gates. Workers acquire and consume the authored cost. An exact repeated plan returns its existing identity without charging twice.- Parameters:
definitionId- placeable registry identity, including namespaced mod definitionsposition- exact anchor and construction support z; coffins use their buried support z; null is rejected with no blueprintfacing- logical facing, resolved through the definition's supported facingspriority- -1 (low), 0 (normal), or 1 (high)- Returns:
- accepted blueprint, or null when normal construction rules reject it
- Throws:
NullPointerException- if facing is nullIllegalArgumentException- if priority is outside -1..1IllegalStateException- outside the callback/thread or after its command budget
-
craftingRequest
Adds complete batches to the normal recipe bill, after discovery, biome and station gates. Native workers reserve ingredients and issue ordinary CRAFTING completion events. This is additive: persist a handled action or inspectcrafting(java.lang.String)before retrying after a save/load.- Parameters:
recipeId- registered recipe identitybatches- complete recipe batches, 1..4096- Returns:
- updated bill, or null if unavailable
- Throws:
IllegalArgumentException- if batches is outside its boundsIllegalStateException- outside the callback/thread or after its command budgetUnsupportedOperationException- if this context does not implement this operation
-
crafting
Reads a native recipe bill without queuing work.- Parameters:
recipeId- registered recipe identity- Returns:
- current shared bill, or null for an unknown recipe
- Throws:
IllegalStateException- outside the callback/threadUnsupportedOperationException- if this context does not implement this operation
-
haulPlaceable
Requests workers to pick up settlement-owned furniture and haul it to a physical store. Normal pickup eligibility, filters, capacity and worker access still apply. Repeated identical pending requests return the existing order. Cancel through the WORK queue. Completion reports the native pickup into real citizen inventory; subsequent stock delivery follows native hauling.- Parameters:
placeableId- stable placed-object identitydestination- exact physical store key fromColonyInventory.stores()priority- -1, 0 or 1- Returns:
- pending pickup order, or null on rejection/conflict
- Throws:
IllegalArgumentException- if priority is outside its boundsIllegalStateException- outside the callback/thread or after its command budgetUnsupportedOperationException- if this context does not implement this operation
-
planZone
default List<ColonyWork.Job> planZone(String definitionId, List<ColonyContext.Position> tiles, int priority) Plans a registered room or stockpile through native zone construction. Checks discovery, progression, exploration, support and conflicts before creating work. The request is all-or-nothing; all tiles share one layer and duplicate tiles are ignored. An entirely repeated pending plan returns existing jobs without allocating or charging twice.- Parameters:
definitionId- registered native zone categorytiles- at most 256 construction supports before duplicate removal; empty creates no workpriority- -1, 0 or 1- Returns:
- construction jobs, empty on rejection
- Throws:
NullPointerException- if tiles or a member is nullIllegalArgumentException- if footprint or priority exceeds its boundsIllegalStateException- outside the callback/thread or after its command budgetUnsupportedOperationException- if this context does not implement this operation
-
setPriority
Changes scheduling priority through the native queue.- Parameters:
queue- identity domainid- active job identitypriority- -1, 0 or 1- Returns:
- updated snapshot, or null when absent or foreign-owned
- Throws:
NullPointerException- if queue is nullIllegalArgumentException- if priority is outside -1..1IllegalStateException- outside the callback/thread or after its command budget
-
cancel
Cancels active work with native reservation release and linked-plan/refund semantics. Cancelling a bridge may cancel its complete plan. No materials are created on repeated calls.- Parameters:
queue- identity domainid- active job identity- Returns:
- whether cancellation removed any work
- Throws:
NullPointerException- if queue is nullIllegalStateException- outside the callback/thread or after its command budget
-