Creating Ores From Scratch

This guide will continue the process of creating a new Terra config pack from the beginning with creating ores.

If you haven’t already, please read the Config Development Introduction & Creating A Pack From Scratch for more information before continuing.

If you’re stuck or need an example, you can find reference config packs for this guide on the GitHub repo.

Setting up Ores

PROCEDURE

1. Create an abstract ore config

An ore config file will allow you configure ores that will generate in your world.

Open your pack manifest in your editor of choice.

Add the config-ore addon as a dependency, using versions 1.+.

This addon will allow us to create palette config files.

pack.yml
1id: YOUR_PACK_ID
2version: 0.9.0
3
4addons:
5  ...
6  config-ore: "1.+"

An abstract ore config file will be necessary for ore configs to inherit from and easily configure.

Create a blank config file with the file name abstract_ore.yml.

Set the config type via the type parameter, config id, and abstract` as shown below.

abstract_ore.yml
1id: ABSTRACT_ORE
2type: ORE
3abstract: true

Add the highlighted lines to add the replace parameter.

abstract_ore.yml
1id: ABSTRACT_ORE
2type: ORE
3abstract: true
4
5replace:
6  - minecraft:stone
7  - minecraft:deepslate

The abstract parameter with a value of true will allow this abstract config to not have the mandatory parameters required for an ore config file.

The replace parameter consists a block or list of blocks that the ore config will be able to replace, which is stone and deepslate in this case.

2. Create an ore config file

With an abstract ore config prepared, an ore config can now be created to inherit those abstract parameters.

Create a blank config file with the file name coal_ore.yml.

Set the config type via the type parameter, config id, and extends as shown below.

coal_ore.yml
1id: COAL_ORE
2type: ORE
3extends: ABSTRACT_ORE

Add the highlighted lines to set the material, material-overrides, and size.

coal_ore.yml
 1id: COAL_ORE
 2type: ORE
 3extends: ABSTRACT_ORE
 4
 5material: minecraft:coal_ore
 6
 7material-overrides:
 8  minecraft:deepslate: minecraft:deepslate_coal_ore
 9
10size: 10

COAL_ORE will extend ABSTRACT_ORE in order to be able to replace stone and deepslate blocks.

material determines the block that this ore config will place, which will be coal ore.

material-overrides determines different blocks to be placed if specified blocks are replaced by the ore.

In this case, a deepslate block getting replaced results in deepslate coal ore being placed instead of regular coal ore.

size determines the size of the ore vein that will generate.

3. Add ore feature config file

With an ore config file created, a feature config file will be needed in order to place that ore as a feature in a generation stage.

Create a blank config file with the file name coal_ore_feature.yml.

Set the config type via the type parameter, and config id as shown below.

coal_ore_feature.yml
1id: COAL_ORE_FEATURE
2type: FEATURE

Add the highlighted lines to set the distributor, locator, and structure.

coal_ore_feature.yml
 1id: COAL_ORE_FEATURE
 2type: FEATURE
 3
 4distributor:
 5  type: SAMPLER
 6  sampler:
 7    type: POSITIVE_WHITE_NOISE
 8    salt: 1234
 9  threshold: 10 * (1/256)
10#averageCountPerChunk Divide by 16^2 to get % per column
11
12locator:
13  type: GAUSSIAN_RANDOM
14  amount: 1
15  height:
16    min: -64
17    max: 192
18  standard-deviation: (192-(-64))/6
19# Divide distance from min to max by 6 to fit 3 standard deviations
20
21structures:
22  distribution:
23    type: CONSTANT
24  structures: COAL_ORE

The feature config for this ore is set up and configurable to best resemble ore generation.

The distributor threshold utilizes a number that represents the average ore count per chunk, which proceeds to get divided by 256.

The locator utilizes GAUSSIAN_RANDOM with a standard deviation that adds the max and min range values, which get get divided by 6 in order to fit 3 standard deviations (~99.7% of results) within the range. Furthermore, ore generation results are higher towards the middle of the range.

The structures.structures is set to use the COAL_ORE ORE config that was created a step prior.

Note

A uniform ore distribution generates ore with equal chance across the entire range rather than more towards the middle of the range with a normal distribution.

A uniform ore distribution will use the locator shown below.

coal_ore_uniform.yml
1locator:
2  type: RANDOM
3  amount: 1
4  height:
5    min: -64
6    max: 192
7  salt: 1234

4. Add ores feature stage

We will now utilize the generation-stage-feature addon that was added in Setting up a New Feature to add a new generation stage for ores.

Open your pack manifest in your editor of choice.

Add the following lines to add a generation stage for ores.

pack.yml
 1id: YOUR_PACK_ID
 2
 3...
 4
 5stages:
 6  - id: preprocessors
 7    type: FEATURE
 8
 9  - id: ores
10    type: FEATURE
11
12  - id: flora
13    type: FEATURE
14
15  - id: trees
16    type: FEATURE

The ores generation stage can now generate ores as features and be kept separate from other features.

5. Create an abstract ore biome config

Instead of adding COAL_ORE to every individual biome config, an abstract biome config can be extended by biomes for them to inherit the ore feature generation.

This eases the config development process down the line especially as more biomes and ores get added to the config pack without having to individually update every config file.

Create a blank config file with the file name ores_default.yml.

Set the config type via the type parameter, config id, and abstract as shown below.

ores_default.yml
1id: ORES_DEFAULT
2type: BIOME
3abstract: true

Add the highlighted lines to add ore feature generation to ORES_DEFAULT.

ores_default.yml
1id: ORES_DEFAULT
2type: BIOME
3abstract: true
4
5features:
6  ores:
7    - COAL_ORE_FEATURE

ORES_DEFAULT allows for the ores generation stage to be configured in one config, which can be extended to biomes that will generate ores.

6. Extend abstract ore biome config

Biome configs can now extend ORES_DEFAULT in order to inherit and generate ore features.

While you could extend ORES_DEFAULT to each biome individually, you already have an abstract BASE config that is extended to each biome.

With that in mind, you can simply extend ORES_DEFAULT through BASE to allow those biomes that extend BASE to inherit ore generation with ease.

Open your BASE config in your editor of choice.

Add the following line to extend ORES_DEFAULT to the BASE config.

base.yml
 1id: BASE
 2type: BIOME
 3abstract: true
 4extends: ORES_DEFAULT
 5
 6ocean:
 7  palette: BLOCK:minecraft:water
 8  level: 62
 9
10features:
11  preprocessors:
12    - CONTAIN_FLOATING_WATER

ORES_DEFAULT should now be extended to all biome configs that extend BASE and generate COAL_ORE_FEATURE.

7. Load your pack

At this stage, your pack should now be capable of generating ores! You can load up your pack by starting your development client / server which contains the pack you have just defined. You can confirm that your pack has loaded if the pack id (as specified in the pack manifest) appears when using the /packs command, or in your console when starting the server / client up.

If for whatever reason your pack does not load, an error message will show up in console explaining why the pack has failed to load, please read through any of these errors and try to interpret what you may have done wrong, and follow through the previous steps again carefully.

If you still are unable to load the pack, feel free to contact us with any relevant errors.

Conclusion

Now that you’ve verified your pack has loaded correctly, you can now generate a world with ores!

Reference configurations for this guide can be found on GitHub here.

../../../_images/ores.png