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
528 pasujące wpisy
new ColonyContext.PositionKonstruktorCreates an instance of a Position record class.
ColonyContext.Position · Obywatele i domy
Podpis
public Position(int x, int y, int z)Creates an instance of a Position record class.
Zadzwoń do przykładu
new ColonyContext.Position(x, y, z);Use the public API type shown; import forgottentowns.mod.api.*.
- Parameters
- x - tile column
- Parameters
- y - tile row
- Parameters
- z - surface level
position.equals(o)MetodaIndicates whether some other object is "equal to" this one.
ColonyContext.Position · 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. All components in this record class are compared with '=='.
Zadzwoń do przykładu
position.equals(o);ColonyContext.Position position 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.
position.hashCode()MetodaReturns a hash code value for this object.
ColonyContext.Position · 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
position.hashCode();ColonyContext.Position position is an instance of this supported API type.
- Specified by
- hashCode in class Record
- Returns
- a hash code value for this object
position.toString()MetodaReturns a string representation of this record class.
ColonyContext.Position · 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
position.toString();ColonyContext.Position position is an instance of this supported API type.
- Specified by
- toString in class Record
- Returns
- a string representation of this object
position.x()MetodaReturns tile column.
ColonyContext.Position · Obywatele i domy
Podpis
public int x()Returns tile column.
Zadzwoń do przykładu
position.x();ColonyContext.Position position is an instance of this supported API type.
- Returns
- tile column
position.y()MetodaReturns tile row.
ColonyContext.Position · Obywatele i domy
Podpis
public int y()Returns tile row.
Zadzwoń do przykładu
position.y();ColonyContext.Position position is an instance of this supported API type.
- Returns
- tile row
position.z()MetodaReturns surface level.
ColonyContext.Position · Obywatele i domy
Podpis
public int z()Returns surface level.
Zadzwoń do przykładu
position.z();ColonyContext.Position position is an instance of this supported API type.
- Returns
- surface level
ColonyContext.StatusTypLocalized roster status, such as a relationship or a temporary absence from work.
ColonyContext.Status · Obywatele i domy
Podpis
public static record ColonyContext.Status(String key, List<String> arguments) extends RecordLocalized roster status, such as a relationship or a temporary absence from work.
- Record Components
- key - translation key in the owning mod's namespace
- Record Components
- arguments - immutable formatted arguments, such as a citizen's name or remaining days
new ColonyContext.StatusKonstruktorCopies arguments for a localized citizen status without validating key ownership.
ColonyContext.Status · Obywatele i domy
Podpis
public Status(String key, List<String> arguments)Copies arguments for a localized citizen status without validating key ownership.
Zadzwoń do przykładu
new ColonyContext.Status(key, arguments);Use the public API type shown; import forgottentowns.mod.api.*.
- Parameters
- key - translation key, checked when the status is applied through the context
- Parameters
- arguments - message arguments
- Throws
- NullPointerException - if arguments is null or contains null
status.arguments()MetodaReturns immutable formatted arguments, such as a citizen's name or remaining days.
ColonyContext.Status · Obywatele i domy
Podpis
public List<String> arguments()Returns immutable formatted arguments, such as a citizen's name or remaining days.
Zadzwoń do przykładu
status.arguments();ColonyContext.Status status is an instance of this supported API type.
- Returns
- immutable formatted arguments, such as a citizen's name or remaining days
status.equals(o)MetodaIndicates whether some other object is "equal to" this one.
ColonyContext.Status · 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. All components in this record class are compared with Objects::equals(Object,Object).
Zadzwoń do przykładu
status.equals(o);ColonyContext.Status status 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.
status.hashCode()MetodaReturns a hash code value for this object.
ColonyContext.Status · 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
status.hashCode();ColonyContext.Status status is an instance of this supported API type.
- Specified by
- hashCode in class Record
- Returns
- a hash code value for this object
status.key()MetodaReturns translation key in the owning mod's namespace.
ColonyContext.Status · Obywatele i domy
Podpis
public String key()Returns translation key in the owning mod's namespace.
Zadzwoń do przykładu
status.key();ColonyContext.Status status is an instance of this supported API type.
- Returns
- translation key in the owning mod's namespace
status.toString()MetodaReturns a string representation of this record class.
ColonyContext.Status · 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
status.toString();ColonyContext.Status status is an instance of this supported API type.
- Specified by
- toString in class Record
- Returns
- a string representation of this object
ColonyContext.ViewTypRead-only bounded colony access tied to its creating callback and thread.
ColonyContext.View · Obywatele i domy
Podpis
public static interface ColonyContext.ViewRead-only bounded colony access tied to its creating callback and thread. Every query rejects an expired scope or a different thread. Returned records and lists are detached values that may be retained; this view object itself cannot be used after the callback.
- Enclosing interface
- ColonyContext
context.view().day()MetodaReturns monotonic game calendar day, starting at one.
ColonyContext.View · Obywatele i domy
Podpis
int day()Returns monotonic game calendar day, starting at one.
Zadzwoń do przykładu
context.view().day();Obtain the read-only view from the active ColonyContext. In projection hooks, use the supplied ColonyContext.View world directly.
- Returns
- monotonic game calendar day, starting at one
- Throws
- IllegalStateException - outside the owning callback or thread
context.view().daysPerSeason()MetodaReturns days in one season, the default month used by simulation mods.
ColonyContext.View · Obywatele i domy
Podpis
int daysPerSeason()Returns days in one season, the default month used by simulation mods.
Zadzwoń do przykładu
context.view().daysPerSeason();Obtain the read-only view from the active ColonyContext. In projection hooks, use the supplied ColonyContext.View world directly.
- Returns
- days in one season, the default month used by simulation mods
- Throws
- IllegalStateException - outside the owning callback or thread
context.view().daysPerYear()MetodaReturns days in the game's year.
ColonyContext.View · Obywatele i domy
Podpis
int daysPerYear()Returns days in the game's year.
Zadzwoń do przykładu
context.view().daysPerYear();Obtain the read-only view from the active ColonyContext. In projection hooks, use the supplied ColonyContext.View world directly.
- Returns
- days in the game's year
- Throws
- IllegalStateException - outside the owning callback or thread
context.view().home(id)MetodaLooks up a home by stable identity.
ColonyContext.View · Obywatele i domy
Podpis
ColonyContext.Home home(long id)Looks up a home by stable identity.
Zadzwoń do przykładu
context.view().home(id);Obtain the read-only view from the active ColonyContext. In projection hooks, use the supplied ColonyContext.View world directly.
- Parameters
- id - home identity
- Returns
- home snapshot, or null when absent
- Throws
- IllegalStateException - outside the owning callback or thread
context.view().homeOf(citizenId)MetodaResolves a citizen's assigned home.
ColonyContext.View · Obywatele i domy
Podpis
ColonyContext.Home homeOf(int citizenId)Resolves a citizen's assigned home.
Zadzwoń do przykładu
context.view().homeOf(citizenId);Obtain the read-only view from the active ColonyContext. In projection hooks, use the supplied ColonyContext.View world directly.
- Parameters
- citizenId - citizen identity
- Returns
- assigned home, or null when absent
- Throws
- IllegalStateException - outside the owning callback or thread
context.view().homes()MetodaReturns the captured catalog of supported residential zones.
ColonyContext.View · Obywatele i domy
Podpis
List<ColonyContext.Home> homes()Returns the captured catalog of supported residential zones.
Zadzwoń do przykładu
context.view().homes();Obtain the read-only view from the active ColonyContext. In projection hooks, use the supplied ColonyContext.View world directly.
- Returns
- immutable home catalog in stable identity order
- Throws
- IllegalStateException - outside the owning callback or thread
context.view().nearby(position, radius)MetodaQueries the shared spatial index using Chebyshev distance on the same level.
ColonyContext.View · Obywatele i domy
Podpis
List<ColonyContext.Person> nearby(ColonyContext.Position position, int radius)Queries the shared spatial index using Chebyshev distance on the same level.
Zadzwoń do przykładu
context.view().nearby(position, radius);Obtain the read-only view from the active ColonyContext. In projection hooks, use the supplied ColonyContext.View world directly.
- Parameters
- position - query origin within the world's tile-coordinate range, or null for no matches
- Parameters
- radius - tile radius between zero and 32
- Returns
- immutable nearby living citizen snapshots in stable ID order
- Throws
- IllegalArgumentException - if radius is outside its bounds
- Throws
- IllegalStateException - outside the owning callback or thread
context.assignHome(citizenId, homeId)MetodaMoves a citizen's home assignment through normal capacity and eligibility rules.
ColonyContext · Obywatele i domy
Podpis
boolean assignHome(int citizenId, long homeId)Moves a citizen's home assignment through normal capacity and eligibility rules.
Zadzwoń do przykładu
context.assignHome(citizenId, homeId);ColonyContext context is supplied to a ColonyExtension callback. Use it only during that callback on its owning thread.
- Parameters
- citizenId - living citizen identity
- Parameters
- homeId - target home identity
- Returns
- whether assignment succeeded; no existing assignment is lost on failure
- Throws
- IllegalStateException - if the callback has ended or the caller uses another thread
context.dailyRoll(eventKey, bound)MetodaReturns a deterministic daily roll without consuming the game's random stream.
ColonyContext · Obywatele i domy
Podpis
int dailyRoll(String eventKey, int bound)Returns a deterministic daily roll without consuming the game's random stream. Repeating the same key, mod, world and day returns the same value, including after load.
Zadzwoń do przykładu
context.dailyRoll(eventKey, bound);ColonyContext context is supplied to a ColonyExtension callback. Use it only during that callback on its owning thread.
- Parameters
- eventKey - stable mod-local event identity
- Parameters
- bound - exclusive positive upper bound
- Returns
- integer in [0, bound)
- Throws
- IllegalArgumentException - if the key is null, blank, exceeds 256 characters, or bound is nonpositive
- Throws
- IllegalStateException - if the callback has ended or the caller uses another thread
context.modify(citizenId, modifiers)MetodaReplaces only this mod's modifiers for a living citizen.
ColonyContext · Obywatele i domy
Podpis
boolean modify(int citizenId, ColonyContext.Modifiers modifiers)Replaces only this mod's modifiers for a living citizen. Other mods' modifiers remain intact.
Zadzwoń do przykładu
context.modify(citizenId, modifiers);ColonyContext context is supplied to a ColonyExtension callback. Use it only during that callback on its owning thread.
- Parameters
- citizenId - stable citizen identity
- Parameters
- modifiers - immutable bounded effects; ColonyContext.Modifiers.NONE clears this mod's effects
- Returns
- whether the citizen exists and is alive
- Throws
- IllegalArgumentException - if a visual, label, household namespace or bed is invalid
- Throws
- IllegalStateException - if the callback has ended or the caller uses another thread
- Throws
- NullPointerException - if modifiers or one of its status translation keys is null
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
