Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.ds.projectdawn.world.gen;
- import com.ds.projectdawn.ProjectDawn;
- import com.ds.projectdawn.lists.BlockList;
- import net.minecraft.block.BlockState;
- import net.minecraft.world.biome.Biome;
- import net.minecraft.world.gen.GenerationStage;
- import net.minecraft.world.gen.feature.Feature;
- import net.minecraft.world.gen.feature.OreFeatureConfig;
- import net.minecraft.world.gen.placement.ConfiguredPlacement;
- import net.minecraft.world.gen.placement.CountRangeConfig;
- import net.minecraft.world.gen.placement.Placement;
- import net.minecraftforge.eventbus.api.SubscribeEvent;
- import net.minecraftforge.fml.common.Mod;
- import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent;
- import net.minecraftforge.registries.ForgeRegistries;
- @Mod.EventBusSubscriber(modid = ProjectDawn.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) //this creates the crash without it ore doesn't spawn tho
- public class WorldGeneration
- {
- @SubscribeEvent
- private static void setUpOreGeneration(FMLLoadCompleteEvent event)
- {
- for(Biome biome : ForgeRegistries.BIOMES)
- {
- //Nether Gen
- if(biome.getCategory() == Biome.Category.NETHER)
- {
- }
- //End Gen
- else if(biome.getCategory() == Biome.Category.THEEND)
- {
- }
- //Overworld Gen
- else
- { //50 - 18 = 32 wich is the highest y layer it can spawn in
- genOre(biome, 15, 0, 18, 50, OreFeatureConfig.FillerBlockType.NATURAL_STONE, BlockList.RUBY_ORE.get().getDefaultState(), 6);
- }
- }
- }
- private static void genOre(Biome biome, int count, int bottomOffset, int topOffset, int max, OreFeatureConfig.FillerBlockType filler, BlockState defaultBlockState, int size)
- {
- CountRangeConfig range = new CountRangeConfig(count, bottomOffset, topOffset, max);
- OreFeatureConfig feature = new OreFeatureConfig(filler, defaultBlockState, size);
- ConfiguredPlacement config = Placement.COUNT_RANGE.configure(range);
- biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.ORE.withConfiguration(feature).withPlacement(config));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement