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

homeChanged.equals(o)MetodaIndicates whether some other object is "equal to" this one.

ColonyEvent.HomeChanged · Wydarzenia i panele

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

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

ColonyEvent.HomeChanged · Wydarzenia i panele

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

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()MetodaReturns new zone identity, or zero when unassigned.

ColonyEvent.HomeChanged · Wydarzenia i panele

Podpis

public long homeId()

Returns new zone identity, or zero when unassigned.

Zadzwoń do przykładu

homeChanged.homeId();

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

Returns
new zone identity, or zero when unassigned
homeChanged.position()MetodaReturns first tile of the new home, or of the former home when unassigned; null for a zone with an empty footprint.

ColonyEvent.HomeChanged · Wydarzenia i panele

Podpis

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.

Zadzwoń do przykładu

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()MetodaReturns former zone identity, or zero when unassigned.

ColonyEvent.HomeChanged · Wydarzenia i panele

Podpis

public long previousHomeId()

Returns former zone identity, or zero when unassigned.

Zadzwoń do przykładu

homeChanged.previousHomeId();

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

Returns
former zone identity, or zero when unassigned
homeChanged.toString()MetodaReturns a string representation of this record class.

ColonyEvent.HomeChanged · Wydarzenia i panele

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

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.PlaceableRemovedTypA placed object left the world, including demolition, destruction, replacement and cleanup.

ColonyEvent.PlaceableRemoved · Wydarzenia i panele

Podpis

public static record ColonyEvent.PlaceableRemoved(long id, String definitionId, ColonyContext.Position position, boolean settlementOwned, int day) extends Record implements ColonyEvent

A 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.PlaceableRemovedKonstruktorCreates an instance of a PlaceableRemoved record class.

ColonyEvent.PlaceableRemoved · Wydarzenia i panele

Podpis

public PlaceableRemoved(long id, String definitionId, ColonyContext.Position position, boolean settlementOwned, int day)

Creates an instance of a PlaceableRemoved record class.

Zadzwoń do przykładu

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()MetodaReturns monotonic game day.

ColonyEvent.PlaceableRemoved · Wydarzenia i panele

Podpis

public int day()

Returns monotonic game day.

Zadzwoń do przykładu

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()MetodaReturns removed definition identity.

ColonyEvent.PlaceableRemoved · Wydarzenia i panele

Podpis

public String definitionId()

Returns removed definition identity.

Zadzwoń do przykładu

placeableRemoved.definitionId();

ColonyEvent.PlaceableRemoved placeableRemoved is an instance of this supported API type.

Returns
removed definition identity
placeableRemoved.equals(o)MetodaIndicates whether some other object is "equal to" this one.

ColonyEvent.PlaceableRemoved · Wydarzenia i panele

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

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

ColonyEvent.PlaceableRemoved · Wydarzenia i panele

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

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()MetodaReturns removed placeable identity.

ColonyEvent.PlaceableRemoved · Wydarzenia i panele

Podpis

public long id()

Returns removed placeable identity.

Zadzwoń do przykładu

placeableRemoved.id();

ColonyEvent.PlaceableRemoved placeableRemoved is an instance of this supported API type.

Returns
removed placeable identity
placeableRemoved.position()MetodaReturns removed object's anchor and support layer.

ColonyEvent.PlaceableRemoved · Wydarzenia i panele

Podpis

public ColonyContext.Position position()

Returns removed object's anchor and support layer.

Zadzwoń do przykładu

placeableRemoved.position();

ColonyEvent.PlaceableRemoved placeableRemoved is an instance of this supported API type.

Returns
removed object's anchor and support layer
placeableRemoved.settlementOwned()MetodaReturns whether the object belonged to the settlement.

ColonyEvent.PlaceableRemoved · Wydarzenia i panele

Podpis

public boolean settlementOwned()

Returns whether the object belonged to the settlement.

Zadzwoń do przykładu

placeableRemoved.settlementOwned();

ColonyEvent.PlaceableRemoved placeableRemoved is an instance of this supported API type.

Returns
whether the object belonged to the settlement
placeableRemoved.toString()MetodaReturns a string representation of this record class.

ColonyEvent.PlaceableRemoved · Wydarzenia i panele

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

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()MetodaReturns the monotonic game day when the change occurred.

ColonyEvent · Wydarzenia i panele

Podpis

int day()

Returns the monotonic game day when the change occurred.

Zadzwoń do przykładu

colonyEvent.day();

ColonyEvent colonyEvent is an instance of this supported API type.

Returns
game day starting at one
ColonyExtensionTypOne mod-owned simulation instance per world, created through ModContext.registerColonyExtension(java.util.function.Supplier<forgottentowns.mod.api.ColonyExtension>).

ColonyExtension · Haki i cykl życia

Podpis

public interface ColonyExtension

One 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)HakProjects directed citizen feelings into the native roster, after all extensions update.

ColonyExtension · Haki i cykl życia

Podpis

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.

Zaimplementuj ten hak

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)HakSupplies current happiness modifiers after all extensions have updated their citizen modifiers.

ColonyExtension · Haki i cykl życia

Podpis

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.

Zaimplementuj ten hak

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)HakObserves one newly started social exchange, independent of audio admission, muting or camera position.

ColonyExtension · Haki i cykl życia

Podpis

default void onConversation(ColonyContext context, int first, int second)

Observes one newly started social exchange, independent of audio admission, muting or camera position.

Zaimplementuj ten hak

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)HakObserves a committed native change, after native accounting finishes.

ColonyExtension · Haki i cykl życia

Podpis

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.

Zaimplementuj ten hak

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)HakHandles an enabled button from this extension's latest panel projection.

ColonyExtension · Haki i cykl życia

Podpis

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.

Zaimplementuj ten hak

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)HakObserves completed or cancelled settlement work, including player-created jobs.

ColonyExtension · Haki i cykl życia

Podpis

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.

Zaimplementuj ten hak

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)HakProjects up to eight localized native information/action panels.

ColonyExtension · Haki i cykl życia

Podpis

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.

Zaimplementuj ten hak

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