User Tools

Site Tools





Blocks and Block Entities



World Generation





Tutorials for Minecraft 1.14



Adding Ores to the World

A lot of mods add their own ores, and you'll need a way to place them in existing biomes for players to find. In this tutorial, we'll look at adding ores to existing biomes and biomes added by other mods. There are 2 steps that are required to add ores to biomes.

  • Iterate over the biome registry to add your ores to existing biomes.
  • Use the RegistryEntryAddedCallback to ensure your ore gets added into any biomes added by mods.

We'll assume you've already created your own ore block at this point. Quartz Ore will serve as our replacement, and our goal will be spawning it in overworld biomes. Replace references to Quartz Ore with your ore when appropriate.

Adding ores to a biome

First we need to create a method to process a biome, checking if it is a valid biome then adding the ore.

  1. private void handleBiome(Biome biome) {
  2. if(biome.getCategory() != Biome.Category.NETHER && biome.getCategory() != Biome.Category.THEEND) {
  3. biome.addFeature(
  4. GenerationStep.Feature.UNDERGROUND_ORES,
  5. Feature.ORE.configure(
  6. new OreFeatureConfig(
  7. OreFeatureConfig.Target.NATURAL_STONE,
  8. Blocks.NETHER_QUARTZ_ORE.getDefaultState(),
  9. 8 //Ore vein size
  10. )).createDecoratedFeature(
  11. Decorator.COUNT_RANGE.configure(new RangeDecoratorConfig(
  12. 8, //Number of veins per chunk
  13. 0, //Bottom Offset
  14. 0, //Min y level
  15. 64 //Max y level
  16. ))));
  17. }
  18. }

This method adds your ore to the overworld, with the provided spawn settings. Feel free to change the values to suit your mod.

Iterating Biome Registry

What we need to do next is process all biomes that have been registered as well as all biomes that will be registered in the future (as added by other mods). We first iterate over the current registry, then register a listener that will be called for future additions.

  1. @Override
  2. public void onInitialize() {
  3. //Loop over existing biomes
  4. Registry.BIOME.forEach(this::handleBiome);
  6. //Listen for other biomes being registered
  7. RegistryEntryAddedCallback.event(Registry.BIOME).register((i, identifier, biome) -> handleBiome(biome));
  8. }


You should see quartz ore spawning in the overworld:

Quartz Ores

tutorial/ores.txt · Last modified: 2020/02/26 15:23 by supercoder79