FORGOTTEN TOWNS

FORGOTTEN TOWNS / DOKUMENTACJA MODDOWANIA

Wiki o modowaniu ↗

Java Odniesienie do API (Javadoc)

MOD API 15

Przeglądaj wiki

Aktualna dokumentacja Mod API.

Dokumentacja techniczna dostępna jest w języku angielskim. Nazwy kodów i pól są zgodne z bieżącym API Mod.

DOKUMENTACJA MODDOWANIA

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 typy publiczne · 468 członkowie · Content API 15

Zresetuj

528 pasujące wpisy

modifiers.visualArchetype()MetodaReturns existing visual archetype override, or empty.

ColonyContext.Modifiers · Obywatele i domy

Podpis

public String visualArchetype()

Returns existing visual archetype override, or empty.

Zadzwoń do przykładu

modifiers.visualArchetype();

ColonyContext.Modifiers modifiers is an instance of this supported API type.

Returns
existing visual archetype override, or empty
ColonyContext.MoodTypOne named recurring happiness modifier.

ColonyContext.Mood · Obywatele i domy

Podpis

public static record ColonyContext.Mood(String labelKey, double amount, String stackingKey) extends Record

One named recurring happiness modifier.

Record Components
labelKey - owning-mod translation key
Record Components
amount - signed rate per in-game minute, bounded to [-100,100]
Record Components
stackingKey - shared non-stacking identity, or empty for an independently additive source
new ColonyContext.MoodKonstruktorValidates a happiness source.

ColonyContext.Mood · Obywatele i domy

Podpis

public Mood(String labelKey, double amount, String stackingKey)

Validates a happiness source.

Zadzwoń do przykładu

new ColonyContext.Mood(labelKey, amount, stackingKey);

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

Parameters
labelKey - translation key
Parameters
amount - signed happiness rate
Parameters
stackingKey - stacking identity
Throws
IllegalArgumentException - if the amount is invalid or the label is blank
Throws
NullPointerException - if labelKey or stackingKey is null
mood.amount()MetodaReturns signed rate per in-game minute, bounded to [-100,100].

ColonyContext.Mood · Obywatele i domy

Podpis

public double amount()

Returns signed rate per in-game minute, bounded to [-100,100].

Zadzwoń do przykładu

mood.amount();

ColonyContext.Mood mood is an instance of this supported API type.

Returns
signed rate per in-game minute, bounded to [-100,100]
mood.equals(o)MetodaIndicates whether some other object is "equal to" this one.

ColonyContext.Mood · Obywatele i domy

Podpis

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

Zadzwoń do przykładu

mood.equals(o);

ColonyContext.Mood mood 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.
mood.hashCode()MetodaReturns a hash code value for this object.

ColonyContext.Mood · Obywatele i domy

Podpis

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.

Zadzwoń do przykładu

mood.hashCode();

ColonyContext.Mood mood is an instance of this supported API type.

Specified by
hashCode in class Record
Returns
a hash code value for this object
mood.labelKey()MetodaReturns owning-mod translation key.

ColonyContext.Mood · Obywatele i domy

Podpis

public String labelKey()

Returns owning-mod translation key.

Zadzwoń do przykładu

mood.labelKey();

ColonyContext.Mood mood is an instance of this supported API type.

Returns
owning-mod translation key
mood.stackingKey()MetodaReturns shared non-stacking identity, or empty for an independently additive source.

ColonyContext.Mood · Obywatele i domy

Podpis

public String stackingKey()

Returns shared non-stacking identity, or empty for an independently additive source.

Zadzwoń do przykładu

mood.stackingKey();

ColonyContext.Mood mood is an instance of this supported API type.

Returns
shared non-stacking identity, or empty for an independently additive source
mood.toString()MetodaReturns a string representation of this record class.

ColonyContext.Mood · Obywatele i domy

Podpis

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.

Zadzwoń do przykładu

mood.toString();

ColonyContext.Mood mood is an instance of this supported API type.

Specified by
toString in class Record
Returns
a string representation of this object
ColonyContext.PersonTypImmutable citizen identity and projected state.

ColonyContext.Person · Obywatele i domy

Podpis

public static record ColonyContext.Person(int id, String name, boolean female, boolean living, boolean civilian, boolean soldier, boolean hero, ColonyContext.Position position, String household, boolean needsBed) extends Record

Immutable citizen identity and projected state.

Record Components
id - stable citizen identity
Record Components
name - current player-visible name
Record Components
female - female identity flag
Record Components
living - alive and not deserting
Record Components
civilian - ordinary civilian classification
Record Components
soldier - soldier classification
Record Components
hero - named hero classification
Record Components
position - current tile, or null while absent
Record Components
household - shared household key projected by a mod, or empty
Record Components
needsBed - whether the citizen currently needs an individual bed
new ColonyContext.PersonKonstruktorCreates an instance of a Person record class.

ColonyContext.Person · Obywatele i domy

Podpis

public Person(int id, String name, boolean female, boolean living, boolean civilian, boolean soldier, boolean hero, ColonyContext.Position position, String household, boolean needsBed)

