FORGOTTEN TOWNS

FORGOTTEN TOWNS / DOCUMENTAZIONE DI MODIFICA

Wiki di modifica ↗

Java Riferimento API (Javadoc)

MOD API 15

Sfoglia la wiki

Documentazione corrente dell'API Mod.

La documentazione tecnica è disponibile in inglese. Code and field names follow the current Mod API.

DOCUMENTAZIONE DI MODIFICA

Java reference

Search the types, functions and callbacks available to a Java mod. This reference is generated from the SDK Javadocs; each entry links to its full Java documentation.

Find a type or member

60 tipi pubblici · 468 membri · Content API 15

Ripristina

20 voci corrispondenti

ColonyWork.CraftingTipoDetached native production bill; counts represent outstanding batches and desired output units.

ColonyWork.Crafting · Inventario e lavoro

Firma

public static record ColonyWork.Crafting(String recipeId, int batches, int minimumStock, boolean infinite) extends Record

Detached native production bill; counts represent outstanding batches and desired output units.

Record Components
recipeId - registered recipe identity
Record Components
batches - outstanding direct batches
Record Components
minimumStock - minimum finished output units
Record Components
infinite - whether continuous production is enabled
new ColonyWork.CraftingCostruttoreCreates an instance of a Crafting record class.

ColonyWork.Crafting · Inventario e lavoro

Firma

public Crafting(String recipeId, int batches, int minimumStock, boolean infinite)

Creates an instance of a Crafting record class.

Chiama esempio

new ColonyWork.Crafting(recipeId, batches, minimumStock, infinite);

Use the public API type shown; import forgottentowns.mod.api.*.

Parameters
recipeId - registered recipe identity
Parameters
batches - outstanding direct batches
Parameters
minimumStock - minimum finished output units
Parameters
infinite - whether continuous production is enabled
crafting.batches()MetodoReturns outstanding direct batches.

ColonyWork.Crafting · Inventario e lavoro

Firma

public int batches()

Returns outstanding direct batches.

Chiama esempio

crafting.batches();

ColonyWork.Crafting crafting is an instance of this supported API type.

Returns
outstanding direct batches
crafting.equals(o)MetodoIndicates whether some other object is "equal to" this one.

ColonyWork.Crafting · Inventario e lavoro

Firma

public final boolean equals(Object o)

Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.

Chiama esempio

crafting.equals(o);

ColonyWork.Crafting crafting is an instance of this supported API type.

Specified by
equals in class Record
Parameters
o - the object with which to compare
Returns
true if this object is the same as the o argument; false otherwise.
crafting.hashCode()MetodoReturns a hash code value for this object.

ColonyWork.Crafting · Inventario e lavoro

Firma

public final int hashCode()

Returns a hash code value for this object. The value is derived from the hash code of each of the record components.

Chiama esempio

crafting.hashCode();

ColonyWork.Crafting crafting is an instance of this supported API type.

Specified by
hashCode in class Record
Returns
a hash code value for this object
crafting.infinite()MetodoReturns whether continuous production is enabled.

ColonyWork.Crafting · Inventario e lavoro

Firma

public boolean infinite()

Returns whether continuous production is enabled.

Chiama esempio

crafting.infinite();

ColonyWork.Crafting crafting is an instance of this supported API type.

Returns
whether continuous production is enabled
crafting.minimumStock()MetodoReturns minimum finished output units.

ColonyWork.Crafting · Inventario e lavoro

Firma

public int minimumStock()

Returns minimum finished output units.

Chiama esempio

crafting.minimumStock();

ColonyWork.Crafting crafting is an instance of this supported API type.

Returns
minimum finished output units
crafting.recipeId()MetodoReturns registered recipe identity.

ColonyWork.Crafting · Inventario e lavoro

Firma

public String recipeId()

Returns registered recipe identity.

Chiama esempio

crafting.recipeId();

ColonyWork.Crafting crafting is an instance of this supported API type.

Returns
registered recipe identity
crafting.toString()MetodoReturns a string representation of this record class.

