技术文档有英文版本。代码和字段名称遵循当前的 Mod API。
模组制作文档
Make a JSON-only mod
Use JSON for balance changes and new content that uses existing game behavior. You need a text editor and the installed game. Java, a JDK, and a source checkout are optional.
1. Choose the task
| I want to… | Instructions | Definitions needed |
|---|---|---|
| Change a number on existing content | Change an existing value | A patch operation |
| Add a weapon | Add a weapon | resources + equipment + a recipe or loot source |
| Add furniture | Add furniture | placeables; copied craftedResource supplies its inventory item |
| Add an animal, enemy, or NPC | Add a creature | creatures + a spawn route; optional loot and respawns |
| Add food, plants, or resource families | Connect gameplay content | The linked registries in that guide |
| Add a complete scenario | Scenario instructions | Owned scenario registries |
New professions, recruitable unit archetypes, AI algorithms, combat formulas, and arbitrary UI windows are not JSON registries. A Java mod can use the exposed hooks; Java does not automatically grant access to an unsupported engine feature.
2. Find the registry and ID
Use the exact registry name below in your operation. Your patch filename can be anything. Copying a game JSON file into a mod folder does not replace that file.
| Registry | Purpose | Operations |
|---|---|---|
resources |
Inventory items and icons | add, patch |
recipes |
Production and ingredients | add, patch |
placeables |
Furniture, storage, workstations, decorations | add, patch |
essences |
Imbuements using existing effects | add, patch |
equipmentTransforms |
Equipment conversion rules | add, patch; handler must exist |
particleProfiles |
Settings for registered particle shapes | add, patch; shape must exist |
difficulty |
Four existing difficulty presets | patch |
creatureRespawns |
Births and migration | add, patch |
families |
Groups of ingredients | add, patch |
food |
Eating and food effects | add, patch |
equipment |
Weapon and equipment statistics | add, patch |
features |
Plants and world objects | add, patch |
creatures |
Actors using existing behavior | add, patch |
creatureLoot |
Death-drop rules | add, patch |
disciplines, packingProfiles, tradeGoods, storageGroups, storageDisplays |
Crafting categories, reversible packed goods and storage presentation (API 15) | add, patch |
questStages |
Existing lesson text and objectives | patch |
campaignStages, quests, campaignBootstraps, ambientScenes |
Complete owned scenario entries | add; no copyFrom |
Look up existing IDs in the base ID list. Look up accepted keys in the JSON field index, then read their meaning and constraints. Other shipped JSON files are not automatically part of the mod API.
3. Write the manifest and operations
For the smallest complete example, follow Your first mod. For all three content additions, copy the JSON content starter.
| Operation key | Required? | Value |
|---|---|---|
registry |
Yes | Exact name from the table above |
op |
Yes | add or patch, subject to that registry's restriction |
id |
Yes | Existing ID for a patch; pack_id:local_name for ordinary new content |
copyFrom |
Optional, add only |
Existing ID in the same registry; inherits art and settings |
values |
Yes | Object containing only the fields you want to set |
Food and equipment use their resource ID. Existing lessons use questId/stageId.
Scenarios use the owned cN_pack_id_* IDs described in their guide.
The manifest reference lists all mod.json keys.
Rules for editing:
- Omitted fields keep the copied or existing value.
- Objects merge recursively. Changing
combat.levelkeeps other combat fields. - Arrays replace the whole array. Supply every member you want to keep.
nullis accepted only where the owning field supports it. It is not a delete command.copyFrommust name a definition available at that point in load order.- References to another pack require a manifest dependency. Overlapping changes require a dependency on the earlier writer; moving a pack lower does not resolve the conflict.
4. Name new content
Put display text in every supported translation catalog and list the catalogs in mod.json.
Use flat key-to-text objects, as in the starter.
| Content | Translation key |
|---|---|
| Resource, including a weapon or food | resources.pack_id:local_name |
| Recipe | recipes.pack_id:local_name |
| Furniture or other placeable | placeables.pack_id:local_name |
| Creature | creatures.pack_id:local_name |
| World feature | world_features.pack_id:local_name |
| Resource family | resource_families.pack_id:local_name |
| Essence | essences.pack_id:local_name |
Equipment and food use the resource name. Loot rules and respawn profiles need no name.
Changing only existing numbers needs no new translations. Do not put displayName in values.
Supported locales: de, en, es, fr, it, ja, ko, nl, pl, pt_br, ru,
tr, zh_cn. An English fallback does not satisfy validation.
5. Enable, validate, and check the result
- Open Mods → Open mods folder. On Windows this is normally
%LOCALAPPDATA%\ForgottenTowns\mods. - Put the pack at
mods/pack_id/mod.json. Folder and manifest ID must match. - Choose Refresh, Enable, then Apply & reload.
- Resolve validation errors. See troubleshooting.
- Open a test world and perform the guide's gameplay check. Initial spawns require a new world.
- After editing files, apply and reload again. Running sessions use a captured copy.
Validation checks content and references. It does not prove that a new sprite faces correctly, a recipe is well balanced, or every map has room for a requested spawn.
6. Share the pack
Distribute the folder containing mod.json, its listed data/translations, and any assets.
JSON-only packs have no code entry and need no JAR. Keep enabled.json, caches, and local
settings out of the download. Keep released IDs stable; read save compatibility
before updating a pack. Use Workshop publishing for Steam distribution.
