FORGOTTEN TOWNS

FORGOTTEN TOWNS / МОДИНГОВАЯ ДОКУМЕНТАЦИЯ

Моддинг вики ↗

Java Ссылка на API (Javadoc)

MOD API 15

Просмотрите вики

Текущая документация API модов.

Техническая документация доступна на английском языке. Имена кода и полей соответствуют текущему 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

Сброс

146 соответствующие записи

context.view().citizen(id)МетодLooks up a citizen by stable identity.

ColonyContext.View · Граждане и дома

Подпись

ColonyContext.Person citizen(int id)

Looks up a citizen by stable identity.

Пример звонка

context.view().citizen(id);

Obtain the read-only view from the active ColonyContext. In projection hooks, use the supplied ColonyContext.View world directly.

Parameters
id - citizen identity
Returns
snapshot, or null when absent
Throws
IllegalStateException - outside the owning callback or thread
context.view().citizens()МетодReturns the captured roster, including any dead or deserting citizens still in the manager.

ColonyContext.View · Граждане и дома

Подпись

List<ColonyContext.Person> citizens()

Returns the captured roster, including any dead or deserting citizens still in the manager.

Пример звонка

context.view().citizens();

Obtain the read-only view from the active ColonyContext. In projection hooks, use the supplied ColonyContext.View world directly.

Returns
immutable captured roster in stable identity order
Throws
IllegalStateException - outside the owning callback or thread
colonyAffinity.fromCitizenId()МетодReturns living citizen whose feeling is described.

ColonyAffinity · Мероприятия и панели

Подпись

public int fromCitizenId()

Returns living citizen whose feeling is described.

Пример звонка

colonyAffinity.fromCitizenId();

ColonyAffinity colonyAffinity is an instance of this supported API type.

Returns
living citizen whose feeling is described
colonyAffinity.toCitizenId()МетодReturns other living citizen receiving that feeling.

ColonyAffinity · Мероприятия и панели

Подпись

public int toCitizenId()

Returns other living citizen receiving that feeling.

Пример звонка

colonyAffinity.toCitizenId();

ColonyAffinity colonyAffinity is an instance of this supported API type.

Returns
other living citizen receiving that feeling
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 ColonyEvent

A 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 ColonyEvent

A 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
citizenDied.cause()МетодReturns known native cause, never inferred from nearby actors.

ColonyEvent.CitizenDied · Мероприятия и панели

Подпись

public ColonyEvent.DeathCause cause()

Returns known native cause, never inferred from nearby actors.

Пример звонка

citizenDied.cause();

ColonyEvent.CitizenDied citizenDied is an instance of this supported API type.

Returns
known native cause, never inferred from nearby actors
citizenDied.citizen()МетодReturns detached dead actor.

ColonyEvent.CitizenDied · Мероприятия и панели

Подпись

public ColonyEvent.Actor citizen()

Returns detached dead actor.

Пример звонка

citizenDied.citizen();

ColonyEvent.CitizenDied citizenDied is an instance of this supported API type.

Returns
detached dead actor
citizenDied.day()МетодReturns monotonic game day.

ColonyEvent.CitizenDied · Мероприятия и панели

Подпись

public int day()

Returns monotonic game day.

Пример звонка

citizenDied.day();

ColonyEvent.CitizenDied citizenDied is an instance of this supported API type.

Specified by
day in interface ColonyEvent
Returns
monotonic game day
citizenDied.equals(o)МетодIndicates whether some other object is "equal to" this one.

ColonyEvent.CitizenDied · Мероприятия и панели

Подпись

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 '=='.

Пример звонка

citizenDied.equals(o);

ColonyEvent.CitizenDied citizenDied 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.
citizenDied.hashCode()МетодReturns a hash code value for this object.

ColonyEvent.CitizenDied · Мероприятия и панели

Подпись

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.

Пример звонка

citizenDied.hashCode();

ColonyEvent.CitizenDied citizenDied is an instance of this supported API type.

Specified by
hashCode in class Record
Returns
a hash code value for this object
citizenDied.toString()МетодReturns a string representation of this record class.

ColonyEvent.CitizenDied · Мероприятия и панели

Подпись

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.

Пример звонка

citizenDied.toString();

ColonyEvent.CitizenDied citizenDied is an instance of this supported API type.

Specified by
toString in class Record
Returns
a string representation of this object
creatureDied.creditedCitizenId()МетодReturns native kill-credit citizen identity, or zero when unavailable.

ColonyEvent.CreatureDied · Мероприятия и панели

Подпись

public int creditedCitizenId()

Returns native kill-credit citizen identity, or zero when unavailable.

Пример звонка

creatureDied.creditedCitizenId();

ColonyEvent.CreatureDied creatureDied is an instance of this supported API type.

Returns
native kill-credit citizen identity, or zero when unavailable
homeChanged.citizenId()МетодReturns affected citizen identity.

ColonyEvent.HomeChanged · Мероприятия и панели

Подпись

public int citizenId()

Returns affected citizen identity.

Пример звонка

homeChanged.citizenId();

ColonyEvent.HomeChanged homeChanged is an instance of this supported API type.

Returns
affected citizen identity
job.citizenId()МетодReturns assigned citizen, or null.

ColonyWork.Job · Инвентарь и работа

Подпись

public Integer citizenId()

Returns assigned citizen, or null.

Пример звонка

job.citizenId();

ColonyWork.Job job = context.work().get(queue, id); check for null before reading its values.

Returns
assigned citizen, or null
context.inventory()МетодReturns scoped physical storage queries and conserving transfers.

ColonyContext · Граждане и дома

Подпись

default ColonyInventory inventory()

Returns scoped physical storage queries and conserving transfers.

Пример звонка

context.inventory();

ColonyContext context is supplied to a ColonyExtension callback. Use it only during that callback on its owning thread.

Returns
inventory service sharing this callback's lifetime and command budget
Throws
IllegalStateException - outside the owning callback or thread
Throws
UnsupportedOperationException - if a custom context does not implement this operation
context.work()МетодReturns scoped native work and construction services.

ColonyContext · Граждане и дома

Подпись

default ColonyWork work()

Returns scoped native work and construction services.

Пример звонка

context.work();

ColonyContext context is supplied to a ColonyExtension callback. Use it only during that callback on its owning thread.

Returns
work service sharing this callback's lifetime and command budget
Throws
IllegalStateException - outside the owning callback or thread
Throws
UnsupportedOperationException - if a custom context does not implement this operation

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