Skip to content

Make mods in C++

Lesson 1.1

Write Celestial mods in C++. Your code is compiled to WebAssembly and runs in a sandbox, so players can install it without worrying, and one build works on every computer.

This course doesn’t teach the C++ language itself. W3Schools already does that very well, for free, with an editor in the browser. Every time you need a language feature, we link to the right W3Schools page. What you learn here is everything about making mods: the tools, the API, the C++ wrapper and the rules of the sandbox.

Who it is for

  • You know some C++, or you are willing to learn the basics on W3Schools first. Before you start lists the pages to read, in order.
  • You don’t need to know anything about Minecraft modding.

If you have never programmed before, the Lua course is the gentler start. Lua mods need no compiler, and they reload while the game runs. If you prefer plain C, there is a C course too; it uses the same API without the wrapper.

What’s in the course

Getting set up

The C++ you need, the SDK, the compiler, a first mod, the manifest, building and running.

How the API works

The C++ wrapper, handles and strings, errors and Expected, and where code is allowed to run.

The game

Events, players and text, items and blocks, the world, commands, timers and config.

The client and beyond

Keybinds, the HUD, screens, sound, networking, permissions, memory, debugging, mixins and publishing.

The chapters:

  • Before you start. The C++ you need and where to learn it.
  • Your first mod. The SDK, the compiler, the manifest, building and running the game.
  • How the API works. The wrapper, handles and strings, errors and Expected, contexts and sides.
  • Events. Listening, changing and cancelling, and the list of every event.
  • Players and text. Players, inventories, messages and colours.
  • Items and blocks. Registering content, assets, recipes, reading and placing blocks, entities (spawning, moving, your own types), models and animation for them, entity gameplay (finding, buffing, hurting, spawning, riding), world access and player control, and AI (paths, goals) and saved data.
  • Commands and timers. Commands, waiting and repeating, config files.
  • The client. Keybinds, client events, the HUD, screens, menus, sound and music, particles, post effects, the camera, themed GUIs with HUD elements and Appearance pages, React-style components, and HTML/CSS overlays and panels.
  • Networking and permissions. Messages between client and server, the sandbox’s capabilities, and your own files and websites.
  • Finishing up. Memory in the sandbox, debugging, publishing, and a complete project.
  • Mixins. Hooking into the game’s own code: head, return, points, values, wraps, invokers, priorities and debugging, with a project.

Every lesson has the same shape

  • A short explanation with examples.
  • Try it: a small exercise. Write the code yourself before you open the solution.
  • Recap: the lesson in one line.

The examples use the game API, so they run inside the game, not on their own. Each lesson says what to expect when you try them. Log output looks like this:

[my_mod] Ruby Tools loaded

The wrapper does the boring parts

The SDK comes with clight.hpp, a header-only C++ wrapper over the C API. It gives you lambdas as event handlers, std::string and std::string_view instead of raw buffers, classes that release game objects for you, and short helpers like player.give("minecraft:apple") and player.send_message("Hi!"). The course uses it everywhere, and shows the C API underneath when it helps.

Start with The C++ you need.