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

ParticleShapeTypConvex particle silhouette, reused by ordinary and body-masked drawing.

ParticleShape · Cząstki

Podpis

public record ParticleShape(List<ParticleShape.Point> vertices) extends Record

Convex particle silhouette, reused by ordinary and body-masked drawing.

Record Components
vertices - counterclockwise polygon vertices around the origin, between three and sixteen
new ParticleShapeKonstruktorCopies and validates a convex polygon containing the origin.

ParticleShape · Cząstki

Podpis

public ParticleShape(List<ParticleShape.Point> vertices)

Copies and validates a convex polygon containing the origin.

Zadzwoń do przykładu

new ParticleShape(vertices);

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

Parameters
vertices - counterclockwise normalized vertices
Throws
IllegalArgumentException - if vertices is null, contains null, has fewer than three or more than sixteen entries, fails counterclockwise origin containment, or is nonconvex
ParticleShape.PointTypOne normalized vertex.

ParticleShape.Point · Cząstki

Podpis

public static record ParticleShape.Point(double x, double y) extends Record

One normalized vertex.

Record Components
x - horizontal coordinate in [-1, 1]
Record Components
y - vertical coordinate in [-1, 1]
new ParticleShape.PointKonstruktorValidates finite normalized coordinates.

ParticleShape.Point · Cząstki

Podpis

public Point(double x, double y)

Validates finite normalized coordinates.

Zadzwoń do przykładu

new ParticleShape.Point(x, y);

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

Parameters
x - horizontal coordinate
Parameters
y - vertical coordinate
Throws
IllegalArgumentException - if either coordinate is nonfinite or outside [-1, 1]
point.equals(o)MetodaIndicates whether some other object is "equal to" this one.

ParticleShape.Point · Cząstki

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

point.equals(o);

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

ParticleShape.Point · Cząstki

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

point.hashCode();

ParticleShape.Point point is an instance of this supported API type.

Specified by
hashCode in class Record
Returns
a hash code value for this object
point.toString()MetodaReturns a string representation of this record class.

ParticleShape.Point · Cząstki

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

point.toString();

ParticleShape.Point point is an instance of this supported API type.

Specified by
toString in class Record
Returns
a string representation of this object
point.x()MetodaReturns horizontal coordinate in [-1, 1].

ParticleShape.Point · Cząstki

Podpis

public double x()

Returns horizontal coordinate in [-1, 1].

Zadzwoń do przykładu

point.x();

ParticleShape.Point point is an instance of this supported API type.

Returns
horizontal coordinate in [-1, 1]
point.y()MetodaReturns vertical coordinate in [-1, 1].

ParticleShape.Point · Cząstki

Podpis

public double y()

Returns vertical coordinate in [-1, 1].

Zadzwoń do przykładu

point.y();

ParticleShape.Point point is an instance of this supported API type.

Returns
vertical coordinate in [-1, 1]
particleShape.contains(x, y)MetodaTests the same silhouette used by the renderer's clipping path.

ParticleShape · Cząstki

Podpis

public boolean contains(double x, double y)

Tests the same silhouette used by the renderer's clipping path.

Zadzwoń do przykładu

particleShape.contains(x, y);

ParticleShape particleShape is an instance of this supported API type.

Parameters
x - finite normalized horizontal query coordinate
Parameters
y - finite normalized vertical query coordinate
Returns
true when no edge places the point strictly outside, including polygon boundaries; nonfinite inputs are not validated and must not be supplied
particleShape.equals(o)MetodaIndicates whether some other object is "equal to" this one.

ParticleShape · Cząstki

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

particleShape.equals(o);

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

ParticleShape · Cząstki

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

particleShape.hashCode();

ParticleShape particleShape is an instance of this supported API type.

Specified by
hashCode in class Record
Returns
a hash code value for this object
particleShape.toString()MetodaReturns a string representation of this record class.

ParticleShape · Cząstki

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

particleShape.toString();

ParticleShape particleShape is an instance of this supported API type.

Specified by
toString in class Record
Returns
a string representation of this object
particleShape.vertices()MetodaReturns counterclockwise polygon vertices around the origin, between three and sixteen.

ParticleShape · Cząstki

Podpis

public List<ParticleShape.Point> vertices()

Returns counterclockwise polygon vertices around the origin, between three and sixteen.

Zadzwoń do przykładu

particleShape.vertices();

ParticleShape particleShape is an instance of this supported API type.

Returns
counterclockwise polygon vertices around the origin, between three and sixteen
RegistryAccessTypRead-only definition snapshots after enabled packs have composed and validated.

