FORGOTTEN TOWNS

FORGOTTEN TOWNS / MODDING-DOKUMENTATION

Modding-Wiki ↗

Java API-Referenz (Javadoc)

MOD API 15

Durchsuchen Sie das Wiki

Aktuelle Mod-API-Dokumentation.

Die technische Dokumentation ist in englischer Sprache verfügbar. Code- und Feldnamen folgen der aktuellen Mod-API.

MODDING-DOKUMENTATION

Colony Planner

A standalone Java example with no mod dependencies. It demonstrates physical storage queries/transfers, native labor designation, placeable construction and saved terminal outcomes, plus native information/action panels for crafting, zone planning and furniture hauling. All Java imports are JDK or forgottentowns.mod.api; all player-facing metadata has 13 translations.

Build

From the repository:

.\gradlew.bat --no-daemon assembleColonyPlannerMod

Or from the SDK:

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

The repository task creates build/mods/colony_planner. Copy that folder to the game's mods folder, then select Apply & reload. The example ships with enabled: false so installing it does not designate terrain at placeholder coordinates.

Configure the example

Edit the copied pack's settings.json before validating/restarting:

  • Set enabled to true and choose action (GATHERING, MINING, DIGGING, WOODCUTTING, or HARVESTING) plus workX, workY, workZ for an explored, eligible target.
  • Optionally set placeableId (default none), buildX, buildY, buildZ and logical facing. The normal construction rules must permit it; the mod cannot grant missing materials or unlocks.
  • Optionally set transferAmount from 1 to 4096, resourceId, and two exact sourceStore / targetStore keys obtained from context.inventory().stores() in your own extension. This moves existing stock immediately; it does not create a hauling task. Zero disables this example step.

Coordinates are tile units, with z increasing downward. Storage keys and coordinates are world-specific, so use a disposable test settlement when configuring this authoring example.

The four-square HUD button opens the example panel even while enabled is false; its actions remain disabled until configured. Set recipeId for the one-batch crafting button, zoneId for a one-tile zone at buildX/Y/Z, and pickupPlaceableId plus targetStore for physical furniture hauling. none / 0 disable each action independently. Accepted-request count and zone/hauling receipts are saved. Craft clicks intentionally add another batch; zone/hauling actions are one-shot per world. The panel disappears when the mod is disabled and the game restarts. See panels.

The mod attempts unresolved commands once per game day and saves accepted IDs. Rejected plans may retry on the next day. A successful transfer, accepted labor order and accepted construction plan each happen once per world; changing settings does not erase that history. Completed/cancelled outcomes are saved under workOutcome and buildOutcome. It does not automatically replace cancelled work. No global/static world state or external files are used.

See the inventory and construction contract for bounds, timing, supported targets, save semantics and the construction/work categories still awaiting submission hooks.