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.
  • Method Details

    • get

      ColonyWork.Job get(ColonyWork.Queue queue, long id)
      Looks up active settlement work by its stable identity.
      Parameters:
      queue - identity domain
      id - persistent work or blueprint identity
      Returns:
      detached snapshot, or null after removal or for an unknown/foreign identity
      Throws:
      NullPointerException - if queue is null
      IllegalStateException - 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

      ColonyWork.Job queue(ColonyWork.Action action, ColonyContext.Position position, int priority)
      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 command
      position - exposed target tile; features resolve to their anchor; null is rejected with no job
      priority - -1 (low), 0 (normal), or 1 (high)
      Returns:
      accepted job, or null for an invalid, unexplored or conflicting target
      Throws:
      NullPointerException - if action is null
      IllegalArgumentException - if priority is outside -1..1
      IllegalStateException - 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 definitions
      position - exact anchor and construction support z; coffins use their buried support z; null is rejected with no blueprint
      facing - logical facing, resolved through the definition's supported facings
      priority - -1 (low), 0 (normal), or 1 (high)
      Returns:
      accepted blueprint, or null when normal construction rules reject it
      Throws:
      NullPointerException - if facing is null
      IllegalArgumentException - if priority is outside -1..1
      IllegalStateException - outside the callback/thread or after its command budget
    • craftingRequest

      default ColonyWork.Crafting craftingRequest(String recipeId, int batches)
      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 inspect crafting(java.lang.String) before retrying after a save/load.
      Parameters:
      recipeId - registered recipe identity
      batches - complete recipe batches, 1..4096
      Returns:
      updated bill, or null if unavailable
      Throws:
      IllegalArgumentException - if batches is outside its bounds
      IllegalStateException - outside the callback/thread or after its command budget
      UnsupportedOperationException - if this context does not implement this operation
    • crafting

      default ColonyWork.Crafting crafting(String recipeId)
      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/thread
      UnsupportedOperationException - if this context does not implement this operation
    • haulPlaceable

      default ColonyWork.Job haulPlaceable(long placeableId, String destination, int priority)
      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 identity
      destination - exact physical store key from ColonyInventory.stores()
      priority - -1, 0 or 1
      Returns:
      pending pickup order, or null on rejection/conflict
      Throws:
      IllegalArgumentException - if priority is outside its bounds
      IllegalStateException - outside the callback/thread or after its command budget
      UnsupportedOperationException - 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 category
      tiles - at most 256 construction supports before duplicate removal; empty creates no work
      priority - -1, 0 or 1
      Returns:
      construction jobs, empty on rejection
      Throws:
      NullPointerException - if tiles or a member is null
      IllegalArgumentException - if footprint or priority exceeds its bounds
      IllegalStateException - outside the callback/thread or after its command budget
      UnsupportedOperationException - if this context does not implement this operation
    • setPriority

      ColonyWork.Job setPriority(ColonyWork.Queue queue, long id, int priority)
      Changes scheduling priority through the native queue.
      Parameters:
      queue - identity domain
      id - active job identity
      priority - -1, 0 or 1
      Returns:
      updated snapshot, or null when absent or foreign-owned
      Throws:
      NullPointerException - if queue is null
      IllegalArgumentException - if priority is outside -1..1
      IllegalStateException - outside the callback/thread or after its command budget
    • cancel

      boolean cancel(ColonyWork.Queue queue, long id)
      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 domain
      id - active job identity
      Returns:
      whether cancellation removed any work
      Throws:
      NullPointerException - if queue is null
      IllegalStateException - outside the callback/thread or after its command budget