ColonyWork.Crafting · Inventario e lavoro

Firma

public final String toString()

Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.

Chiama esempio

crafting.toString();

ColonyWork.Crafting crafting is an instance of this supported API type.

Specified by
toString in class Record
Returns
a string representation of this object
context.work().crafting(recipeId)MetodoReads a native recipe bill without queuing work.

ColonyWork · Inventario e lavoro

Firma

default ColonyWork.Crafting crafting(String recipeId)

Reads a native recipe bill without queuing work.

Chiama esempio

context.work().crafting(recipeId);

Obtain this service from the active ColonyContext; it shares the callback lifetime and command budget.

Parameters
recipeId - registered recipe identity
Returns
current shared bill, or null for an unknown recipe
Throws
IllegalStateException - outside the callback/thread
Throws
UnsupportedOperationException - if this context does not implement this operation
context.work().craftingRequest(recipeId, batches)MetodoAdds complete batches to the normal recipe bill, after discovery, biome and station gates.

ColonyWork · Inventario e lavoro

Firma

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.

Chiama esempio

context.work().craftingRequest(recipeId, batches);

Obtain this service from the active ColonyContext; it shares the callback lifetime and command budget.

Parameters
recipeId - registered recipe identity
Parameters
batches - complete recipe batches, 1..4096
Returns
updated bill, or null if unavailable
Throws
IllegalArgumentException - if batches is outside its bounds
Throws
IllegalStateException - outside the callback/thread or after its command budget
Throws
UnsupportedOperationException - if this context does not implement this operation
context.work().at(position)MetodoQueries work anchored at a tile and construction occupying it, using native spatial indexes.

ColonyWork · Inventario e lavoro

Firma

List<ColonyWork.Job> at(ColonyContext.Position position)

Queries work anchored at a tile and construction occupying it, using native spatial indexes.

Chiama esempio

context.work().at(position);

Obtain this service from the active ColonyContext; it shares the callback lifetime and command budget.

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
context.work().cancel(queue, id)MetodoCancels active work with native reservation release and linked-plan/refund semantics.

ColonyWork · Inventario e lavoro

Firma

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.

Chiama esempio

context.work().cancel(queue, id);

Obtain this service from the active ColonyContext; it shares the callback lifetime and command budget.

Parameters
queue - identity domain
Parameters
id - active job identity
Returns
whether cancellation removed any work
Throws
NullPointerException - if queue is null
Throws
IllegalStateException - outside the callback/thread or after its command budget
context.work().get(queue, id)MetodoLooks up active settlement work by its stable identity.

ColonyWork · Inventario e lavoro

Firma

ColonyWork.Job get(ColonyWork.Queue queue, long id)

Looks up active settlement work by its stable identity.

Chiama esempio

context.work().get(queue, id);

Obtain this service from the active ColonyContext; it shares the callback lifetime and command budget.

Parameters
queue - identity domain
Parameters
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
Throws
IllegalStateException - outside the owning callback or thread
context.work().haulPlaceable(placeableId, destination, priority)MetodoRequests workers to pick up settlement-owned furniture and haul it to a physical store.

ColonyWork · Inventario e lavoro

Firma

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.

Chiama esempio

context.work().haulPlaceable(placeableId, destination, priority);

Obtain this service from the active ColonyContext; it shares the callback lifetime and command budget.

Parameters
placeableId - stable placed-object identity
Parameters
destination - exact physical store key from ColonyInventory.stores()
Parameters
priority - -1, 0 or 1
Returns
pending pickup order, or null on rejection/conflict
Throws
IllegalArgumentException - if priority is outside its bounds
Throws
IllegalStateException - outside the callback/thread or after its command budget
Throws
UnsupportedOperationException - if this context does not implement this operation
context.work().planPlaceable(definitionId, position, facing, priority)MetodoPlans a registered placeable through normal discovery, room, support, collision, campaign, preparation-station and crafted-item gates.

ColonyWork · Inventario e lavoro

Firma

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.

Chiama esempio

context.work().planPlaceable(definitionId, position, facing, priority);

