Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Changing the game's own code

Hooks, Parts and [[inject]] listeners cover most mods, and they work the same on native and wasm. When no hook fits and you need to change what a game function itself does, a native mod can take the native route: tables under [native] in horizon-mod.toml, applied to the prebuilt game without rebuilding it. You work with the game's real types, pinned to the exact game build.

TableUse it toPage
[[native.mixin]]run code at the start or end of a game function, change a value or a call inside it, or replace its bodyMixins
[[native.loop]]run your code before and after each entry of a hot loop the game publishes, such as the block entity tickPublished loops
[[native.bridge]]read, write or call a private field or method of a game type from your mixin codeBridges
[[native.module]]add a module of your own code inside a game source file, for your mixin code to shareSupport modules
[[native.state]]add a field to a game type: refused, use an attachmentNative state