FORGOTTEN TOWNS

FORGOTTEN TOWNS / MOD DOKÜMANTASYONU

Wiki'yi değiştirme ↗

Java API referansı (Javadoc)

MOD API 15

Wiki'ye göz atın

Güncel Mod API belgeleri.

Teknik dokümantasyon İngilizce olarak mevcuttur. Kod ve alan adları mevcut Mod API'sine uygundur.

MOD DOKÜMANTASYONU

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 genel türler · 468 üyeler · Content API 15

Sıfırla

528 eşleşen girişler

context.view().citizen(id)YöntemLooks up a citizen by stable identity.

ColonyContext.View · Vatandaşlar ve evler

İmza

ColonyContext.Person citizen(int id)

Looks up a citizen by stable identity.

Örnek çağrı

context.view().citizen(id);

Obtain the read-only view from the active ColonyContext. In projection hooks, use the supplied ColonyContext.View world directly.

Parameters
id - citizen identity
Returns
snapshot, or null when absent
Throws
IllegalStateException - outside the owning callback or thread
context.view().citizens()YöntemReturns the captured roster, including any dead or deserting citizens still in the manager.

ColonyContext.View · Vatandaşlar ve evler

İmza

List<ColonyContext.Person> citizens()

Returns the captured roster, including any dead or deserting citizens still in the manager.

Örnek çağrı

context.view().citizens();

Obtain the read-only view from the active ColonyContext. In projection hooks, use the supplied ColonyContext.View world directly.

Returns
immutable captured roster in stable identity order
Throws
IllegalStateException - outside the owning callback or thread
context.inventory()YöntemReturns scoped physical storage queries and conserving transfers.

ColonyContext · Vatandaşlar ve evler

İmza

default ColonyInventory inventory()

Returns scoped physical storage queries and conserving transfers.

Örnek çağrı

context.inventory();

ColonyContext context is supplied to a ColonyExtension callback. Use it only during that callback on its owning thread.

Returns
inventory service sharing this callback's lifetime and command budget
Throws
IllegalStateException - outside the owning callback or thread
Throws
UnsupportedOperationException - if a custom context does not implement this operation
context.work()YöntemReturns scoped native work and construction services.

ColonyContext · Vatandaşlar ve evler

İmza

default ColonyWork work()

Returns scoped native work and construction services.

Örnek çağrı

context.work();

ColonyContext context is supplied to a ColonyExtension callback. Use it only during that callback on its owning thread.

Returns
work service sharing this callback's lifetime and command budget
Throws
IllegalStateException - outside the owning callback or thread
Throws
UnsupportedOperationException - if a custom context does not implement this operation
GameMod.register(ModContext)KancaRegisters immutable extensions before gameplay registries initialize.

GameMod · Kancalar ve yaşam döngüsü

İmza

void register(ModContext context)

Registers immutable extensions before gameplay registries initialize. Implementations must not initialize game registries or retain the context. The host constructs the entry point through a public no-argument constructor and invokes this method on the startup thread. Use the final-registry callback for content-dependent checks.

Bu kancayı uygula

public void register(ModContext context);

The engine calls your implementation; implement this signature in the registered hook.

Parameters
context - registrations scoped to this manifest's namespace
ColonyExtension.update(ColonyContext)KancaRebuilds derived citizen modifiers on first attachment, after load, and once per game minute.

ColonyExtension · Kancalar ve yaşam döngüsü

İmza

void update(ColonyContext context)

Rebuilds derived citizen modifiers on first attachment, after load, and once per game minute. This callback may also run after conversations, committed events, or paused content changes; keep calendar actions idempotent by saved day.

Bu kancayı uygula

public void update(ColonyContext context);

The engine calls your implementation; implement this signature in the registered hook.

Parameters
context - current bounded world queries and validated commands
ColonyAffinityTürOne directed feeling supplied by a colony extension.

ColonyAffinity · Etkinlikler ve paneller

İmza

