Техническая документация доступна на английском языке. Имена кода и полей соответствуют текущему Mod API.
МОДИНГОВАЯ ДОКУМЕНТАЦИЯ
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 общедоступные типы · 468 члены · Content API 15
528 соответствующие записи
context.notifyPlayer(notice)МетодAdds a localized log entry and clickable transient alert.
ColonyContext · Граждане и дома
Подпись
default boolean notifyPlayer(ColonyNotice notice)Adds a localized log entry and clickable transient alert. At most eight notices per mod per game minute are admitted. A throttled notice adds neither a log entry nor an alert. This call consumes the shared 128-command budget. Messages are stored in the language active when posted, like native event-log messages.
Пример звонка
context.notifyPlayer(notice);ColonyContext context is supplied to a ColonyExtension callback. Use it only during that callback on its owning thread.
- Parameters
- notice - owning-mod translation key, bounded arguments, tone and optional in-world tile
- Returns
- whether the notice was posted; false when the per-minute limit was reached
- Throws
- NullPointerException - if notice is null
- Throws
- IllegalArgumentException - for an unknown/foreign key, oversized message or out-of-world focus
- Throws
- IllegalStateException - outside the callback/thread or after its command budget
- Throws
- UnsupportedOperationException - if a custom context does not implement this operation
context.production()МетодQueries completed packing records, chosen exports, and stored tradable inventory totals.
ColonyContext · Граждане и дома
Подпись
SettlementTrading.Production production()Queries completed packing records, chosen exports, and stored tradable inventory totals. Reservations are not subtracted from these stock quantities. Retain the detached result when repeated policy decisions can use the same snapshot.
Пример звонка
context.production();ColonyContext context is supplied to a ColonyExtension callback. Use it only during that callback on its owning thread.
- Returns
- immutable recorded-production snapshot; theoretical workstation or farm capacity is not included
- Throws
- IllegalStateException - outside the owning callback or thread
context.settlement()МетодQueries persistent settlement identity, calendar and campaign progress.
ColonyContext · Граждане и дома
Подпись
SettlementTrading.World settlement()Queries persistent settlement identity, calendar and campaign progress.
Пример звонка
context.settlement();ColonyContext context is supplied to a ColonyExtension callback. Use it only during that callback on its owning thread.
- Returns
- immutable town snapshot
- Throws
- IllegalStateException - outside the owning callback or thread
context.spawnCivilian(near, female, appearanceVariant)МетодCreates one civilian through normal identity allocation and walkable spawn placement.
ColonyContext · Граждане и дома
Подпись
int spawnCivilian(int near, boolean female, int appearanceVariant)Creates one civilian through normal identity allocation and walkable spawn placement.
Пример звонка
context.spawnCivilian(near, female, appearanceVariant);ColonyContext context is supplied to a ColonyExtension callback. Use it only during that callback on its owning thread.
- Parameters
- near - living citizen whose nearby location should be used
- Parameters
- female - sex of the new citizen
- Parameters
- appearanceVariant - ordinary appearance index; temporary child art belongs in modifiers
- Returns
- positive new identity, or -1 for an absent/nonliving origin citizen, invalid appearance, or unavailable spawn placement
- Throws
- IllegalStateException - if the callback has ended or the caller uses another thread
context.view()МетодReturns the callback's cached citizen/home view.
ColonyContext · Граждане и дома
Подпись
ColonyContext.View view()Returns the callback's cached citizen/home view. Citizen modifier, spawning, and home-assignment commands invalidate that cache when they reach their mutation step. Calling this method again then captures a replacement; a previously returned view retains its old roster and home values until the callback ends.
Пример звонка
context.view();ColonyContext context is supplied to a ColonyExtension callback. Use it only during that callback on its owning thread.
- Returns
- scoped read-only view with detached citizen/home values
- Throws
- IllegalStateException - outside the owning callback or thread
ColonyEventТипImmutable notifications of committed native changes.
ColonyEvent · Мероприятия и панели
Подпись
public sealed interface ColonyEvent permits ColonyEvent.CitizenArrived, ColonyEvent.CitizenDied, ColonyEvent.CreatureDied, ColonyEvent.HomeChanged, ColonyEvent.PlaceableRemovedImmutable notifications of committed native changes. Events begin when a world's mod runtime attaches; existing actors, restored objects and past deaths are not replayed. Delivery is deferred to a simulation/save boundary. Actor IDs are scoped to their actor kind and world; placeable and home IDs have separate identity domains.
- All Known Implementing Classes
- ColonyEvent.CitizenArrived, ColonyEvent.CitizenDied, ColonyEvent.CreatureDied, ColonyEvent.HomeChanged, ColonyEvent.PlaceableRemoved
ColonyEvent.ActorТипDetached actor identity captured when an event occurred.
ColonyEvent.Actor · Мероприятия и панели
Подпись
public static record ColonyEvent.Actor(int id, String definitionId, String name, ColonyContext.Position position) extends RecordDetached actor identity captured when an event occurred.
- Record Components
- id - stable actor identity within its kind and world
- Record Components
- definitionId - citizen archetype or creature definition
- Record Components
- name - display name at capture time; suitable as a notification argument
- Record Components
- position - last known tile, or null if unavailable
new ColonyEvent.ActorКонструкторCreates an instance of a Actor record class.
ColonyEvent.Actor · Мероприятия и панели
Подпись
public Actor(int id, String definitionId, String name, ColonyContext.Position position)Creates an instance of a Actor record class.
Пример звонка
new ColonyEvent.Actor(id, definitionId, name, position);Use the public API type shown; import forgottentowns.mod.api.*.
- Parameters
- id - stable actor identity within its kind and world
- Parameters
- definitionId - citizen archetype or creature definition
- Parameters
- name - display name at capture time; suitable as a notification argument
- Parameters
- position - last known tile, or null if unavailable
actor.definitionId()МетодReturns citizen archetype or creature definition.
ColonyEvent.Actor · Мероприятия и панели
Подпись
public String definitionId()Returns citizen archetype or creature definition.
Пример звонка
actor.definitionId();ColonyEvent.Actor actor is an instance of this supported API type.
- Returns
- citizen archetype or creature definition
actor.equals(o)МетодIndicates whether some other object is "equal to" this one.
ColonyEvent.Actor · Мероприятия и панели
Подпись
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 '=='.
Пример звонка
actor.equals(o);ColonyEvent.Actor actor 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.
actor.hashCode()МетодReturns a hash code value for this object.
ColonyEvent.Actor · Мероприятия и панели
Подпись
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.
Пример звонка
actor.hashCode();ColonyEvent.Actor actor is an instance of this supported API type.
- Specified by
- hashCode in class Record
- Returns
- a hash code value for this object
actor.id()МетодReturns stable actor identity within its kind and world.
ColonyEvent.Actor · Мероприятия и панели
Подпись
public int id()Returns stable actor identity within its kind and world.
Пример звонка
actor.id();ColonyEvent.Actor actor is an instance of this supported API type.
- Returns
- stable actor identity within its kind and world
actor.name()МетодReturns display name at capture time; suitable as a notification argument.
ColonyEvent.Actor · Мероприятия и панели
Подпись
public String name()Returns display name at capture time; suitable as a notification argument.
Пример звонка
actor.name();ColonyEvent.Actor actor is an instance of this supported API type.
- Returns
- display name at capture time; suitable as a notification argument
actor.position()МетодReturns last known tile, or null if unavailable.
ColonyEvent.Actor · Мероприятия и панели
Подпись
public ColonyContext.Position position()Returns last known tile, or null if unavailable.
Пример звонка
actor.position();ColonyEvent.Actor actor is an instance of this supported API type.
- Returns
- last known tile, or null if unavailable
actor.toString()МетодReturns a string representation of this record class.
ColonyEvent.Actor · Мероприятия и панели
Подпись
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.
Пример звонка
actor.toString();ColonyEvent.Actor actor is an instance of this supported API type.
- Specified by
- toString in class Record
- Returns
- a string representation of this object
ColonyEvent.CitizenArrivedТипA newly created friendly actor, including civilians, recruits, heroes and scripted arrivals.
ColonyEvent.CitizenArrived · Мероприятия и панели
Подпись
public static record ColonyEvent.CitizenArrived(ColonyEvent.Actor citizen, int day) extends Record implements ColonyEventA newly created friendly actor, including civilians, recruits, heroes and scripted arrivals.
- Record Components
- citizen - detached arriving actor; does not imply a permanent civilian resident
- Record Components
- day - monotonic game day
new ColonyEvent.CitizenArrivedКонструкторCreates an instance of a CitizenArrived record class.
ColonyEvent.CitizenArrived · Мероприятия и панели
Подпись
public CitizenArrived(ColonyEvent.Actor citizen, int day)Creates an instance of a CitizenArrived record class.
Пример звонка
new ColonyEvent.CitizenArrived(citizen, day);Use the public API type shown; import forgottentowns.mod.api.*.
- Parameters
- citizen - detached arriving actor; does not imply a permanent civilian resident
- Parameters
- day - monotonic game day
citizenArrived.citizen()МетодReturns detached arriving actor; does not imply a permanent civilian resident.
ColonyEvent.CitizenArrived · Мероприятия и панели
Подпись
public ColonyEvent.Actor citizen()Returns detached arriving actor; does not imply a permanent civilian resident.
Пример звонка
citizenArrived.citizen();ColonyEvent.CitizenArrived citizenArrived is an instance of this supported API type.
- Returns
- detached arriving actor; does not imply a permanent civilian resident
citizenArrived.day()МетодReturns monotonic game day.
ColonyEvent.CitizenArrived · Мероприятия и панели
Подпись
public int day()Returns monotonic game day.
Пример звонка
citizenArrived.day();ColonyEvent.CitizenArrived citizenArrived is an instance of this supported API type.
- Specified by
- day in interface ColonyEvent
- Returns
- monotonic game day
citizenArrived.equals(o)МетодIndicates whether some other object is "equal to" this one.
ColonyEvent.CitizenArrived · Мероприятия и панели
Подпись
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 '=='.
Пример звонка
citizenArrived.equals(o);ColonyEvent.CitizenArrived citizenArrived 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.
citizenArrived.hashCode()МетодReturns a hash code value for this object.
ColonyEvent.CitizenArrived · Мероприятия и панели
Подпись
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.
Пример звонка
citizenArrived.hashCode();ColonyEvent.CitizenArrived citizenArrived is an instance of this supported API type.
- Specified by
- hashCode in class Record
- Returns
- a hash code value for this object
citizenArrived.toString()МетодReturns a string representation of this record class.
ColonyEvent.CitizenArrived · Мероприятия и панели
Подпись
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.
Пример звонка
citizenArrived.toString();ColonyEvent.CitizenArrived citizenArrived is an instance of this supported API type.
- Specified by
- toString in class Record
- Returns
- a string representation of this object
ColonyEvent.CitizenDiedТипA citizen entered the native death sequence after immediate resurrection checks.
ColonyEvent.CitizenDied · Мероприятия и панели
Подпись
public static record ColonyEvent.CitizenDied(ColonyEvent.Actor citizen, ColonyEvent.DeathCause cause, String attackerName, int day) extends Record implements ColonyEventA citizen entered the native death sequence after immediate resurrection checks. Later resurrection remains possible; removal of the corpse is not a second death.
- Record Components
- citizen - detached dead actor
- Record Components
- cause - known native cause, never inferred from nearby actors
- Record Components
- attackerName - recorded attacker name, or empty; not a stable actor identity
- Record Components
- day - monotonic game day
new ColonyEvent.CitizenDiedКонструкторCreates an instance of a CitizenDied record class.
ColonyEvent.CitizenDied · Мероприятия и панели
Подпись
public CitizenDied(ColonyEvent.Actor citizen, ColonyEvent.DeathCause cause, String attackerName, int day)Creates an instance of a CitizenDied record class.
Пример звонка
new ColonyEvent.CitizenDied(citizen, cause, attackerName, day);Use the public API type shown; import forgottentowns.mod.api.*.
- Parameters
- citizen - detached dead actor
- Parameters
- cause - known native cause, never inferred from nearby actors
- Parameters
- attackerName - recorded attacker name, or empty; not a stable actor identity
- Parameters
- day - monotonic game day
citizenDied.attackerName()МетодReturns recorded attacker name, or empty; not a stable actor identity.
ColonyEvent.CitizenDied · Мероприятия и панели
Подпись
public String attackerName()Returns recorded attacker name, or empty; not a stable actor identity.
Пример звонка
citizenDied.attackerName();ColonyEvent.CitizenDied citizenDied is an instance of this supported API type.
- Returns
- recorded attacker name, or empty; not a stable actor identity
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
