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

Settlement Trading

Historical source example: this feature now ships in the base game. Do not install this original pack on the integrated game. Its instructions below describe the preserved mod design. See the source study and the Bread Crates extension for current authoring.

Shared trading core and sandbox trading mod for the Mod API, version 1.5.0. No other mod is required. Its Java source imports only the public API. The host supplies production queries, UI, finite escrow and save receipts; this pack selects and caps recorded crate production, the 15-product cap, biome travel and seasonal income.

It publishes a SettlementTradeCore through registerSettlementTradeCore. Both Campaign and Campaign Map require this pack and resolve its actual immutable economy rules during registration. Campaign also shares its production rules. Configure common values in this pack's settings.json and data/production.json; the extensions no longer ship duplicate settings. The loader always places required dependencies before their consumers, even when selected in reverse order. The Kingdom retains its explicitly authored five-day journey and 30% purchase valuation.

Owned packing content

Content API 15 supplies reusable crafting-category, packing-profile, packed-resource, storage-group and cargo-display registries. This parent pack declares its complete content in data/packing.json and owns its four PNGs in pack/assets. Disabling it removes its 63 packed goods, 126 recipes, category, packing table and pallet from the active registry. The explicit legacyIds migration preserves their earlier save identities.

The parent registers a public trade filter populated from the final tradeGoods catalog. Only registered packed goods pass; loose resources, individual tools, books, equipment, necklaces and essences cannot be bought or sold. A dependent mod can register additional packed goods through the same API. Packing is part of this parent, not an eighth player mod.

Trade goods opens on Pack. Switch to Unpack to see owned crates, including delivered cargo waiting at the banner. Unpacking uses the packing table and returns the exact contents and an empty crate while retaining freshness. Outstanding unpacking orders remain visible so players can cancel them after the last crate is used.

The parent opts out of manual reservations through registerManualTradeReservations(false). Crates remain in ordinary storage until sold or unpacked. Old reserved cargo returns to its town's banner through durable receipts, including when an earlier save is restored.

Build

With JDK 21, from the SDK root:

.\examples\mod-sdk\build-mod.ps1 -Project .\examples\settlement-trading-mod -ApiJar .\build\mod-sdk\forgotten-towns-mod-api-15.jar -OutputDirectory .\settlement-trading-build

Install only the resulting settlement_trading folder, then enable it in Mods. In a source checkout, gradlew settlement_tradingModZip produces build/mods/settlement_trading-1.5.0.zip.

Click the banner to name a town and choose exports. Save it, then trade with it from another sandbox town. Direct sales use stored crates. Recurring supply uses crates actually packed during the last 12 days. The old farm-growth, renewable-input and workstation-utilization calculation is retired. Its production table remains readable for old extension compatibility; it cannot create export supply. Prices, travel, seasonal gold and maximum crate output remain shared core settings.

The settlement guide explains the economy, API and save recovery.

Customization

The pack includes a cover and about/ui.json for presentation overrides. See UI and gameplay customization for the complete theme slots, settings files, typed hooks and engine limits. Keep a copy of an older pack before updating. New versions are validated against the API, content and saved state.

Player controls: open Mods → Settings. Shared economy controls belong to Settlement Trading; the extensions provide a link to that form. Choose Apply & reload after changes. Player preferences are stored separately from pack defaults. The about/ folder includes extended descriptions and two screenshots.