codecraft
A Fabric mod for Minecraft that lets players write and run Lua code directly in-game — no datapacks, no external tooling, no server restarts.
Purpose
codecraft turns the game itself into a scripting environment. Open a code editor from inside Minecraft, write Lua against a curated game API, and press Run: the script executes on the server and changes the world. It is meant for players who want to automate, build, and experiment with code, and for servers that want to hand their community a safe, documented entry point into programming with Minecraft.
Features
- In-game editor — open with
Jby default (rebindable): multi-file projects with a folder tree, tabs, syntax highlighting, autocomplete, snippets, find/replace, and themes. - Server-side Lua runtime — scripts run on the server thread through a pure-Java Lua interpreter (luajava); the project is stored on the server under
config/codecraft/as plain.luafiles, so it can also be edited with external editors. - Game API — place and break blocks, query and spawn entities, manage items and inventories, scoreboards, HUD and boss bars, weather and time, and listen to events that keep running after a script finishes.
- In-game documentation — the full Lua API reference is browsable inside the editor (Help → Lua API Documentation, or
F1on a function), with search. - Collaboration — live shared documents let multiple players edit the same file at once.
- Terminal — an integrated terminal pane with a server-side shell.
Getting started
- Install the mod with Fabric Loader and the Fabric API.
- Join a server (or open a world) and press
Jto open the editor. - Write your script in
mainand hit Run Script.
Scripts can place and remove blocks through the world table:
for y = 64, 67 do
world.set_block(10, y, -3, "minecraft:cobblestone")
end
Documentation
The user-facing Lua API is documented in docs/lua-api.md, and the same reference is available in-game from the editor.
Requirements
| Component | Version |
|---|---|
| Minecraft | 26.2 |
| Fabric Loader | ≥ 0.19.3 |
| Fabric API | 0.153.0+26.2 |
| Java | 25 |
Building from source
Requires JDK 25.
./gradlew build # compile and build the mod jar (output in build/libs/)
./gradlew runClient # launch a dev client with the mod loaded
./gradlew runDatagen # regenerate data (lang files)
For general Fabric development setup instructions, see the Fabric Documentation page related to the IDE that you are using.
License
This project is available under the CC0-1.0 license. Feel free to learn from it and incorporate it in your own projects.