docs/modpack-devs.md

For modpack developers

730 words · ~3 min read

Tinfoil needs nothing but NeoForge 1.21.1. Everything below can be changed with a datapack, the config file or KubeJS; nothing needs a code change.

Blocks, recipes and tags

  • Recipes. Every family has one crafting recipe from vanilla materials (data/tinfoil/recipe/), and every other member of the family comes from the stonecutter (slabs ×2). Decor pieces are cut from the material they're carved or cast from. Override any of them by recipe id in a datapack, or remove/replace them with KubeJS (recipes.js).
  • Tags. Blocks join the vanilla tags their shape implies: minecraft:slabs, stairs, walls, fences, buttons, stone_buttons, wool, climbable and the mineable/* tool tags (same for the item tags). Tinfoil has no tinfoil: or c: tags of its own yet; add the ones your pack needs (e.g. a c:stones or a pack-wide "marble" tag) with a datapack or tags.js.
  • Loot. Every block drops itself (slabs: two when doubled). Loot tables are in data/tinfoil/loot_table/blocks/.

Data-driven content (datapack)

whatwhereformat
Statue schemes (Founders' colossi)data/<ns>/tinfoil/statue_schemes/<name>.jsonshades (block ids, light → dark), core, ornament, glow, moss, plinth, plinth_trim
Ruin schemes (ruin and anomaly pieces)data/<ns>/tinfoil/ruin_schemes/<name>.jsonthe statue-scheme keys plus optional metal, metal_dark, rubble, mark
Patterns (crop circles, geoglyphs)data/<ns>/tinfoil/patterns/<name>.json`{"kind": "crop_circle" \
Ancient Islandsdata/tinfoil/worldgen/structure/ancient_island.json, structure_set/ancient_islands.jsonvanilla structure + structure set (spacing, salt)
Where islands spawnbiome tag tinfoil:has_structure/ancient_islanddefault #minecraft:is_overworld

A scheme in your own namespace sits next to Tinfoil's; one with the same id (data/tinfoil/...) replaces it. Example scheme: examples/datapack/statue_scheme_obsidian.json, used as /tinfoil statue place <player> pristine standing mypack:obsidian.

Crop circles and geoglyphs only press into natural ground (dirt, grass, sand, farmland, terracotta, gravel) and never cut into builds or water, so custom patterns are safe on populated servers.

Config

config/tinfoil-common.toml, see CONFIG. The Founders are [statues] players: the defaults are the players of the server Tinfoil was made for, so a pack should put in its own list (or an empty one for the bundled default skin).

Relic artifacts and relic caches

When a world is ported, block entities and items the porter can't map aren't thrown away:

  • tinfoil:relic_artifact carries the data component tinfoil:relic_origin {id, state, data, data_version}: the original item id, its full 1.20.1 NBT and the data version it came from. The tooltip names the original.
  • tinfoil:relic_cache is a block whose block entity stores the same origin for a whole container; breaking it releases the contents (upgraded by Minecraft's data fixers where the item still exists, artifacts otherwise).

To hand players a fair replacement, read the origin with /tinfoil relic inspect (held item or the cache you look at) or script it: relic_exchange.js swaps known artifacts for a replacement when a player uses them.

Legacy ids

tinfoil/legacy_ids.json inside the jar maps old ids (from the mods the old world used) to their replacements and becomes registry aliases: a chunk or item with an old id loads as the replacement instead of air. It is written by the porter (porter legacy), read once at startup and only applies to ids that aren't registered, so it never shadows a mod that is actually installed. It is not a datapack file. To check or switch it off:

  • /tinfoil diagnose shows how many aliases are active.
  • -Dtinfoil.legacyRemap.disabled=true (JVM flag) turns it off, once /tinfoil scan is clean and every imported chunk has been re-saved.

KubeJS examples

Plain scripts under docs/examples/kubejs/, written against KubeJS 2101 (NeoForge 1.21.1). Copy them into your instance's kubejs/ folder and adapt.

filewhat it shows
server_scripts/recipes.jsextra stonecutter routes, replacing a family's crafting recipe
server_scripts/tags.jsputting Tinfoil blocks into c: and pack tags
server_scripts/relic_exchange.jsswapping relic artifacts for replacements by their original id
client_scripts/tooltips.jsa pack-specific tooltip line on Tinfoil blocks

The examples are not run by the mod's game tests; check them against the KubeJS version of your pack.