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

Сброс

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

ColonyExtension.providesAffinities()КрюкDeclares that this extension supplies affinity presentation, even before relationships exist.

ColonyExtension · Хуки и жизненный цикл

Подпись

default boolean providesAffinities()

Declares that this extension supplies affinity presentation, even before relationships exist. The host snapshots this capability at simulation refresh boundaries and never calls it while drawing. The default leaves the panel hidden unless the extension returns affinity data, allowing data-only providers.

Реализуйте этот крючок

public boolean providesAffinities();

The engine calls your implementation; implement this signature in the registered hook.

Returns
whether this world should expose the affinity panel while this extension is active
ColonyExtension.restore(Map<String, String>)КрюкRestores this mod's state before its first refresh.

ColonyExtension · Хуки и жизненный цикл

Подпись

default void restore(Map<String,String> state)

Restores this mod's state before its first refresh. An empty map is supplied for a newly enabled mod and may also be a prior intentionally empty save.

Реализуйте этот крючок

public void restore(Map<String,String> state);

The engine calls your implementation; implement this signature in the registered hook.

Parameters
state - detached, immutable, mod-owned save values
Throws
IllegalArgumentException - if a stored schema cannot be restored
ColonyExtension.save()КрюкCaptures persistent values; include a schema version when publishing persistent behavior.

ColonyExtension · Хуки и жизненный цикл

Подпись

default Map<String,String> save()

Captures persistent values; include a schema version when publishing persistent behavior.

Реализуйте этот крючок

public Map<String,String> save();

The engine calls your implementation; implement this signature in the registered hook.

Returns
nonnull string map with no null entries, at most 16384 entries and one MiB of UTF-8 key/value data; the host makes an immutable copy
ColonyInventoryТипAccess to physical settlement stockpiles and placed storage containers.

ColonyInventory · Инвентарь и работа

Подпись

public interface ColonyInventory

Access to physical settlement stockpiles and placed storage containers. Every method requires the owning callback thread and expires with its context. Actor inventories, loot, carts and abstract overflow stores are outside this interface.

ColonyInventory.StockТипDetached physical inventory, safe to retain after the callback.

ColonyInventory.Stock · Инвентарь и работа

Подпись

public static record ColonyInventory.Stock(String key, Map<String,Integer> contents, int slots) extends Record

Detached physical inventory, safe to retain after the callback.

Record Components
key - opaque concrete storage key
Record Components
contents - immutable stored resource quantities; reservations are not subtracted
Record Components
slots - physical stack capacity; not a unit count
new ColonyInventory.StockКонструкторCopies the resource map.

ColonyInventory.Stock · Инвентарь и работа

Подпись

public Stock(String key, Map<String,Integer> contents, int slots)

Copies the resource map.

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

new ColonyInventory.Stock(key, contents, slots);

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

Parameters
key - concrete storage key
Parameters
contents - resource quantities
Parameters
slots - physical stack capacity
Throws
NullPointerException - if contents or any entry is null
stock.contents()МетодReturns immutable stored resource quantities; reservations are not subtracted.

ColonyInventory.Stock · Инвентарь и работа

Подпись

public Map<String,Integer> contents()

Returns immutable stored resource quantities; reservations are not subtracted.

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

stock.contents();

ColonyInventory.Stock stock is an instance of this supported API type.

Returns
immutable stored resource quantities; reservations are not subtracted
stock.equals(o)МетодIndicates whether some other object is "equal to" this one.

ColonyInventory.Stock · Инвентарь и работа

Подпись

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

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

stock.equals(o);

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

ColonyInventory.Stock · Инвентарь и работа

Подпись

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.

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

stock.hashCode();

ColonyInventory.Stock stock is an instance of this supported API type.

Specified by
hashCode in class Record
Returns
a hash code value for this object
stock.key()МетодReturns opaque concrete storage key.

ColonyInventory.Stock · Инвентарь и работа

Подпись

public String key()

Returns opaque concrete storage key.

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

stock.key();

ColonyInventory.Stock stock is an instance of this supported API type.

Returns
opaque concrete storage key
stock.slots()МетодReturns physical stack capacity; not a unit count.

ColonyInventory.Stock · Инвентарь и работа

Подпись

public int slots()

Returns physical stack capacity; not a unit count.

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

stock.slots();

ColonyInventory.Stock stock is an instance of this supported API type.

Returns
physical stack capacity; not a unit count
stock.toString()МетодReturns a string representation of this record class.

ColonyInventory.Stock · Инвентарь и работа

Подпись

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.

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

stock.toString();

ColonyInventory.Stock stock is an instance of this supported API type.

Specified by
toString in class Record
Returns
a string representation of this object
context.inventory().stock(key)МетодLooks up a concrete store without creating an inventory or exposing a mutable manager.

ColonyInventory · Инвентарь и работа

Подпись

ColonyInventory.Stock stock(String key)

Looks up a concrete store without creating an inventory or exposing a mutable manager.

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

context.inventory().stock(key);

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

Parameters
key - opaque key returned by stores(); null or blank has no match
Returns
detached contents and physical capacity, or null for a missing/ineligible store
Throws
IllegalStateException - outside the owning callback or thread
context.inventory().stores()МетодLists concrete storage keys, including empty storage.

ColonyInventory · Инвентарь и работа

Подпись

List<String> stores()

