Техническая документация доступна на английском языке. Имена кода и полей соответствуют текущему 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 соответствующие записи
homeChanged.equals(o)МетодIndicates whether some other object is "equal to" this one.
ColonyEvent.HomeChanged · Мероприятия и панели
Подпись
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 '=='.
Пример звонка
homeChanged.equals(o);ColonyEvent.HomeChanged homeChanged 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.
homeChanged.hashCode()МетодReturns a hash code value for this object.
ColonyEvent.HomeChanged · Мероприятия и панели
Подпись
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.
Пример звонка
homeChanged.hashCode();ColonyEvent.HomeChanged homeChanged is an instance of this supported API type.
- Specified by
- hashCode in class Record
- Returns
- a hash code value for this object
homeChanged.homeId()МетодReturns new zone identity, or zero when unassigned.
ColonyEvent.HomeChanged · Мероприятия и панели
Подпись
public long homeId()Returns new zone identity, or zero when unassigned.
Пример звонка
homeChanged.homeId();ColonyEvent.HomeChanged homeChanged is an instance of this supported API type.
- Returns
- new zone identity, or zero when unassigned
homeChanged.position()МетодReturns first tile of the new home, or of the former home when unassigned; null for a zone with an empty footprint.
ColonyEvent.HomeChanged · Мероприятия и панели
Подпись
public ColonyContext.Position position()Returns first tile of the new home, or of the former home when unassigned; null for a zone with an empty footprint.
Пример звонка
homeChanged.position();ColonyEvent.HomeChanged homeChanged is an instance of this supported API type.
- Returns
- first tile of the new home, or of the former home when unassigned; null for a zone with an empty footprint
homeChanged.previousHomeId()МетодReturns former zone identity, or zero when unassigned.
ColonyEvent.HomeChanged · Мероприятия и панели
Подпись
public long previousHomeId()Returns former zone identity, or zero when unassigned.
Пример звонка
homeChanged.previousHomeId();ColonyEvent.HomeChanged homeChanged is an instance of this supported API type.
- Returns
- former zone identity, or zero when unassigned
homeChanged.toString()МетодReturns a string representation of this record class.
ColonyEvent.HomeChanged · Мероприятия и панели
Подпись
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.
Пример звонка
homeChanged.toString();ColonyEvent.HomeChanged homeChanged is an instance of this supported API type.
- Specified by
- toString in class Record
- Returns
- a string representation of this object
ColonyEvent.PlaceableRemovedТипA placed object left the world, including demolition, destruction, replacement and cleanup.
ColonyEvent.PlaceableRemoved · Мероприятия и панели
Подпись
public static record ColonyEvent.PlaceableRemoved(long id, String definitionId, ColonyContext.Position position, boolean settlementOwned, int day) extends Record implements ColonyEventA placed object left the world, including demolition, destruction, replacement and cleanup. This notification alone does not establish combat damage or a resource refund.
- Record Components
- id - removed placeable identity
- Record Components
- definitionId - removed definition identity
- Record Components
- position - removed object's anchor and support layer
- Record Components
- settlementOwned - whether the object belonged to the settlement
- Record Components
- day - monotonic game day
new ColonyEvent.PlaceableRemovedКонструкторCreates an instance of a PlaceableRemoved record class.
ColonyEvent.PlaceableRemoved · Мероприятия и панели
Подпись
public PlaceableRemoved(long id, String definitionId, ColonyContext.Position position, boolean settlementOwned, int day)Creates an instance of a PlaceableRemoved record class.
Пример звонка
new ColonyEvent.PlaceableRemoved(id, definitionId, position, settlementOwned, day);Use the public API type shown; import forgottentowns.mod.api.*.
- Parameters
- id - removed placeable identity
- Parameters
- definitionId - removed definition identity
- Parameters
- position - removed object's anchor and support layer
- Parameters
- settlementOwned - whether the object belonged to the settlement
- Parameters
- day - monotonic game day
placeableRemoved.day()МетодReturns monotonic game day.
ColonyEvent.PlaceableRemoved · Мероприятия и панели
Подпись
public int day()Returns monotonic game day.
Пример звонка
placeableRemoved.day();ColonyEvent.PlaceableRemoved placeableRemoved is an instance of this supported API type.
- Specified by
- day in interface ColonyEvent
- Returns
- monotonic game day
placeableRemoved.definitionId()МетодReturns removed definition identity.
ColonyEvent.PlaceableRemoved · Мероприятия и панели
Подпись
public String definitionId()Returns removed definition identity.
Пример звонка
placeableRemoved.definitionId();ColonyEvent.PlaceableRemoved placeableRemoved is an instance of this supported API type.
- Returns
- removed definition identity
placeableRemoved.equals(o)МетодIndicates whether some other object is "equal to" this one.
ColonyEvent.PlaceableRemoved · Мероприятия и панели
Подпись
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 '=='.
Пример звонка
placeableRemoved.equals(o);ColonyEvent.PlaceableRemoved placeableRemoved 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.
placeableRemoved.hashCode()МетодReturns a hash code value for this object.
ColonyEvent.PlaceableRemoved · Мероприятия и панели
Подпись
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.
Пример звонка
placeableRemoved.hashCode();ColonyEvent.PlaceableRemoved placeableRemoved is an instance of this supported API type.
- Specified by
- hashCode in class Record
- Returns
- a hash code value for this object
placeableRemoved.id()МетодReturns removed placeable identity.
ColonyEvent.PlaceableRemoved · Мероприятия и панели
Подпись
public long id()Returns removed placeable identity.
Пример звонка
placeableRemoved.id();ColonyEvent.PlaceableRemoved placeableRemoved is an instance of this supported API type.
- Returns
- removed placeable identity
placeableRemoved.position()МетодReturns removed object's anchor and support layer.
ColonyEvent.PlaceableRemoved · Мероприятия и панели
Подпись
public ColonyContext.Position position()Returns removed object's anchor and support layer.
Пример звонка
placeableRemoved.position();ColonyEvent.PlaceableRemoved placeableRemoved is an instance of this supported API type.
- Returns
- removed object's anchor and support layer
placeableRemoved.settlementOwned()МетодReturns whether the object belonged to the settlement.
ColonyEvent.PlaceableRemoved · Мероприятия и панели
Подпись
public boolean settlementOwned()Returns whether the object belonged to the settlement.
Пример звонка
placeableRemoved.settlementOwned();ColonyEvent.PlaceableRemoved placeableRemoved is an instance of this supported API type.
- Returns
- whether the object belonged to the settlement
placeableRemoved.toString()МетодReturns a string representation of this record class.
ColonyEvent.PlaceableRemoved · Мероприятия и панели
Подпись
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.
Пример звонка
placeableRemoved.toString();ColonyEvent.PlaceableRemoved placeableRemoved is an instance of this supported API type.
- Specified by
- toString in class Record
- Returns
- a string representation of this object
colonyEvent.day()МетодReturns the monotonic game day when the change occurred.
ColonyEvent · Мероприятия и панели
Подпись
int day()Returns the monotonic game day when the change occurred.
Пример звонка
colonyEvent.day();ColonyEvent colonyEvent is an instance of this supported API type.
- Returns
- game day starting at one
ColonyExtensionТипOne mod-owned simulation instance per world, created through ModContext.registerColonyExtension(java.util.function.Supplier<forgottentowns.mod.api.ColonyExtension>).
ColonyExtension · Хуки и жизненный цикл
Подпись
public interface ColonyExtensionOne mod-owned simulation instance per world, created through ModContext.registerColonyExtension(java.util.function.Supplier<forgottentowns.mod.api.ColonyExtension>). Callbacks execute on the simulation thread. Never retain a context or use engine implementation classes. State is a bounded string map inside the atomic save, so loading never deserializes mod classes. Startup validation creates disposable instances and exercises empty-state restore and save/restore. Constructors and persistence callbacks must therefore be free of external side effects.
ColonyExtension.affinities(ColonyContext.View)КрюкProjects directed citizen feelings into the native roster, after all extensions update.
ColonyExtension · Хуки и жизненный цикл
Подпись
default List<ColonyAffinity> affinities(ColonyContext.View world)Projects directed citizen feelings into the native roster, after all extensions update. Called at simulation refresh boundaries, never during drawing. Return at most 16384 unique directed pairs per extension; different providers remain separate. Neutral values and pairs involving missing, dead, or deserting citizens are omitted. Keep persistent relationship state in this mod's save.
Реализуйте этот крючок
public List<ColonyAffinity> affinities(ColonyContext.View world);The engine calls your implementation; implement this signature in the registered hook.
- Parameters
- world - current read-only colony view, valid only during this callback
- Returns
- nonnull detached list of nonnull directed affinities, or an empty list when this mod supplies none
ColonyExtension.moods(ColonyContext.View, ColonyContext.Person)КрюкSupplies current happiness modifiers after all extensions have updated their citizen modifiers.
ColonyExtension · Хуки и жизненный цикл
Подпись
default List<ColonyContext.Mood> moods(ColonyContext.View world, ColonyContext.Person citizen)Supplies current happiness modifiers after all extensions have updated their citizen modifiers. Effects with the same nonempty stacking key use the greatest absolute value instead of adding. Equal absolute values retain the earlier provider's contribution. Only living, non-deserting recipients are queried; return at most 32 moods for one recipient.
Реализуйте этот крючок
public List<ColonyContext.Mood> moods(ColonyContext.View world, ColonyContext.Person citizen);The engine calls your implementation; implement this signature in the registered hook.
- Parameters
- world - current read-only colony view
- Parameters
- citizen - recipient snapshot
- Returns
- nonnull list of nonnull localized, finite happiness rates per in-game minute
ColonyExtension.onConversation(ColonyContext, int, int)КрюкObserves one newly started social exchange, independent of audio admission, muting or camera position.
ColonyExtension · Хуки и жизненный цикл
Подпись
default void onConversation(ColonyContext context, int first, int second)Observes one newly started social exchange, independent of audio admission, muting or camera position.
Реализуйте этот крючок
public void onConversation(ColonyContext context, int first, int second);The engine calls your implementation; implement this signature in the registered hook.
- Parameters
- context - scoped colony queries and commands
- Parameters
- first - first participant's stable citizen identity
- Parameters
- second - second participant's stable citizen identity
ColonyExtension.onEvent(ColonyContext, ColonyEvent)КрюкObserves a committed native change, after native accounting finishes.
ColonyExtension · Хуки и жизненный цикл
Подпись
default void onEvent(ColonyContext context, ColonyEvent event)Observes a committed native change, after native accounting finishes. Events generated by a callback wait until the next delivery boundary. Pending events and their effects are drained before saving; notifications are not replayed after loading. Ignore event types the mod does not use. No callback can cancel the native change.
Реализуйте этот крючок
public void onEvent(ColonyContext context, ColonyEvent event);The engine calls your implementation; implement this signature in the registered hook.
- Parameters
- context - scoped colony services
- Parameters
- event - detached typed event
ColonyExtension.onPanelAction(ColonyContext, String, String)КрюкHandles an enabled button from this extension's latest panel projection.
ColonyExtension · Хуки и жизненный цикл
Подпись
default void onPanelAction(ColonyContext context, String panelId, String actionId)Handles an enabled button from this extension's latest panel projection. Recheck gameplay prerequisites through the scoped services; other mods may have changed the world. Keep durable action outcomes in the ordinary extension save map. Drawing never calls this method.
Реализуйте этот крючок
public void onPanelAction(ColonyContext context, String panelId, String actionId);The engine calls your implementation; implement this signature in the registered hook.
- Parameters
- context - scoped world queries and commands, with the usual shared command budget
- Parameters
- panelId - stable mod-local panel identity
- Parameters
- actionId - stable mod-local action identity
ColonyExtension.onWorkFinished(ColonyContext, ColonyWork.Job)КрюкObserves completed or cancelled settlement work, including player-created jobs.
ColonyExtension · Хуки и жизненный цикл
Подпись
default void onWorkFinished(ColonyContext context, ColonyWork.Job job)Observes completed or cancelled settlement work, including player-created jobs. Delivery occurs after a simulation tick, before the next refresh, or before any save data is captured. Native mutation and resource accounting have finished before this callback. Events are not replayed after load; save owned job IDs and any handled outcome in this extension's state. Events caused by callbacks are delivered at the next boundary.
Реализуйте этот крючок
public void onWorkFinished(ColonyContext context, ColonyWork.Job job);The engine calls your implementation; implement this signature in the registered hook.
- Parameters
- context - scoped colony services
- Parameters
- job - immutable terminal job snapshot
ColonyExtension.panels(ColonyContext.View)КрюкProjects up to eight localized native information/action panels.
ColonyExtension · Хуки и жизненный цикл
Подпись
default List<ColonyPanel> panels(ColonyContext.View world)Projects up to eight localized native information/action panels. Called at simulation refresh boundaries and immediately before a panel action, never while drawing. This query must not change persistent state. Return an empty list to hide this mod's panels.
Реализуйте этот крючок
public List<ColonyPanel> panels(ColonyContext.View world);The engine calls your implementation; implement this signature in the registered hook.
- Parameters
- world - current callback-scoped read-only view
- Returns
- nonnull list of at most eight nonnull panel descriptions with unique mod-local identities; the host copies the list
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
