FORGOTTEN TOWNS

FORGOTTEN TOWNS / МОДИНГОВАЯ ДОКУМЕНТАЦИЯ

Моддинг вики ↗

Java Ссылка на API (Javadoc)

MOD API 15

Просмотрите вики

Текущая документация API модов.

Техническая документация доступна на английском языке. Имена кода и полей соответствуют текущему Mod API.

МОДИНГОВАЯ ДОКУМЕНТАЦИЯ

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 общедоступные типы · 468 члены · Content API 15

Сброс

528 соответствующие записи

SettlementTrading.accepts(String, Set<String>)КрюкDecides whether a town buys a resource from its recurring export identities.

SettlementTrading · Торговля и карта

Подпись

default boolean accepts(String resourceId, Set<String> productionExports)

Decides whether a town buys a resource from its recurring export identities. The default rejects products that the receiving town itself exports; reserved inventory does not change that decision.

Реализуйте этот крючок

public boolean accepts(String resourceId, Set<String> productionExports);

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

Parameters
resourceId - offered resource
Parameters
productionExports - the receiving town's recurring export resource IDs
Returns
true when the town will buy this resource
Throws
NullPointerException - if productionExports is null, or if it rejects a null resourceId
SettlementTrading.configurableExports(SettlementTrading.World)КрюкDetermines whether players can choose recurring exports rather than using authored goods.

SettlementTrading · Торговля и карта

Подпись

default boolean configurableExports(SettlementTrading.World world)

Determines whether players can choose recurring exports rather than using authored goods.

Реализуйте этот крючок

public boolean configurableExports(SettlementTrading.World world);

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

Parameters
world - current settlement context with completion-stage details omitted
Returns
true for configurable exports
SettlementTrading.estimate(SettlementTrading.World, SettlementTrading.Production)КрюкDetermines export units from completed packing output in a rolling season-length window, including today.

SettlementTrading · Торговля и карта

Подпись

Map<String,Integer> estimate(SettlementTrading.World world, SettlementTrading.Production production)

Determines export units from completed packing output in a rolling season-length window, including today. Called both for the actual selection and for previews with one additional selected product. The host validates the returned table, converts loose goods to enabled market packing units, and caps each resulting allowance at recorded packing output for that selected good.

Реализуйте этот крючок

public Map<String,Integer> estimate(SettlementTrading.World world, SettlementTrading.Production production);

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

Parameters
world - current settlement and campaign context; completion stages are omitted for previews
Parameters
production - completed packing records, selected goods, and stored tradable quantities
Returns
nonnull map of at most 4096 registered resource IDs to nonnull quantities in 0..100000; invalid quantities are rejected rather than clamped
SettlementTrading.includesSavedTowns(SettlementTrading.World)КрюкChooses which other saved towns belong to this network.

SettlementTrading · Торговля и карта

Подпись

boolean includesSavedTowns(SettlementTrading.World world)

Chooses which other saved towns belong to this network.

Реализуйте этот крючок

public boolean includesSavedTowns(SettlementTrading.World world);

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

Parameters
world - current world; completion-stage details are omitted for this visibility query
Returns
true to include sandbox saved towns; false for authored markets only
SettlementTrading.markets(SettlementTrading.World)КрюкSupplies authored markets, for example completed campaign settlements.

SettlementTrading · Торговля и карта

Подпись

default List<SettlementTrading.Market> markets(SettlementTrading.World world)

Supplies authored markets, for example completed campaign settlements.

Реализуйте этот крючок

public List<SettlementTrading.Market> markets(SettlementTrading.World world);

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

Parameters
world - current profile, stage and completion context
Returns
nonnull list of nonnull markets to make available; absent authored markets are hidden
SettlementTrading.maximumExports()КрюкLimits the current town's distinct recurring export products.

SettlementTrading · Торговля и карта

Подпись

default int maximumExports()

Limits the current town's distinct recurring export products.

Реализуйте этот крючок

public int maximumExports();

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

Returns
inclusive product cap, clamped by the host to 1..64
SettlementTrading.price(String, int, boolean)КрюкPrices a good using the resource registry's ordinary value.

SettlementTrading · Торговля и карта

Подпись

default int price(String resourceId, int baseValue, boolean buying)

Prices a good using the resource registry's ordinary value.

Реализуйте этот крючок

public int price(String resourceId, int baseValue, boolean buying);

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

Parameters
resourceId - resource being traded
Parameters
baseValue - authored resource value
Parameters
buying - whether the current player is buying
Returns
unit price, clamped by the host to 0..100000; a resulting zero prohibits the trade
SettlementTrading.productionRules()КрюкRetains legacy production-policy data for compatibility with existing mod cores.

