Repository navigation
API Worldgen Ores
Lua API / World generation / Ore generation
The ore API registers a generation rule with a placement reference. Returned references support lookup, queries, and reversible override layers.
Adds an ore-generation rule and returns its generated placement reference.
local copper = betamoon.worldgen.ores:add {
key = "mymod:copper_ore",
block = ore,
veinsPerChunk = 8,
veinSize = 6,
height = { min = 0, max = 60 }
}
local layer = copper:override {
veinsPerChunk = 5,
height = { min = 8, max = 48 }
}| Field | Type | Default / requirement |
|---|---|---|
block |
block ID or ID-bearing reference/table | Required placed block. |
key |
string | Optional stable placement key. Omitted keys receive a private deterministic key. |
veinsPerChunk |
integer | Required attempts per chunk, from 0 through 256. Zero keeps the declaration but disables its attempts. |
veinSize |
integer | Required size from 1 through 128; actual shape/count depends on terrain. |
height.min |
integer | Required lower height from 0 through 127. |
height.max |
integer | Required inclusive upper height from min through 127. |
dimension |
string |
overworld default; also nether/hell, both/all. |
replace |
block ID/reference/table | Optional replacement target; defaults to stone in overworld and netherrack in Nether. |
biomes |
list of biome names | Omitted or empty allows all biomes; at most 64 names. |
salt |
integer | Optional deterministic seed salt. |
The placed ore block currently uses metadata zero. Omitted replace means stone in the overworld and netherrack in
the Nether. Invalid height ordering, unknown replacement blocks, and invalid biome lists raise errors. No finish or
commit method is needed.
| Method | Result |
|---|---|
betamoon.worldgen.ores:get(key) |
Ore reference, or nil when the placement key is absent. |
betamoon.worldgen.ores:getRequired(key) |
Ore reference; raises an error when absent. |
betamoon.worldgen.ores:find(query) |
Result list filtered by optional key, owner, enabled, block, and dimension. |
betamoon.worldgen.ores:first(query) |
First match, or nil. |
betamoon.worldgen.ores:one(query) |
Sole match, nil for none, or an error for multiple matches. |
An ore reference is also a placement reference: getKey() returns its placement key and getFeature() returns the generated ore feature. Its live fields are id, key, owner, exists, enabled, block, veinsPerChunk, veinSize, height, dimension, replace, and biomes.
rule:override(definition) changes enabled, block, veinsPerChunk, veinSize, height, dimension, replace, or biomes. The generated feature and placement are rebuilt together, so changes affect chunks generated afterward. Calling remove() on the returned handle restores the next lower values.
In an override, replace = false removes an explicit replacement target and restores the default for the active
dimension. Likewise, biomes = false removes the biome restriction.
Example: Ore generation
- 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