Files
codecraft/README.md
Gitea OpenCode Agent 2069a6bab4
Some checks failed
build / build (push) Failing after 51s
build / build (pull_request) Failing after 1m39s
Fix issue #10: Update README.md
2026-10-13 17:34:54 +00:00

68 lines
2.8 KiB
Markdown

# codecraft
Codecraft is a Fabric mod for Minecraft that lets players write and run Lua code
from an in-game code editor. Open the editor with `J` (default, rebindable under
*Options → Controls → Codecraft*), write your script, and press **Run Script** —
it executes on the server. Scripts can change the world, react to game events,
and automate gameplay:
```lua
for y = 64, 67 do
world.set_block(10, y, -3, "minecraft:cobblestone")
end
```
## Features
- **In-game code editor** — built with custom widgets: Lua syntax highlighting,
autocompletion, snippets, multiple panes, find and replace, and configurable
themes and fonts.
- **Project file tree** — files are named by path (`lib/gui/theme`), grouped
into folders, and `main` is the entrypoint that **Run Script** executes.
- **Server-side Lua runtime** — scripts run on the server thread through
[luajava](https://iroiro.party/luajava/) (pure-Java LuaJ, no native libraries),
so everything a script does has server permissions.
- **Lua API** — place and break blocks, spawn and manipulate entities, scoreboards,
HUD and boss bars, items and inventories, commands via `run()`, and event
listeners (`events.on_break_block`, `events.on_chat`, ...) that keep running
after the script has finished.
- **In-game documentation** — browse the full API reference from the editor
(**Help → Lua API Documentation**), or press `F1` on a function while editing.
- **Live collaboration** — documents are shared and synced in real time between
players editing them together.
- **Terminal pane** — a server shell right inside the editor.
- **Plain-file persistence** — the project is stored as `.lua` files under
`config/codecraft/` on the server, mirroring project paths, so it can also be
edited with an external editor and is re-read every time the editor opens.
## Lua API
The full API reference lives in [docs/lua-api.md](docs/lua-api.md) and is
browsable in-game from the editor. It covers blocks, entities, scoreboards,
HUD and boss bars, items and inventories, events, examples, and limits.
## Requirements
| Component | Version |
| --------------- | ---------------- |
| Minecraft | 26.2 |
| Fabric Loader | ≥ 0.19.3 |
| Fabric API | any recent build |
| Java | 25+ |
## Building
Building 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) into `src/main/generated/`.
For general Fabric workspace setup, see the
[Fabric Documentation page](https://docs.fabricmc.net/develop/getting-started/creating-a-project#setting-up)
related to the IDE that you are using.
## License
Distributed under the CC0-1.0 license. See [LICENSE](LICENSE) for details.