Lists concrete storage keys, including empty storage. This is a category scan; retain the detached result and prefer direct lookups during a callback.

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

context.inventory().stores();

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

Returns
immutable storage keys with positive physical capacity, in lexical order
Throws
IllegalStateException - outside the owning callback or thread
context.inventory().transfer(source, destination, resourceId, amount)МетодImmediately transfers an exact quantity between two concrete stores.

ColonyInventory · Инвентарь и работа

Подпись

boolean transfer(String source, String destination, String resourceId, int amount)

Immediately transfers an exact quantity between two concrete stores. This is a scripted inventory operation, not a hauling order. Filters, aggregate stack-size capacity, and integer overflow are checked before mutation; stack metadata and age buckets are preserved. Capacity estimation does not distinguish individual copies' metadata. A rejected transfer changes neither store.

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

context.inventory().transfer(source, destination, resourceId, amount);

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

Parameters
source - existing source key
Parameters
destination - existing destination key, distinct from source
Parameters
resourceId - registered resource identity
Parameters
amount - quantity from 1 through 4096
Returns
whether the full quantity moved
Throws
IllegalArgumentException - if amount is outside its bounds
Throws
IllegalStateException - outside the callback/thread or after its shared 128-command budget
ColonyNoticeТипA localized event-log message and transient alert, optionally focusing a world tile.

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

Подпись

public record ColonyNotice(String key, List<String> arguments, ColonyContext.Position focus, ColonyNotice.Tone tone) extends Record

A localized event-log message and transient alert, optionally focusing a world tile.

Record Components
key - translation key in the sending mod's namespace
Record Components
arguments - at most eight short display values, such as captured names or formatted counts
Record Components
focus - optional tile to center when the player clicks the alert or log entry
Record Components
tone - visual emphasis; all tones use the game's existing general notification sound
new ColonyNoticeКонструкторCopies arguments and validates message-size limits before crossing into the host.

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

Подпись

public ColonyNotice(String key, List<String> arguments, ColonyContext.Position focus, ColonyNotice.Tone tone)

Copies arguments and validates message-size limits before crossing into the host. Key ownership, translation availability, and focus bounds are checked when the notice is posted.

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

new ColonyNotice(key, arguments, focus, tone);

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

Parameters
key - nonblank translation key of at most 256 characters
Parameters
arguments - at most eight nonnull strings of at most 256 characters each
Parameters
focus - optional camera destination
Parameters
tone - required emphasis
Throws
NullPointerException - if key, arguments, an argument or tone is null
Throws
IllegalArgumentException - if the key is blank/overlong, there are more than eight arguments, or any argument exceeds 256 UTF-16 characters
ColonyNotice.ToneТипPresentation emphasis for an informational mod notification.

ColonyNotice.Tone · Мероприятия и панели

Подпись

public static enum ColonyNotice.Tone extends Enum<ColonyNotice.Tone>

Presentation emphasis for an informational mod notification.

All Implemented Interfaces
Serializable, Comparable<ColonyNotice.Tone>, Constable
ColonyNotice.Tone.DANGERКонстантаAn adverse outcome or danger.

ColonyNotice.Tone · Мероприятия и панели

Подпись

public static final ColonyNotice.Tone DANGER

An adverse outcome or danger.

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

ColonyNotice.Tone.DANGER

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

ColonyNotice.Tone.NEUTRALКонстантаOrdinary information.

ColonyNotice.Tone · Мероприятия и панели

Подпись

public static final ColonyNotice.Tone NEUTRAL

Ordinary information.

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

ColonyNotice.Tone.NEUTRAL

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

ColonyNotice.Tone.POSITIVEКонстантаA positive outcome.

ColonyNotice.Tone · Мероприятия и панели

Подпись

public static final ColonyNotice.Tone POSITIVE

A positive outcome.

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

ColonyNotice.Tone.POSITIVE

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

ColonyNotice.Tone.valueOf(name)МетодReturns the enum constant of this class with the specified name.

ColonyNotice.Tone · Мероприятия и панели

Подпись

public static ColonyNotice.Tone valueOf(String name)

Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)

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

ColonyNotice.Tone.valueOf(name);

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

Parameters
name - the name of the enum constant to be returned.
Returns
the enum constant with the specified name
Throws
IllegalArgumentException - if this enum class has no constant with the specified name
Throws
NullPointerException - if the argument is null
ColonyNotice.Tone.values()МетодReturns an array containing the constants of this enum class, in the order they are declared.

ColonyNotice.Tone · Мероприятия и панели

Подпись

public static ColonyNotice.Tone[] values()

Returns an array containing the constants of this enum class, in the order they are declared.

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

ColonyNotice.Tone.values();

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

Returns
an array containing the constants of this enum class, in the order they are declared
colonyNotice.arguments()МетодReturns at most eight short display values, such as captured names or formatted counts.

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

Подпись

public List<String> arguments()

Returns at most eight short display values, such as captured names or formatted counts.

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

colonyNotice.arguments();

ColonyNotice colonyNotice is an instance of this supported API type.

Returns
at most eight short display values, such as captured names or formatted counts
colonyNotice.equals(o)МетодIndicates whether some other object is "equal to" this one.

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

Подпись

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. All components in this record class are compared with Objects::equals(Object,Object).

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

colonyNotice.equals(o);

ColonyNotice colonyNotice 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.

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