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
528 eşleşen girişler
keyboardShortcut.toString()YöntemReturns a string representation of this record class.
KeyboardShortcut · 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ı
keyboardShortcut.toString();KeyboardShortcut keyboardShortcut is an instance of this supported API type.
- Specified by
- toString in class Record
- Returns
- a string representation of this object
ModContextTürStartup registration surface scoped to one manifest and the startup thread.
ModContext · Kancalar ve yaşam döngüsü
İmza
public interface ModContextStartup registration surface scoped to one manifest and the startup thread. Registrations close when GameMod.register(forgottentowns.mod.api.ModContext) returns. Captured settings/tables and published rule values may be retained; the registration context must not be retained or used asynchronously.
mod.dataTable(id)YöntemReads a manifest-listed, deeply immutable JSON table.
ModContext · Kancalar ve yaşam döngüsü
İmza
Object dataTable(String id)Reads a manifest-listed, deeply immutable JSON table.
Örnek çağrı
mod.dataTable(id);ModContext mod is supplied to GameMod.register. Registration closes when that callback returns.
- Parameters
- id - nonnull table identifier declared in the manifest's tables object
- Returns
- JSON object, list, scalar or null captured with this mod's gameplay hash
- Throws
- IllegalArgumentException - if the table is absent or the manifest does not support this operation
- Throws
- IllegalStateException - if startup registration has closed
mod.onRegistriesReady(callback)YöntemRegisters this mod's one startup callback for the final validated definition catalog.
ModContext · Kancalar ve yaşam döngüsü
İmza
void onRegistriesReady(Consumer<RegistryAccess> callback)Registers this mod's one startup callback for the final validated definition catalog. It runs once on the startup thread after all registrations and runtime content validation, before a world/window is created, including during headless validation. The immutable snapshot may be retained. Exceptions fail startup and identify the responsible mod. This callback cannot register further hooks or mutate the catalog.
Örnek çağrı
mod.onRegistriesReady(callback);ModContext mod is supplied to GameMod.register. Registration closes when that callback returns.
- Parameters
- callback - consumer of frozen definitions, including host-generated trade goods and packing recipes
- Throws
- IllegalArgumentException - if callback is null, already registered, or the manifest does not support this callback
- Throws
- IllegalStateException - if registration has closed
mod.registerColonyExtension(factory)YöntemRegisters one factory for independent, persistent per-world simulation instances.
ModContext · Kancalar ve yaşam döngüsü
İmza
void registerColonyExtension(Supplier<ColonyExtension> factory)Registers one factory for independent, persistent per-world simulation instances. Startup validation also creates disposable instances and exercises empty restore, save, and saved-state restore. Those callbacks must not depend on an active world or external side effects.
Örnek çağrı
mod.registerColonyExtension(factory);ModContext mod is supplied to GameMod.register. Registration closes when that callback returns.
- Parameters
- factory - factory returning a fresh nonnull extension for each request
- Throws
- IllegalArgumentException - if duplicated, null, or unsupported by the manifest
- Throws
- IllegalStateException - if registration has closed
mod.registerEquipmentTransform(id, transform)YöntemRegisters a pure equipment conversion invoked after reserved inputs are consumed.
ModContext · Kancalar ve yaşam döngüsü
İmza
void registerEquipmentTransform(String id, EquipmentTransform transform)Registers a pure equipment conversion invoked after reserved inputs are consumed.
Örnek çağrı
mod.registerEquipmentTransform(id, transform);ModContext mod is supplied to GameMod.register. Registration closes when that callback returns.
- Parameters
- id - namespaced handler identifier belonging to this mod
- Parameters
- transform - deterministic conversion, using only the supplied random source
- Throws
- IllegalArgumentException - if the identifier or implementation is invalid or duplicated
- Throws
- IllegalStateException - if registration has closed
mod.registerHousingPolicy(policy)YöntemAdds a startup-only housing expansion policy, shared by manual and automatic assignment.
ModContext · Kancalar ve yaşam döngüsü
İmza
void registerHousingPolicy(HousingPolicy policy)Adds a startup-only housing expansion policy, shared by manual and automatic assignment.
Örnek çağrı
mod.registerHousingPolicy(policy);ModContext mod is supplied to GameMod.register. Registration closes when that callback returns.
- Parameters
- policy - bed-limited expansion policy for residential, barracks, guard_post, or tavern zones
- Throws
- IllegalArgumentException - if policy is null, contains unsupported home zones, or the manifest does not support this operation
- Throws
- IllegalStateException - if registration has closed
mod.registerKeyboardShortcut(shortcut)YöntemRegisters a mod-owned, remappable keyboard command.
ModContext · Kancalar ve yaşam döngüsü
İmza
default void registerKeyboardShortcut(KeyboardShortcut shortcut)Registers a mod-owned, remappable keyboard command. Defaults and legacy preference aliases belong to the pack; the host supplies the editor and dispatch.
Örnek çağrı
mod.registerKeyboardShortcut(shortcut);ModContext mod is supplied to GameMod.register. Registration closes when that callback returns.
- Parameters
- shortcut - owned command definition with a localized label
- Throws
- IllegalArgumentException - if null, duplicated, not owned, or unsupported by the manifest
- Throws
- IllegalStateException - after startup registration closes
- Throws
- UnsupportedOperationException - if the host predates shortcut registration
mod.registerManualTradeReservations(enabled)YöntemSelects whether the shared Stock panel offers manual trade reservations.
ModContext · Kancalar ve yaşam döngüsü
İmza
default void registerManualTradeReservations(boolean enabled)Selects whether the shared Stock panel offers manual trade reservations. Any provider can opt out; native Settlement Trading opts out by default, and a mod cannot override that decision by registering true. When disabled, existing reserved cargo returns to its owning settlement through durable delivery receipts; ordinary stock remains available for direct selling and crafting.
Örnek çağrı
mod.registerManualTradeReservations(enabled);ModContext mod is supplied to GameMod.register. Registration closes when that callback returns.
- Parameters
- enabled - whether this mod permits manual reservations
- Throws
- IllegalArgumentException - if duplicated or the manifest predates API 15
- Throws
- IllegalStateException - after startup registration closes
- Throws
- UnsupportedOperationException - if the host predates reservation policies
mod.registerParticleShape(id, shape)YöntemRegisters a convex particle polygon without exposing graphics state to the mod.
ModContext · Kancalar ve yaşam döngüsü
İmza
void registerParticleShape(String id, ParticleShape shape)Registers a convex particle polygon without exposing graphics state to the mod.
Örnek çağrı
mod.registerParticleShape(id, shape);ModContext mod is supplied to GameMod.register. Registration closes when that callback returns.
- Parameters
- id - namespaced shape identifier belonging to this mod
- Parameters
- shape - normalized, immutable polygon
- Throws
- IllegalArgumentException - if the identifier or shape is invalid or duplicated
- Throws
- IllegalStateException - if registration has closed
mod.registerSettlementMap(rules)YöntemRegisters one location-map policy and its paid arrival offers.
ModContext · Kancalar ve yaşam döngüsü
İmza
void registerSettlementMap(SettlementMap rules)Registers one location-map policy and its paid arrival offers.
Örnek çağrı
mod.registerSettlementMap(rules);ModContext mod is supplied to GameMod.register. Registration closes when that callback returns.
- Parameters
- rules - pure location and recruitment policy
- Throws
- IllegalArgumentException - for a null or duplicate policy or an unsupported manifest declaration
- Throws
- IllegalStateException - after startup registration closes
mod.registerSettlementTradeCore(core)YöntemPublishes this mod's shared trading configuration for declared dependents.
ModContext · Kancalar ve yaşam döngüsü
İmza
default void registerSettlementTradeCore(SettlementTradeCore core)Publishes this mod's shared trading configuration for declared dependents. The provider must validate its production rules through onRegistriesReady(java.util.function.Consumer<forgottentowns.mod.api.RegistryAccess>).
Örnek çağrı
mod.registerSettlementTradeCore(core);ModContext mod is supplied to GameMod.register. Registration closes when that callback returns.
- Parameters
- core - immutable rule sets, also usable by the provider's own policy
- Throws
- IllegalArgumentException - if null, duplicated or unsupported by the manifest
- Throws
- IllegalStateException - after startup registration closes
- Throws
- UnsupportedOperationException - if this host does not support trading cores
mod.registerSettlementTrading(rules)YöntemRegisters one settlement trading policy for this mod, including shared UI panels.
ModContext · Kancalar ve yaşam döngüsü
İmza
void registerSettlementTrading(SettlementTrading rules)Registers one settlement trading policy for this mod, including shared UI panels.
Örnek çağrı
mod.registerSettlementTrading(rules);ModContext mod is supplied to GameMod.register. Registration closes when that callback returns.
- Parameters
- rules - pure policy controlling availability and economic rules
- Throws
- IllegalArgumentException - if null, duplicated, or unsupported by the manifest
- Throws
- IllegalStateException - if startup registration has closed
mod.registerTradeFilter(filter)YöntemRegisters a resource filter applied to merchant and settlement commerce in both directions.
ModContext · Kancalar ve yaşam döngüsü
İmza
default void registerTradeFilter(Predicate<String> filter)Registers a resource filter applied to merchant and settlement commerce in both directions. All registered filters must accept a resource, including the native packed-goods policy. Adding a trade-goods definition participates in that native policy automatically. Capture final registry identities through onRegistriesReady(java.util.function.Consumer<forgottentowns.mod.api.RegistryAccess>).
Örnek çağrı
mod.registerTradeFilter(filter);ModContext mod is supplied to GameMod.register. Registration closes when that callback returns.
- Parameters
- filter - predicate receiving a stable resource ID
- Throws
- IllegalArgumentException - if null, duplicated, or the manifest predates API 15
- Throws
- IllegalStateException - after startup registration closes
- Throws
- UnsupportedOperationException - if the host predates resource trade filters
mod.registerWorldInspection(inspection)YöntemEnables dedicated viewport inspectors for this mod.
ModContext · Kancalar ve yaşam döngüsü
İmza
default void registerWorldInspection(WorldInspection inspection)Enables dedicated viewport inspectors for this mod.
Örnek çağrı
mod.registerWorldInspection(inspection);ModContext mod is supplied to GameMod.register. Registration closes when that callback returns.
- Parameters
- inspection - supported inspection targets
- Throws
- IllegalArgumentException - if null, duplicated, or unsupported by the manifest
- Throws
- IllegalStateException - after startup registration closes
- Throws
- UnsupportedOperationException - if the host predates inspection support
mod.requireSettlementTradeCore(modId)YöntemResolves a core already published by a directly declared dependency.
ModContext · Kancalar ve yaşam döngüsü
İmza
default SettlementTradeCore requireSettlementTradeCore(String modId)Resolves a core already published by a directly declared dependency. Dependency order guarantees the provider registers first. No fallback rules are substituted when an older installed dependency lacks the required core. The native game supplies settlement_trading before optional mods register; a direct dependency on that ID requires no installed copy of the historical pack.
Örnek çağrı
mod.requireSettlementTradeCore(modId);ModContext mod is supplied to GameMod.register. Registration closes when that callback returns.
- Parameters
- modId - provider ID declared in this mod's manifest dependencies
- Returns
- the exact immutable core published by the provider
- Throws
- IllegalArgumentException - if the provider ID is null, the dependency is undeclared, absent or provides no core, or the manifest does not support this registration
- Throws
- IllegalStateException - after startup registration closes
- Throws
- UnsupportedOperationException - if this host does not support trading cores
mod.settings()YöntemReads this pack's immutable manifest-listed configuration.
ModContext · Kancalar ve yaşam döngüsü
İmza
Map<String,Object> settings()Reads this pack's immutable manifest-listed configuration.
Örnek çağrı
mod.settings();ModContext mod is supplied to GameMod.register. Registration closes when that callback returns.
- Returns
- JSON settings copied from the captured pack, or an empty map
- Throws
- IllegalArgumentException - if the manifest does not support this operation
- Throws
- IllegalStateException - if registration has closed
ModSettingsTürStartup-only typed reader that tracks which captured settings a mod attempts to consume.
ModSettings · Kayıtlar ve ayarlar
İmza
public final class ModSettings extends ObjectStartup-only typed reader that tracks which captured settings a mod attempts to consume. Each read removes its key from the unread set before validation, including a read that throws. Call requireAllRead() after successful registration reads to reject unknown supplied keys. This reader is mutable and is intended for one registration thread; values are copied shallowly.
new ModSettingsOluşturucuCopies settings for one registration.
ModSettings · Kayıtlar ve ayarlar
İmza
public ModSettings(Map<String,Object> values)Copies settings for one registration.
Örnek çağrı
new ModSettings(values);Use the public API type shown; import forgottentowns.mod.api.*.
- Parameters
- values - settings obtained from the mod context; subsequent map mutations are not observed
- Throws
- NullPointerException - if values, any key, or any value is null
settings.decimal(key, fallback, min, max)YöntemReads a finite numeric value, converting a Number through its doubleValue method.
ModSettings · Kayıtlar ve ayarlar
İmza
public double decimal(String key, double fallback, double min, double max)Reads a finite numeric value, converting a Number through its doubleValue method.
Örnek çağrı
settings.decimal(key, fallback, min, max);ModSettings settings = new ModSettings(mod.settings()); read typed values during registration, then call settings.requireAllRead().
- Parameters
- key - nonnull setting identity, consumed even when validation fails
- Parameters
- fallback - value when absent, validated against the same bounds
- Parameters
- min - inclusive minimum; callers must supply an ordered, non-NaN range
- Parameters
- max - inclusive maximum; callers must supply an ordered, non-NaN range
- Returns
- validated number
- Throws
- IllegalArgumentException - if not a finite number in range
- Throws
- NullPointerException - if key is null
settings.flag(key, fallback)YöntemReads a boolean.
ModSettings · Kayıtlar ve ayarlar
İmza
public boolean flag(String key, boolean fallback)Reads a boolean.
Örnek çağrı
settings.flag(key, fallback);ModSettings settings = new ModSettings(mod.settings()); read typed values during registration, then call settings.requireAllRead().
- Parameters
- key - nonnull setting identity, consumed even when validation fails
- Parameters
- fallback - value when absent
- Returns
- validated flag
- Throws
- IllegalArgumentException - if the value is not boolean
- Throws
- NullPointerException - if key is null
settings.ids(key, fallback)YöntemReads a nonempty comma-separated set of lowercase content identifiers without trimming entries.
ModSettings · Kayıtlar ve ayarlar
İmza
public Set<String> ids(String key, String fallback)Reads a nonempty comma-separated set of lowercase content identifiers without trimming entries. Every identifier must match [a-z][a-z0-9_:]*; the complete text also satisfies text(java.lang.String, java.lang.String).
Örnek çağrı
settings.ids(key, fallback);ModSettings settings = new ModSettings(mod.settings()); read typed values during registration, then call settings.requireAllRead().
- Parameters
- key - nonnull setting identity, consumed even when validation fails
- Parameters
- fallback - comma-separated defaults, validated like a supplied value
- Returns
- immutable identifier set whose iteration order is unspecified
- Throws
- IllegalArgumentException - if text validation fails or an identifier is empty, duplicated, contains whitespace, or does not match the identifier pattern
- Throws
- NullPointerException - if key is null
settings.integer(key, fallback, min, max)YöntemReads a bounded integer.
ModSettings · Kayıtlar ve ayarlar
İmza
public int integer(String key, int fallback, int min, int max)Reads a bounded integer.
Örnek çağrı
settings.integer(key, fallback, min, max);ModSettings settings = new ModSettings(mod.settings()); read typed values during registration, then call settings.requireAllRead().
- Parameters
- key - nonnull setting identity, consumed even when validation fails
- Parameters
- fallback - value when absent, validated against the same bounds
- Parameters
- min - inclusive minimum
- Parameters
- max - inclusive maximum
- Returns
- validated integer
- Throws
- IllegalArgumentException - if the value is not numeric, is fractional or nonfinite, or lies outside the bounds
- Throws
- NullPointerException - if key is null
settings.requireAllRead()YöntemRejects unconsumed keys so spelling mistakes cannot silently keep a default.
ModSettings · Kayıtlar ve ayarlar
İmza
public void requireAllRead()Rejects unconsumed keys so spelling mistakes cannot silently keep a default.
Örnek çağrı
settings.requireAllRead();ModSettings settings = new ModSettings(mod.settings()); read typed values during registration, then call settings.requireAllRead().
- Throws
- IllegalArgumentException - if any supplied setting was not read
settings.text(key, fallback)YöntemReads a nonblank identifier or other short configuration string.
ModSettings · Kayıtlar ve ayarlar
İmza
public String text(String key, String fallback)Reads a nonblank identifier or other short configuration string.
Örnek çağrı
settings.text(key, fallback);ModSettings settings = new ModSettings(mod.settings()); read typed values during registration, then call settings.requireAllRead().
- Parameters
- key - nonnull setting identity, consumed even when validation fails
- Parameters
- fallback - value when absent, subject to the same validation as a supplied setting
- Returns
- the accepted string unchanged, nonblank, at most 256 characters, and already equal to its String.trim() result; this method does not trim input
- Throws
- IllegalArgumentException - if the value or fallback is blank, too long, not text, or has leading/trailing characters that String.trim() would remove
- Throws
- NullPointerException - if key 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
