User Tools

Site Tools


tutorial:ores

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
tutorial:ores [2019/08/19 19:24] – [Adding ores to a biome] core -> ore jamieswhiteshirttutorial:ores [2019/08/19 19:36] – [Adding ores to a biome] Enhancements jamieswhiteshirt
Line 8: Line 8:
 ==== Adding ores to a biome ==== ==== Adding ores to a biome ====
  
-As we need to handle exiting biomes and biomes being added later on in the loading stage creating a method to handle adding the ore to the biome.+First we need to create a method to process a biome, checking if it is a valid biome then adding the ore.
  
 <code java [enable_line_numbers="true"]> <code java [enable_line_numbers="true"]>
Line 24: Line 24:
                 Decorator.COUNT_RANGE,                 Decorator.COUNT_RANGE,
         new RangeDecoratorConfig(         new RangeDecoratorConfig(
-            8, //Number of veins per chunk +        8, //Number of veins per chunk 
-             0, //Bottom Offset +         0, //Bottom Offset 
-             0, //Min y level +         0, //Min y level 
-             64 //Max y level+         64 //Max y level
         )));         )));
  }  }
Line 37: Line 37:
 ==== Iterating Biome Registry ==== ==== Iterating Biome Registry ====
  
-What we need to do next is loop over the existing biomes (Vanilla's and modded biomes added before your mod loaded) as well as register to the Registry event to ensure that your ore is added to biomes loaded after your mod.+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.
  
 <code java [enable_line_numbers="true"]> <code java [enable_line_numbers="true"]>
Line 43: Line 43:
 public void onInitialize() { public void onInitialize() {
  //Loop over existing biomes  //Loop over existing biomes
- Registry.BIOME.stream().forEach(this::handleBiome);+ Registry.BIOME.forEach(this::handleBiome);
  
  //Listen for other biomes being registered  //Listen for other biomes being registered
tutorial/ores.txt · Last modified: 2023/12/18 01:03 by solidblock