Project layout and templates
Status: Implemented. One template per language. The content templates listed below are Planned.
Creating a project
clight new <lua|c|cpp> <mod_id> [--name "Display Name"] [--dir <parent folder>]
This copies clight-sdk/templates/<language>/ into <parent>/<mod_id>/ and fills in the id and name. The mod_id must match ^[a-z][a-z0-9_]{1,63}$ and is also your namespace. Every template is a working mod: a manifest, an entry point that greets players on join, and a lang file.
Planned content templates: block-mod, item-mod, entity-mod, client-mod, server-plugin, library, worldgen-mod. Until then, start from the examples in clight-sdk/examples/.
Layout (C++ example)
ruby_tools/
├── clight.mod.json manifest (see 99_Appendix/06_Manifest_Schema.md)
├── CMakeLists.txt optional: clight_add_mod(ruby_tools SOURCES src/main.cpp)
├── src/
│ └── main.cpp every .c/.cpp/.cc/.cxx under src/ is compiled
├── assets/ruby_tools/ client resources (resource-pack layout)
│ ├── blockstates/ models/block/ models/item/ items/
│ ├── textures/block/ textures/item/
│ ├── lang/en_us.json
│ ├── sounds.json sounds/ custom sounds (Ogg Vorbis)
│ └── ui/ RML and RCSS documents
├── datapack/ruby_tools/ server data (data-pack layout without the data/ level)
│ ├── recipe/ loot_table/blocks/ tags/ advancement/
│ └── enchantment/
├── icon.png
├── build/ created by `clight build` (objects, bin/ruby_tools.wasm, the .clmod)
└── data/ created at runtime when the mod is installed: its only writable folder (not packed)
Layout differences per language
| Language | Code | Build |
|---|---|---|
| C | src/*.c |
clight build (wasi-sdk clang → build/bin/<id>.wasm) |
| C++ | src/*.cpp |
clight build (wasi-sdk clang++ → build/bin/<id>.wasm) |
| Lua | scripts/main.lua (+ modules, via require "ruby_tools.util" → scripts/util.lua) |
none |
assets/, datapack/, clight.mod.json and icon.png are identical for every language.
The build output
Every build produces build/<mod_id>-<version>.clmod, a zip:
ruby_tools-1.2.0.clmod
├── clight.mod.json
├── bin/ruby_tools.wasm (C/C++) or scripts/… (Lua)
└── assets/… datapack/… icon.png
See Packaging a .clmod.