Repository navigation
API Conventions
On this page
A BetaMoon declaration configures content, a reference identifies registered content, and a live context provides access during a callback. APIs requiring a structural or material handle expect the original returned handle, not a copied table with the same fields.
Unless shown as a complete script, declaration and registration snippets belong inside modInit(). Callback snippets belong in the named declaration. Variables such as ctx, match, or tile mean the object described by that entry, not globals supplied to every script.
IDs in examples may be in use by other mods, so you may need to change them in the scripts when you try them out.
Registration does not give items to the player.
Texture indices and block/item IDs are different values.
Scripts use their name metadata for dependencies. Exported module names and script filenames are separate identifiers.
mymod in wiki snippets is a placeholder namespace. Replace it consistently in content keys and default asset paths
when making your own mod. The example namespace is reserved for BetaMoon's bundled numbered lessons.
Blocks and items accept internalName, name, or key, in that precedence order. A namespace prefix before : is stripped from the internal name. Current block/item name lookup also accepts the part after :; it does not enforce namespace isolation.
Fluid and fluid-interaction registrations use canonical typed keys such as my_mod:fluid/acid and
my_mod:fluid_interaction/acid_water. Use your own namespace; betamoon and minecraft are reserved.
A shorthand without the type segment, such as my_mod:acid, is accepted
where a declaration explicitly expects that resource type. References and lookup results expose the canonical key.
Do not change saved numeric identities or persistent slot mappings casually. See reload and compatibility.
Interaction callbacks accept "pass", "deny", and "handled". Prefer the read-only constants so a misspelled result fails when the script reads it:
return betamoon.callbackResults.handledcallbackResults.pass continues normal handling, callbackResults.deny refuses the interaction and suppresses applicable fallback, and callbackResults.handled completes it successfully. The equivalent literal strings remain accepted.
Each discovered script receives its own isolated Lua environment with betamoon installed globally and registered as a loaded module. require("betamoon") returns that module. Cross-script sharing uses BetaMoon modules.
- Installation
- Install scripts
- Getting started
- VS Code and LuaLS
- Examples
- Reload and compatibility
- Troubleshooting
- Changelog
Scripts and shared values
- Script lifecycle
- Packaged Lua mods
- Modules
- References and stacks
- Queries
- Overrides
- Minecraft constants
- Chat and positions
- Structured data
- Script configuration
- Particles
Blocks and items
- Multiblocks
- Blocks
- Block state and placement
- Block shapes and rendering
- Block callbacks
- Block ticks and redstone
- Items
- Fluids
- Item callbacks
- Tools and armor
- Materials
- Textures
Entities
- Entities
- Entity access and movement
- Entity lifecycle and data
- Entity health and loot
- Entity inventories and relationships
- Projectiles and pickups
- Entity presentation and sounds
- Living entities and AI
- Entity parts and sensors
Assets and audio
- Assets
- Models and animations
- Built-in Minecraft models
- Model appearances
- Blockbench workflow
- Audio
- Texture-pack overrides
Events and world actions
World generation
World systems
Inventories and screens
Recipes