Obtain this service from the active ColonyContext; it shares the callback lifetime and command budget.

Parameters
definitionId - placeable registry identity, including namespaced mod definitions
Parameters
position - exact anchor and construction support z; coffins use their buried support z; null is rejected with no blueprint
Parameters
facing - logical facing, resolved through the definition's supported facings
Parameters
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
Throws
IllegalArgumentException - if priority is outside -1..1
Throws
IllegalStateException - outside the callback/thread or after its command budget
context.work().planZone(definitionId, tiles, priority)MetodoPlans a registered room or stockpile through native zone construction.

ColonyWork · Inventario e lavoro

Firma

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.

Chiama esempio

context.work().planZone(definitionId, tiles, priority);

Obtain this service from the active ColonyContext; it shares the callback lifetime and command budget.

Parameters
definitionId - registered native zone category
Parameters
tiles - at most 256 construction supports before duplicate removal; empty creates no work
Parameters
priority - -1, 0 or 1
Returns
construction jobs, empty on rejection
Throws
NullPointerException - if tiles or a member is null
Throws
IllegalArgumentException - if footprint or priority exceeds its bounds
Throws
IllegalStateException - outside the callback/thread or after its command budget
Throws
UnsupportedOperationException - if this context does not implement this operation
context.work().queue(action, position, priority)MetodoQueues exposed terrain/vegetation work using normal target and protected-support rules.

ColonyWork · Inventario e lavoro

Firma

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.

Chiama esempio

context.work().queue(action, position, priority);

Obtain this service from the active ColonyContext; it shares the callback lifetime and command budget.

Parameters
action - supported labor command
Parameters
position - exposed target tile; features resolve to their anchor; null is rejected with no job
Parameters
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
Throws
IllegalArgumentException - if priority is outside -1..1
Throws
IllegalStateException - outside the callback/thread or after its command budget
context.work().setPriority(queue, id, priority)MetodoChanges scheduling priority through the native queue.

ColonyWork · Inventario e lavoro

Firma

ColonyWork.Job setPriority(ColonyWork.Queue queue, long id, int priority)

Changes scheduling priority through the native queue.

Chiama esempio

context.work().setPriority(queue, id, priority);

Obtain this service from the active ColonyContext; it shares the callback lifetime and command budget.

Parameters
queue - identity domain
Parameters
id - active job identity
Parameters
priority - -1, 0 or 1
Returns
updated snapshot, or null when absent or foreign-owned
Throws
NullPointerException - if queue is null
Throws
IllegalArgumentException - if priority is outside -1..1
Throws
IllegalStateException - outside the callback/thread or after its command budget
mod.registerManualTradeReservations(enabled)MetodoSelects whether the shared Stock panel offers manual trade reservations.

ModContext · Ganci e ciclo di vita

Firma

default void registerManualTradeReservations(boolean enabled)

Selects whether the shared Stock panel offers manual trade reservations. Any provider can opt out; native Settlement Trading opts out by default, and a mod cannot override that decision by registering true. When disabled, existing reserved cargo returns to its owning settlement through durable delivery receipts; ordinary stock remains available for direct selling and crafting.

Chiama esempio

mod.registerManualTradeReservations(enabled);

ModContext mod is supplied to GameMod.register. Registration closes when that callback returns.

Parameters
enabled - whether this mod permits manual reservations
Throws
IllegalArgumentException - if duplicated or the manifest predates API 15
Throws
IllegalStateException - after startup registration closes
Throws
UnsupportedOperationException - if the host predates reservation policies

Read an entry

  • Method: a function your mod calls on the supplied service or value.
  • Hook: a callback the game calls on your registered implementation.
  • Constructor: creates an API value.
  • Constant: a fixed value, such as a facing or work queue.

Expand an entry for its signature, parameters, return value, exceptions and call shape. Call shapes show the real parameter names as placeholders; supply values of the declared types. Read the lifetime and ownership rules before retaining an object or issuing a command.

Java setup · Registration and lifecycle · Task guides · Full generated Javadocs