RegistryAccess · Rejestry i ustawienia

Podpis

public interface RegistryAccess

Read-only definition snapshots after enabled packs have composed and validated. Snapshots may be retained; they contain no live entities, managers or mutable game state. Generated trade-good resources and their packing/unpacking recipes are included as startup summaries. Generated equipment variants and other runtime-derived definitions are not generally included. Available through ModContext.onRegistriesReady(java.util.function.Consumer<forgottentowns.mod.api.RegistryAccess>).

RegistryAccess.DefinitionTypOne authored definition or generated startup summary, excluding its identity field from the values map.

RegistryAccess.Definition · Rejestry i ustawienia

Podpis

public static record RegistryAccess.Definition(String id, Map<String,Object> values) extends Record

One authored definition or generated startup summary, excluding its identity field from the values map. Values use the documented JSON field names and contain strings, numbers, booleans, null, lists and string-keyed maps. This is a content snapshot, not a gameplay object.

Record Components
id - stable definition identity
Record Components
values - deeply immutable JSON values
new RegistryAccess.DefinitionKonstruktorCreates a defensive, deeply immutable copy of a definition.

RegistryAccess.Definition · Rejestry i ustawienia

Podpis

public Definition(String id, Map<String,Object> values)

Creates a defensive, deeply immutable copy of a definition.

Zadzwoń do przykładu

new RegistryAccess.Definition(id, values);

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

Parameters
id - nonblank stable identity
Parameters
values - JSON field values, without the identity field
Throws
NullPointerException - if id or values is null
Throws
IllegalArgumentException - if id is blank or values contain non-JSON data
definition.equals(o)MetodaIndicates whether some other object is "equal to" this one.

RegistryAccess.Definition · Rejestry i ustawienia

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

definition.equals(o);

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

RegistryAccess.Definition · Rejestry i ustawienia

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

definition.hashCode();

RegistryAccess.Definition definition is an instance of this supported API type.

Specified by
hashCode in class Record
Returns
a hash code value for this object
definition.id()MetodaReturns stable definition identity.

RegistryAccess.Definition · Rejestry i ustawienia

Podpis

public String id()

Returns stable definition identity.

Zadzwoń do przykładu

definition.id();

RegistryAccess.Definition definition is an instance of this supported API type.

Returns
stable definition identity
definition.toString()MetodaReturns a string representation of this record class.

RegistryAccess.Definition · Rejestry i ustawienia

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

definition.toString();

RegistryAccess.Definition definition is an instance of this supported API type.

Specified by
toString in class Record
Returns
a string representation of this object
definition.values()MetodaReturns deeply immutable JSON values.

RegistryAccess.Definition · Rejestry i ustawienia

Podpis

public Map<String,Object> values()

Returns deeply immutable JSON values.

Zadzwoń do przykładu

definition.values();

RegistryAccess.Definition definition is an instance of this supported API type.

Returns
deeply immutable JSON values
registries.entries(registry)MetodaEnumerates composed definitions, followed by any generated startup entries added to that registry.

RegistryAccess · Rejestry i ustawienia

Podpis

List<RegistryAccess.Definition> entries(String registry)

Enumerates composed definitions, followed by any generated startup entries added to that registry.

Zadzwoń do przykładu

registries.entries(registry);

RegistryAccess registries is supplied to mod.onRegistriesReady(registries -> { ... }); it is a detached immutable snapshot.

Parameters
registry - supported name from names()
Returns
immutable definitions; nested values are also immutable
Throws
IllegalArgumentException - if the registry is unknown
registries.find(registry, id)MetodaLooks up an exact, stable identity without scanning game objects.

RegistryAccess · Rejestry i ustawienia

Podpis

Optional<RegistryAccess.Definition> find(String registry, String id)

Looks up an exact, stable identity without scanning game objects.

Zadzwoń do przykładu

registries.find(registry, id);

RegistryAccess registries is supplied to mod.onRegistriesReady(registries -> { ... }); it is a detached immutable snapshot.

Parameters
registry - supported registry name
Parameters
id - exact base or namespaced identity; resource identity for food and equipment
Returns
definition snapshot, or empty if the exact identity is absent
Throws
IllegalArgumentException - if the registry is unknown
registries.names()MetodaLists the supported content registry names in deterministic order.

RegistryAccess · Rejestry i ustawienia

Podpis

Set<String> names()

Lists the supported content registry names in deterministic order.

Zadzwoń do przykładu

registries.names();

RegistryAccess registries is supplied to mod.onRegistriesReady(registries -> { ... }); it is a detached immutable snapshot.

Returns
immutable registry names

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