SettlementTrading · Торговля и карта

Подпись

default TradeProductionRules productionRules()

Retains legacy production-policy data for compatibility with existing mod cores. Recorded crate production does not use capacity or renewable-input assumptions.

Реализуйте этот крючок

public TradeProductionRules productionRules();

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

Returns
legacy immutable rules, or null
SettlementTrading.recordedExports(production, maximum)МетодConverts selected completed packing records into a bounded recurring export allowance.

SettlementTrading · Торговля и карта

Подпись

static Map<String,Integer> recordedExports(SettlementTrading.Production production, int maximum)

Converts selected completed packing records into a bounded recurring export allowance. Farm growth, worker counts and theoretical workstation capacity are not saleable output.

Пример звонка

SettlementTrading.recordedExports(production, maximum);

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

Parameters
production - completed crate-production snapshot
Parameters
maximum - maximum crates of one product per season, clamped to 0..100000
Returns
immutable selected crate quantities after flooring and clamping counts, retaining zero-production identities; map iteration order is unspecified
Throws
NullPointerException - if production is null
SettlementTrading.seasonalGold(int)КрюкDetermines a saved or authored town's seasonal income using a stable host random draw.

SettlementTrading · Торговля и карта

Подпись

int seasonalGold(int roll)

Determines a saved or authored town's seasonal income using a stable host random draw.

Реализуйте этот крючок

public int seasonalGold(int roll);

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

Parameters
roll - deterministic uniform integer within 0..1,000,000 inclusive
Returns
gold grant, clamped by the host to 0..100000 and remaining integer purse capacity
SettlementTrading.supports(SettlementTrading.World)КрюкSelects the worlds in which this network is available.

SettlementTrading · Торговля и карта

Подпись

boolean supports(SettlementTrading.World world)

Selects the worlds in which this network is available.

Реализуйте этот крючок

public boolean supports(SettlementTrading.World world);

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

Parameters
world - immutable town and campaign context
Returns
true to activate this network; the last applicable registration wins
SettlementTrading.travelDays(String)КрюкDetermines shipment duration from the other settlement's biome.

SettlementTrading · Торговля и карта

Подпись

int travelDays(String biome)

Determines shipment duration from the other settlement's biome.

Реализуйте этот крючок

public int travelDays(String biome);

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

Parameters
biome - uppercase engine biome identifier
Returns
travel time in whole days, clamped by the host to 1..48
TradeEconomyТипShared authored economy reader used by independent trade and map policies, without engine imports.

TradeEconomy · Торговля и карта

Подпись

public final class TradeEconomy extends Object

Shared authored economy reader used by independent trade and map policies, without engine imports.

new TradeEconomyКонструкторLegacy convenience reader retained for existing compiled packs.

TradeEconomy · Торговля и карта

Подпись

public TradeEconomy(ModSettings settings)

Legacy convenience reader retained for existing compiled packs. New packs should own their setting names and defaults and pass explicit values instead.

Пример звонка

new TradeEconomy(settings);

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

Parameters
settings - typed captured settings reader
Throws
IllegalArgumentException - if an economy value is malformed or out of range
Throws
NullPointerException - if settings is null
new TradeEconomyКонструкторCreates an economy from pack-owned configuration.

TradeEconomy · Торговля и карта

Подпись

public TradeEconomy(TravelRules travel, int minimumGold, int maximumGold, int maximumExports, int maximumEstimate, double utilization, double buyMultiplier, double sellMultiplier)

Creates an economy from pack-owned configuration.

Пример звонка

new TradeEconomy(travel, minimumGold, maximumGold, maximumExports, maximumEstimate, utilization, buyMultiplier, sellMultiplier);

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

Parameters
travel - authored journey durations
Parameters
minimumGold - inclusive seasonal income minimum within 0..100000
Parameters
maximumGold - inclusive seasonal income maximum within minimumGold..100000
Parameters
maximumExports - distinct export limit within 1..64
Parameters
maximumEstimate - per-product seasonal estimate ceiling within 1..100000
Parameters
utilization - workstation utilization within 0..1
Parameters
buyMultiplier - multiplier for purchases within 0..100
Parameters
sellMultiplier - multiplier for sales within 0..100
Throws
IllegalArgumentException - if bounds are invalid or a multiplier is not finite
Throws
NullPointerException - if travel is null
tradeEconomy.maximumEstimate()МетодReturns the estimate ceiling per product.

TradeEconomy · Торговля и карта

Подпись

public int maximumEstimate()

Returns the estimate ceiling per product.

Пример звонка

tradeEconomy.maximumEstimate();

TradeEconomy tradeEconomy is an instance of this supported API type.

