Advertisement
Guest User

Untitled

a guest
Oct 11th, 2020
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. package com.ds.projectdawn.world.gen;
  2.  
  3. import com.ds.projectdawn.ProjectDawn;
  4. import com.ds.projectdawn.lists.BlockList;
  5. import net.minecraft.block.BlockState;
  6. import net.minecraft.world.biome.Biome;
  7. import net.minecraft.world.gen.GenerationStage;
  8. import net.minecraft.world.gen.feature.Feature;
  9. import net.minecraft.world.gen.feature.OreFeatureConfig;
  10. import net.minecraft.world.gen.placement.ConfiguredPlacement;
  11. import net.minecraft.world.gen.placement.CountRangeConfig;
  12. import net.minecraft.world.gen.placement.Placement;
  13. import net.minecraftforge.eventbus.api.SubscribeEvent;
  14. import net.minecraftforge.fml.common.Mod;
  15. import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent;
  16. import net.minecraftforge.registries.ForgeRegistries;
  17.  
  18. @Mod.EventBusSubscriber(modid = ProjectDawn.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) //this creates the crash without it ore doesn't spawn tho
  19. public class WorldGeneration
  20. {
  21.  
  22.  
  23. @SubscribeEvent
  24. private static void setUpOreGeneration(FMLLoadCompleteEvent event)
  25. {
  26. for(Biome biome : ForgeRegistries.BIOMES)
  27. {
  28. //Nether Gen
  29. if(biome.getCategory() == Biome.Category.NETHER)
  30. {
  31.  
  32. }
  33. //End Gen
  34. else if(biome.getCategory() == Biome.Category.THEEND)
  35. {
  36.  
  37. }
  38. //Overworld Gen
  39. else
  40. { //50 - 18 = 32 wich is the highest y layer it can spawn in
  41. genOre(biome, 15, 0, 18, 50, OreFeatureConfig.FillerBlockType.NATURAL_STONE, BlockList.RUBY_ORE.get().getDefaultState(), 6);
  42. }
  43. }
  44. }
  45.  
  46. private static void genOre(Biome biome, int count, int bottomOffset, int topOffset, int max, OreFeatureConfig.FillerBlockType filler, BlockState defaultBlockState, int size)
  47. {
  48. CountRangeConfig range = new CountRangeConfig(count, bottomOffset, topOffset, max);
  49. OreFeatureConfig feature = new OreFeatureConfig(filler, defaultBlockState, size);
  50. ConfiguredPlacement config = Placement.COUNT_RANGE.configure(range);
  51.  
  52. biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.ORE.withConfiguration(feature).withPlacement(config));
  53. }
  54. }
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement