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 соответствующие записи

EquipmentTransform.producesOutput(EquipmentTransform.Input, IntSupplier)КрюкChooses whether the configured single output is produced; failure still destroys the input.

EquipmentTransform · Оборудование и инспекция

Подпись

boolean producesOutput(EquipmentTransform.Input input, IntSupplier percentile)

Chooses whether the configured single output is produced; failure still destroys the input. The hook must be deterministic and must not mutate game state or use another random source.

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

public boolean producesOutput(EquipmentTransform.Input input, IntSupplier percentile);

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

Parameters
input - immutable selected equipment and authored rule
Parameters
percentile - deterministic draws in the inclusive range 0 to 99
Returns
whether to produce exactly one configured output resource
GameModТипStartup entry point for a trusted, locally enabled Java mod.

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

Подпись

public interface GameMod

Startup entry point for a trusted, locally enabled Java mod.

HousingPolicyТипOptional expansion of ordinary single-occupant housing, bounded by usable beds.

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

Подпись

public record HousingPolicy(Set<String> zoneIds, boolean householdOnly, boolean allowSoldiers) extends Record

Optional expansion of ordinary single-occupant housing, bounded by usable beds. Multiple policies compose additively; an unrestricted policy may also admit unrelated residents.

Record Components
zoneIds - exact zone definition IDs affected by the policy
Record Components
householdOnly - whether additional occupants must share a nonempty household identity
Record Components
allowSoldiers - whether affected homes may admit soldiers; household-only policies also require household membership
new HousingPolicyКонструкторCopies and validates the affected zone IDs.

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

Подпись

public HousingPolicy(Set<String> zoneIds, boolean householdOnly, boolean allowSoldiers)

Copies and validates the affected zone IDs. The constructor checks nonblank spelling; the registration context separately restricts these IDs to the host's supported housing categories.

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

new HousingPolicy(zoneIds, householdOnly, allowSoldiers);

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

Parameters
zoneIds - nonempty set of stable zone IDs
Parameters
householdOnly - require a shared household for additional occupants
Parameters
allowSoldiers - admit soldiers, requiring household membership only for household-only policies
Throws
NullPointerException - if zoneIds or an element is null
Throws
IllegalArgumentException - if the set is empty or contains a blank ID
housingPolicy.allowSoldiers()МетодReturns whether affected homes may admit soldiers; household-only policies also require household membership.

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

Подпись

public boolean allowSoldiers()

Returns whether affected homes may admit soldiers; household-only policies also require household membership.

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

housingPolicy.allowSoldiers();

HousingPolicy housingPolicy is an instance of this supported API type.

Returns
whether affected homes may admit soldiers; household-only policies also require household membership
housingPolicy.equals(o)МетодIndicates whether some other object is "equal to" this one.

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

Подпись

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

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

housingPolicy.equals(o);

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

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

Подпись

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.

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

housingPolicy.hashCode();

HousingPolicy housingPolicy is an instance of this supported API type.

Specified by
hashCode in class Record
Returns
a hash code value for this object
housingPolicy.householdOnly()МетодReturns whether additional occupants must share a nonempty household identity.

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

Подпись

public boolean householdOnly()

Returns whether additional occupants must share a nonempty household identity.

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

housingPolicy.householdOnly();

HousingPolicy housingPolicy is an instance of this supported API type.

Returns
whether additional occupants must share a nonempty household identity
housingPolicy.toString()МетодReturns a string representation of this record class.

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

Подпись

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.

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

housingPolicy.toString();

HousingPolicy housingPolicy is an instance of this supported API type.

Specified by
toString in class Record
Returns
a string representation of this object
housingPolicy.zoneIds()МетодReturns exact zone definition IDs affected by the policy.

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

Подпись

public Set<String> zoneIds()

Returns exact zone definition IDs affected by the policy.

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

housingPolicy.zoneIds();

HousingPolicy housingPolicy is an instance of this supported API type.

Returns
exact zone definition IDs affected by the policy
KeyboardShortcutТипA mod-owned keyboard command, registered at startup and remappable without restarting.

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

Подпись

public record KeyboardShortcut(String id, String labelKey, KeyboardShortcut.Command command, int key, int modifiers, String legacyBinding) extends Record

A mod-owned keyboard command, registered at startup and remappable without restarting.

Record Components
id - namespaced command identity belonging to the registering mod
Record Components
labelKey - translation key owned by that mod
Record Components
command - shared UI operation to invoke
Record Components
key - default GLFW physical key code
Record Components
modifiers - default GLFW Shift, Control, Alt and Super bits
Record Components
legacyBinding - previous settings identity to migrate, or empty for a new command
KeyboardShortcut.CommandТипSupported shared interface operations; availability still depends on registered capabilities.

KeyboardShortcut.Command · Мероприятия и панели

Подпись

public static enum KeyboardShortcut.Command extends Enum<KeyboardShortcut.Command>

Supported shared interface operations; availability still depends on registered capabilities.

All Implemented Interfaces
Serializable, Comparable<KeyboardShortcut.Command>, Constable
KeyboardShortcut.Command.COLONY_PANELSКонстантаOpens or closes the panels supplied by enabled colony extensions.

KeyboardShortcut.Command · Мероприятия и панели

Подпись

public static final KeyboardShortcut.Command COLONY_PANELS

Opens or closes the panels supplied by enabled colony extensions.

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

KeyboardShortcut.Command.COLONY_PANELS

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

KeyboardShortcut.Command.SETTLEMENT_MAPКонстантаOpens or closes the location map supplied by an enabled map provider.

KeyboardShortcut.Command · Мероприятия и панели

Подпись

public static final KeyboardShortcut.Command SETTLEMENT_MAP

Opens or closes the location map supplied by an enabled map provider.

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

KeyboardShortcut.Command.SETTLEMENT_MAP

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

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

KeyboardShortcut.Command · Мероприятия и панели

Подпись

public static KeyboardShortcut.Command 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.)

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

KeyboardShortcut.Command.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
KeyboardShortcut.Command.values()МетодReturns an array containing the constants of this enum class, in the order they are declared.

KeyboardShortcut.Command · Мероприятия и панели

Подпись

public static KeyboardShortcut.Command[] values()

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

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

KeyboardShortcut.Command.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
new KeyboardShortcutКонструкторValidates the portable shortcut definition.

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

Подпись

public KeyboardShortcut(String id, String labelKey, KeyboardShortcut.Command command, int key, int modifiers, String legacyBinding)

Validates the portable shortcut definition.

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

new KeyboardShortcut(id, labelKey, command, key, modifiers, legacyBinding);

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

Parameters
id - namespaced command identity
Parameters
labelKey - owned translation key
Parameters
command - shared UI operation
Parameters
key - default physical key code
Parameters
modifiers - modifier mask between zero and fifteen
Parameters
legacyBinding - obsolete unnamespaced preference identity, or empty
Throws
IllegalArgumentException - if an identity, command, key or modifier is invalid
keyboardShortcut.command()МетодReturns shared UI operation to invoke.

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

Подпись

public KeyboardShortcut.Command command()

Returns shared UI operation to invoke.

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

keyboardShortcut.command();

KeyboardShortcut keyboardShortcut is an instance of this supported API type.

Returns
shared UI operation to invoke
keyboardShortcut.equals(o)МетодIndicates whether some other object is "equal to" this one.

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

Подпись

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

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

keyboardShortcut.equals(o);

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

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

Подпись

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.

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

keyboardShortcut.hashCode();

KeyboardShortcut keyboardShortcut is an instance of this supported API type.

Specified by
hashCode in class Record
Returns
a hash code value for this object
keyboardShortcut.id()МетодReturns namespaced command identity belonging to the registering mod.

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

Подпись

public String id()

Returns namespaced command identity belonging to the registering mod.

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

keyboardShortcut.id();

KeyboardShortcut keyboardShortcut is an instance of this supported API type.

Returns
namespaced command identity belonging to the registering mod
keyboardShortcut.key()МетодReturns default GLFW physical key code.

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

Подпись

public int key()

Returns default GLFW physical key code.

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

keyboardShortcut.key();

KeyboardShortcut keyboardShortcut is an instance of this supported API type.

Returns
default GLFW physical key code
keyboardShortcut.labelKey()МетодReturns translation key owned by that mod.

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

Подпись

public String labelKey()

Returns translation key owned by that mod.

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

keyboardShortcut.labelKey();

KeyboardShortcut keyboardShortcut is an instance of this supported API type.

Returns
translation key owned by that mod
keyboardShortcut.legacyBinding()МетодReturns previous settings identity to migrate, or empty for a new command.

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

Подпись

public String legacyBinding()

Returns previous settings identity to migrate, or empty for a new command.

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

keyboardShortcut.legacyBinding();

KeyboardShortcut keyboardShortcut is an instance of this supported API type.

Returns
previous settings identity to migrate, or empty for a new command
keyboardShortcut.modifiers()МетодReturns default GLFW Shift, Control, Alt and Super bits.

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

Подпись

public int modifiers()

Returns default GLFW Shift, Control, Alt and Super bits.

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

keyboardShortcut.modifiers();

KeyboardShortcut keyboardShortcut is an instance of this supported API type.

Returns
default GLFW Shift, Control, Alt and Super bits

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