LukeGraham

Forge 1.16.3 Ore Gen

Jan 1st, 2021 (edited)
1,809
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.44 KB | None | 0 0
  1. // Working ore generation in forge 1.16.3!
  2. // To get this to work, add this to the constructor of your mod's main class:
  3. // MinecraftForge.EVENT_BUS.addListener(EventPriority.HIGH, OreGen::addFeaturesToBiomes).
  4.  
  5. public class OreGen {
  6.     public static void addFeaturesToBiomes(BiomeLoadingEvent event) {
  7.         // this will add to every biome in the overworld
  8.         if (!event.getCategory().equals(Biome.Category.NETHER) && !event.getCategory().equals(Biome.Category.THEEND)) {
  9.             addOreToBiome(event.getGeneration(), BlockInit.SMILE_BLOCK.get(), 60, 10, 6, 20);
  10.         }
  11.     }
  12.  
  13.     private static void addOreToBiome(BiomeGenerationSettingsBuilder biomeGenSettings, Block oreBlock, int maxHeight, int minHeight, int veinSize, int veinsPerChunk){
  14.         // mappings weirdness (if some fields don't exist for you):
  15.         // field_241882_a should be BASE_STONE_OVERWORLD
  16.         // field_242907_l should be RANGE
  17.  
  18.         ConfiguredFeature<?, ?> feature = Feature.ORE.withConfiguration(
  19.                 new OreFeatureConfig(
  20.                         OreFeatureConfig.FillerBlockType.field_241882_a,
  21.                         oreBlock.getDefaultState(),
  22.                         veinSize))
  23.                 .withPlacement(Placement.field_242907_l.configure(new TopSolidRangeConfig(minHeight, 0, maxHeight))).func_242731_b(veinsPerChunk);
  24.  
  25.         biomeGenSettings.getFeatures(GenerationStage.Decoration.UNDERGROUND_ORES).add(() -> feature);
  26.     }
  27. }
  28.  
Add Comment
Please, Sign In to add comment