public record ColonyAffinity(int fromCitizenId, int toCitizenId, int value) extends Record

One directed feeling supplied by a colony extension. Positive values indicate affection, negative values dislike, and zero is neutral. The roster omits neutral feelings. This is a read-only projection: the mod owns its rules and save data.

Record Components
fromCitizenId - living citizen whose feeling is described
Record Components
toCitizenId - other living citizen receiving that feeling
Record Components
value - signed affinity from -100 through 100
new ColonyAffinityOluşturucuValidates one directed feeling; both identities must be positive and distinct.

ColonyAffinity · Etkinlikler ve paneller

İmza

public ColonyAffinity(int fromCitizenId, int toCitizenId, int value)

Validates one directed feeling; both identities must be positive and distinct. This constructor does not look up citizens or require that they are currently living.

Örnek çağrı

new ColonyAffinity(fromCitizenId, toCitizenId, value);

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

Parameters
fromCitizenId - citizen whose feeling is described
Parameters
toCitizenId - recipient citizen
Parameters
value - signed affinity from -100 through 100
Throws
IllegalArgumentException - if identities or the affinity are outside their allowed range
colonyAffinity.equals(o)YöntemIndicates whether some other object is "equal to" this one.

ColonyAffinity · Etkinlikler ve paneller

İmza

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

Örnek çağrı

colonyAffinity.equals(o);

ColonyAffinity colonyAffinity 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.
colonyAffinity.fromCitizenId()YöntemReturns living citizen whose feeling is described.

ColonyAffinity · Etkinlikler ve paneller

İmza

public int fromCitizenId()

Returns living citizen whose feeling is described.

Örnek çağrı

colonyAffinity.fromCitizenId();

ColonyAffinity colonyAffinity is an instance of this supported API type.

Returns
living citizen whose feeling is described
colonyAffinity.hashCode()YöntemReturns a hash code value for this object.

ColonyAffinity · Etkinlikler ve paneller

İmza

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.

Örnek çağrı

colonyAffinity.hashCode();

ColonyAffinity colonyAffinity is an instance of this supported API type.

Specified by
hashCode in class Record
Returns
a hash code value for this object
colonyAffinity.toCitizenId()YöntemReturns other living citizen receiving that feeling.

ColonyAffinity · Etkinlikler ve paneller

İmza

public int toCitizenId()

Returns other living citizen receiving that feeling.

Örnek çağrı

colonyAffinity.toCitizenId();

ColonyAffinity colonyAffinity is an instance of this supported API type.

Returns
other living citizen receiving that feeling
colonyAffinity.toString()YöntemReturns a string representation of this record class.

ColonyAffinity · Etkinlikler ve paneller

İmza

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.

Örnek çağrı

colonyAffinity.toString();

ColonyAffinity colonyAffinity is an instance of this supported API type.

Specified by
toString in class Record
Returns
a string representation of this object
colonyAffinity.value()YöntemReturns signed affinity from -100 through 100.

ColonyAffinity · Etkinlikler ve paneller

İmza

public int value()

Returns signed affinity from -100 through 100.

Örnek çağrı

colonyAffinity.value();

ColonyAffinity colonyAffinity is an instance of this supported API type.

Returns
signed affinity from -100 through 100
ColonyContextTürColony queries and commands restricted to their owning callback and thread.

ColonyContext · Vatandaşlar ve evler

İmza

public interface ColonyContext

Colony queries and commands restricted to their owning callback and thread. Inventory, work, and notice commands share a budget of 128 attempts per callback; citizen modifier, spawning, and home-assignment commands do not use that counter. Returned snapshot values can be retained, but the context and its service/view objects expire when the callback returns.

ColonyContext.BedTürOne complete bed footprint; adjacency means two footprints share an edge.

ColonyContext.Bed · Vatandaşlar ve evler

İmza

public static record ColonyContext.Bed(long id, List<ColonyContext.Position> tiles) extends Record

One complete bed footprint; adjacency means two footprints share an edge.