Creates an instance of a Person record class.

Zadzwoń do przykładu

new ColonyContext.Person(id, name, female, living, civilian, soldier, hero, position, household, needsBed);

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

Parameters
id - stable citizen identity
Parameters
name - current player-visible name
Parameters
female - female identity flag
Parameters
living - alive and not deserting
Parameters
civilian - ordinary civilian classification
Parameters
soldier - soldier classification
Parameters
hero - named hero classification
Parameters
position - current tile, or null while absent
Parameters
household - shared household key projected by a mod, or empty
Parameters
needsBed - whether the citizen currently needs an individual bed
person.civilian()MetodaReturns ordinary civilian classification.

ColonyContext.Person · Obywatele i domy

Podpis

public boolean civilian()

Returns ordinary civilian classification.

Zadzwoń do przykładu

person.civilian();

ColonyContext.Person person = context.view().citizen(id); check for null before reading its values.

Returns
ordinary civilian classification
person.equals(o)MetodaIndicates whether some other object is "equal to" this one.

ColonyContext.Person · Obywatele i domy

Podpis

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

Zadzwoń do przykładu

person.equals(o);

ColonyContext.Person person = context.view().citizen(id); check for null before reading its values.

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.
person.female()MetodaReturns female identity flag.

ColonyContext.Person · Obywatele i domy

Podpis

public boolean female()

Returns female identity flag.

Zadzwoń do przykładu

person.female();

ColonyContext.Person person = context.view().citizen(id); check for null before reading its values.

Returns
female identity flag
person.hashCode()MetodaReturns a hash code value for this object.

ColonyContext.Person · Obywatele i domy

Podpis

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.

Zadzwoń do przykładu

person.hashCode();

ColonyContext.Person person = context.view().citizen(id); check for null before reading its values.

Specified by
hashCode in class Record
Returns
a hash code value for this object
person.hero()MetodaReturns named hero classification.

ColonyContext.Person · Obywatele i domy

Podpis

public boolean hero()

Returns named hero classification.

Zadzwoń do przykładu

person.hero();

ColonyContext.Person person = context.view().citizen(id); check for null before reading its values.

Returns
named hero classification
person.household()MetodaReturns shared household key projected by a mod, or empty.

ColonyContext.Person · Obywatele i domy

Podpis

public String household()

Returns shared household key projected by a mod, or empty.

Zadzwoń do przykładu

person.household();

ColonyContext.Person person = context.view().citizen(id); check for null before reading its values.

Returns
shared household key projected by a mod, or empty
person.id()MetodaReturns stable citizen identity.

ColonyContext.Person · Obywatele i domy

Podpis

public int id()

Returns stable citizen identity.

Zadzwoń do przykładu

person.id();

ColonyContext.Person person = context.view().citizen(id); check for null before reading its values.

Returns
stable citizen identity
person.living()MetodaReturns alive and not deserting.

ColonyContext.Person · Obywatele i domy

Podpis

public boolean living()

Returns alive and not deserting.

Zadzwoń do przykładu

person.living();

ColonyContext.Person person = context.view().citizen(id); check for null before reading its values.

Returns
alive and not deserting
person.name()MetodaReturns current player-visible name.

ColonyContext.Person · Obywatele i domy

Podpis

public String name()

Returns current player-visible name.

Zadzwoń do przykładu

person.name();

ColonyContext.Person person = context.view().citizen(id); check for null before reading its values.

Returns
current player-visible name
person.needsBed()MetodaReturns whether the citizen currently needs an individual bed.

ColonyContext.Person · Obywatele i domy

Podpis

public boolean needsBed()

Returns whether the citizen currently needs an individual bed.

Zadzwoń do przykładu

person.needsBed();

ColonyContext.Person person = context.view().citizen(id); check for null before reading its values.

Returns
whether the citizen currently needs an individual bed
person.position()MetodaReturns current tile, or null while absent.

ColonyContext.Person · Obywatele i domy

Podpis

public ColonyContext.Position position()

Returns current tile, or null while absent.

Zadzwoń do przykładu

person.position();

ColonyContext.Person person = context.view().citizen(id); check for null before reading its values.

Returns
current tile, or null while absent
person.soldier()MetodaReturns soldier classification.

ColonyContext.Person · Obywatele i domy

Podpis

public boolean soldier()

Returns soldier classification.

Zadzwoń do przykładu

person.soldier();

ColonyContext.Person person = context.view().citizen(id); check for null before reading its values.

Returns
soldier classification
person.toString()MetodaReturns a string representation of this record class.

ColonyContext.Person · Obywatele i domy

Podpis

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.

Zadzwoń do przykładu

person.toString();

ColonyContext.Person person = context.view().citizen(id); check for null before reading its values.

Specified by
toString in class Record
Returns
a string representation of this object
ColonyContext.PositionTypA surface position at tile resolution.

ColonyContext.Position · Obywatele i domy

Podpis

public static record ColonyContext.Position(int x, int y, int z) extends Record

A surface position at tile resolution.

Record Components
x - tile column
Record Components
y - tile row
Record Components
z - surface level

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