Returns
positive units per season
tradeEconomy.maximumExports()МетодReturns the authored product cap.

TradeEconomy · Торговля и карта

Подпись

public int maximumExports()

Returns the authored product cap.

Пример звонка

tradeEconomy.maximumExports();

TradeEconomy tradeEconomy is an instance of this supported API type.

Returns
maximum distinct exports
tradeEconomy.price(baseValue, buying)МетодApplies authored buy or sell pricing to a resource's registry value.

TradeEconomy · Торговля и карта

Подпись

public int price(int baseValue, boolean buying)

Applies authored buy or sell pricing to a resource's registry value.

Пример звонка

tradeEconomy.price(baseValue, buying);

TradeEconomy tradeEconomy is an instance of this supported API type.

Parameters
baseValue - native resource value; negative values are treated as zero
Parameters
buying - true to apply buyMultiplier, false to apply sellMultiplier
Returns
price rounded to the nearest whole unit and clamped to 0..100000; zero disables the transaction
tradeEconomy.seasonalGold(roll)МетодConverts the host's uniform draw into an inclusive authored gold range.

TradeEconomy · Торговля и карта

Подпись

public int seasonalGold(int roll)

Converts the host's uniform draw into an inclusive authored gold range.

Пример звонка

tradeEconomy.seasonalGold(roll);

TradeEconomy tradeEconomy is an instance of this supported API type.

Parameters
roll - integer within 0..1000000
Returns
seasonal gold grant
Throws
IllegalArgumentException - if the random input is outside the documented range
tradeEconomy.travelDays(biome)МетодResolves an authored biome journey.

TradeEconomy · Торговля и карта

Подпись

public int travelDays(String biome)

Resolves an authored biome journey.

Пример звонка

tradeEconomy.travelDays(biome);

TradeEconomy tradeEconomy is an instance of this supported API type.

Parameters
biome - nonnull exact biome identity
Returns
days within 1..48
Throws
NullPointerException - if biome is null
tradeEconomy.utilization()МетодReturns the retained legacy workstation-utilization coefficient.

TradeEconomy · Торговля и карта

Подпись

public double utilization()

Returns the retained legacy workstation-utilization coefficient. Recorded packing output does not derive saleable goods from this theoretical capacity value.

Пример звонка

tradeEconomy.utilization();

TradeEconomy tradeEconomy is an instance of this supported API type.

Returns
utilization within 0..1
TradeProductionRulesТипLegacy production assumptions retained for compiled mod-core compatibility.

TradeProductionRules · Торговля и карта

Подпись

public record TradeProductionRules(boolean woodcutting, boolean gathering, boolean digging, List<TradeProductionRules.CollectionInput> collections) extends Record

Legacy production assumptions retained for compiled mod-core compatibility. Settlement supply now uses completed packing records and ignores these assumptions.

Record Components
woodcutting - whether present woodcuttable features supply their basic drops freely
Record Components
gathering - whether present gatherable features supply their basic drops freely
Record Components
digging - whether biome digging drops are free inputs
Record Components
collections - ordered infrastructure rules granting free collection inputs
TradeProductionRules.CollectionInputТипInfrastructure that supplies a basic collection input without simulating fuel or containers.

TradeProductionRules.CollectionInput · Торговля и карта

Подпись

public static record TradeProductionRules.CollectionInput(String resource, Set<String> stations, Set<String> anyInput) extends Record

Infrastructure that supplies a basic collection input without simulating fuel or containers.

Record Components
resource - output resource identity
Record Components
stations - all required placeable definition identities
Record Components
anyInput - at least one of these must already be free; empty means no prerequisite
new TradeProductionRules.CollectionInputКонструкторDetaches and validates reference syntax.

TradeProductionRules.CollectionInput · Торговля и карта

Подпись

public CollectionInput(String resource, Set<String> stations, Set<String> anyInput)

Detaches and validates reference syntax.

Пример звонка

new TradeProductionRules.CollectionInput(resource, stations, anyInput);

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

Parameters
resource - output resource identity
Parameters
stations - required infrastructure
Parameters
anyInput - alternative already-free input resources
Throws
IllegalArgumentException - if identifiers are malformed or no station is required
Throws
NullPointerException - if any input is null
collectionInput.anyInput()МетодReturns at least one of these must already be free; empty means no prerequisite.

TradeProductionRules.CollectionInput · Торговля и карта

Подпись

public Set<String> anyInput()

Returns at least one of these must already be free; empty means no prerequisite.

Пример звонка

collectionInput.anyInput();

TradeProductionRules.CollectionInput collectionInput is an instance of this supported API type.

Returns
at least one of these must already be free; empty means no prerequisite

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