This repository was archived by the owner on Jun 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Ore Generation
Michael Weatherby edited this page Jul 27, 2020
·
11 revisions
Here is example code for registering an ore. Copy/paste this for each ore you want to generate. These commands need to be run from the #load:post_load function tag to ensure it runs after DU has set up the ore registry system.
## All of these scores need to be set within the specified ranges.
# minimum y value to generate at
scoreboard players set $world.in_0 du_data 0
# maximum y value to generate at
scoreboard players set $world.in_1 du_data 64
# minimum number of veins to generate
scoreboard players set $world.in_2 du_data 4
# maximum number of veins to generate
scoreboard players set $world.in_3 du_data 4
# minimum number of ores per vein
scoreboard players set $world.in_4 du_data 2
# maximum number of ores per vein
scoreboard players set $world.in_5 du_data 8
# ignore placement restrictions (normally ores are only placed in stone- if you want it to generate in say sand, set this to 1 and check for sand manually).
scoreboard players set $world.in_6 du_data 0
# Optional: add this line to adjust dimension and/or biome whitelist/blacklist
# Defaults to overworld and no biome restrictions
# data merge storage du:temp {object:{dimension:"minecraft:overworld",biomes:["biome_1","biome_2",...],isBlacklist:0b}}
#Call Registry Function
function du:world/registry/register_ore
#Save returned registry ID. This function returns -1 if registering failed.
scoreboard players operation <custom_ore> <obj> = $world.out_0 du_data
After registering the ore, extend the function tag #du:generation/ore. Then, when the score $world.in_0 du_data equals the saved reg ID for the custom ore, spawn the ore. Example: execute if score <my_ore_id> <obj> = $world.in_0 du_data run setblock ~ ~ ~ <custom ore>.