Data-driven content
Status: Partly implemented. A mod’s
assets/anddatapack/folders load as packs, so everything vanilla reads from resource and data packs works. Code that registers new data types (recipe serializers, loot functions, feature types), biome modifiers and an API for reading data from code are Planned.
Most of the 26.3 game is data: recipes, loot tables, tags, advancements, enchantments, damage types, item model definitions, block states, models, sounds and language files. Celestial loads all of it from the player’s own game files and from packs. Every CLight mod can also be a pack.
The mod as a pack
A .clmod can contain assets/<namespace>/ and datapack/<namespace>/ folders. The loader mounts them as built-in packs named mod/<id>:
| Resources (lowest priority first) | Data (lowest priority first) |
|---|---|
| vanilla | vanilla |
mod/<a>, mod/<b>, … in mod load order |
mod/<a>, mod/<b>, … |
| the player’s resource packs | the world’s data packs |
| the server’s resource pack |
So a player’s resource pack can retexture a mod’s item, and a world data pack can change a mod’s recipe, exactly as with vanilla content. Note the layout: the data pack folder is datapack/<namespace>/recipe/..., without the data/ level of a normal data pack (data/ in a mod folder is the mod’s runtime folder).
What needs no code at all
| Goal | Files |
|---|---|
| New or changed recipes (with vanilla items) | datapack/<ns>/recipe/*.json |
| Loot changes, loot for your mod blocks | datapack/<ns>/loot_table/**.json (mod blocks: loot_table/blocks/<path>.json; mod items allowed) |
| Tags | datapack/<ns>/tags/<registry>/*.json |
| Enchantments, damage types, paintings, jukebox songs, trims, banner patterns, variants | the matching data-pack folder (enchantment/, damage_type/, painting_variant/, …) |
| Advancements, predicates, item modifiers, functions | advancement/, predicate/, item_modifier/, function/ |
| Textures, models, block states, item model definitions, sounds, languages, fonts | assets/<ns>/... |
A mod with only these folders and "runtime": { "type": "data" } is a data mod. It loads instantly and runs no code.
Recipes can use and make mod items by id, like vanilla items. What the server generates is limited to vanilla’s three dimensions; worldgen data for new dimensions is not generated yet (Planned).
Reloads
/reload(server) re-reads data packs, including mod data. Fireslifecycle.data_reloaded.- A resource reload (F3+T, the pack screen) re-reads resources, only the changed files. Fires
lifecycle.resources_reloaded.
Planned
| Planned | What it adds |
|---|---|
| Data types from code | Recipe serializers, loot functions, enchantment effect components and feature types registered by a mod and used from JSON |
| Biome modifiers | clight:add_features, remove_features, add_spawns, … applied after biomes load, so mods don’t conflict over biome files |
| Reading data from code | Recipes, loot rolls, tag contents and raw resource files from Lua, C and C++ |
See Recipes, loot and tags and Resources, data packs and localisation.