Record Components
id - stable placeable identity
Record Components
tiles - immutable occupied surface positions
new ColonyContext.BedOluşturucuCopies the complete occupied bed footprint.

ColonyContext.Bed · Vatandaşlar ve evler

İmza

public Bed(long id, List<ColonyContext.Position> tiles)

Copies the complete occupied bed footprint.

Örnek çağrı

new ColonyContext.Bed(id, tiles);

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

Parameters
id - stable bed identity
Parameters
tiles - occupied positions
Throws
NullPointerException - if tiles is null or contains null
bed.adjacentTo(other)YöntemChecks cardinal adjacency of two distinct bed footprints.

ColonyContext.Bed · Vatandaşlar ve evler

İmza

public boolean adjacentTo(ColonyContext.Bed other)

Checks cardinal adjacency of two distinct bed footprints.

Örnek çağrı

bed.adjacentTo(other);

ColonyContext.Bed bed is an instance of this supported API type.

Parameters
other - another bed, or null
Returns
whether distinct bed identities share a cardinal edge on one level; false for null
bed.equals(o)YöntemIndicates whether some other object is "equal to" this one.

ColonyContext.Bed · Vatandaşlar ve evler

İmza

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

Örnek çağrı

bed.equals(o);

ColonyContext.Bed bed 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.
bed.hashCode()YöntemReturns a hash code value for this object.

ColonyContext.Bed · Vatandaşlar ve evler

İmza

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.

Örnek çağrı

bed.hashCode();

ColonyContext.Bed bed is an instance of this supported API type.

Specified by
hashCode in class Record
Returns
a hash code value for this object
bed.id()YöntemReturns stable placeable identity.

ColonyContext.Bed · Vatandaşlar ve evler

İmza

public long id()

Returns stable placeable identity.

Örnek çağrı

bed.id();

ColonyContext.Bed bed is an instance of this supported API type.

Returns
stable placeable identity
bed.tiles()YöntemReturns immutable occupied surface positions.

ColonyContext.Bed · Vatandaşlar ve evler

İmza

public List<ColonyContext.Position> tiles()

Returns immutable occupied surface positions.

Örnek çağrı

bed.tiles();

ColonyContext.Bed bed is an instance of this supported API type.

Returns
immutable occupied surface positions
bed.toString()YöntemReturns a string representation of this record class.

ColonyContext.Bed · Vatandaşlar ve evler

İmza

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.

Örnek çağrı

bed.toString();

ColonyContext.Bed bed is an instance of this supported API type.

Specified by
toString in class Record
Returns
a string representation of this object
ColonyContext.HomeTürA residence, barracks, guard house or other supported home.

ColonyContext.Home · Vatandaşlar ve evler

İmza

public static record ColonyContext.Home(long id, String kind, int area, List<Integer> residents, List<ColonyContext.Bed> beds, Map<Integer,Long> bedAssignments) extends Record

A residence, barracks, guard house or other supported home.

Record Components
id - stable zone identity
Record Components
kind - zone definition ID
Record Components
area - usable room floor tiles, including tiles occupied by furniture
Record Components
residents - immutable living, non-deserting resident identities
Record Components
beds - immutable complete beds assigned to this zone
Record Components
bedAssignments - exclusive bed identity per resident; absent when no individual bed is available
new ColonyContext.HomeOluşturucuCopies home metadata.

ColonyContext.Home · Vatandaşlar ve evler

İmza

public Home(long id, String kind, int area, List<Integer> residents, List<ColonyContext.Bed> beds, Map<Integer,Long> bedAssignments)

Copies home metadata.

Örnek çağrı

new ColonyContext.Home(id, kind, area, residents, beds, bedAssignments);

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

Parameters
id - zone identity
Parameters
kind - definition ID
Parameters
area - floor area
Parameters
residents - resident IDs
Parameters
beds - bed snapshots
Parameters
bedAssignments - exclusive resident bed assignments
Throws
NullPointerException - if a list, map or element 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