Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.gamespriter.runictechnology.world.gen;
- import com.gamespriter.runictechnology.RunicTechnology;
- import com.gamespriter.runictechnology.util.RegistryHandler;
- import net.minecraft.block.BlockState;
- import net.minecraft.util.ResourceLocation;
- import net.minecraft.util.registry.Registry;
- import net.minecraft.util.registry.WorldGenRegistries;
- import net.minecraft.world.biome.Biome;
- import net.minecraft.world.gen.GenerationStage;
- import net.minecraft.world.gen.feature.ConfiguredFeature;
- import net.minecraft.world.gen.feature.Feature;
- import net.minecraft.world.gen.feature.OreFeatureConfig;
- import net.minecraft.world.gen.placement.Placement;
- import net.minecraft.world.gen.placement.TopSolidRangeConfig;
- import net.minecraftforge.event.world.BiomeLoadingEvent;
- import net.minecraftforge.eventbus.api.SubscribeEvent;
- import net.minecraftforge.fml.common.Mod;
- import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
- @Mod.EventBusSubscriber
- public class EventHandler {
- private static ConfiguredFeature<?, ?> TAMMETHYST_ORE;
- @SubscribeEvent
- public static void registerConfiguredFeatures(final FMLCommonSetupEvent event) {
- TAMMETHYST_ORE = register(RegistryHandler.TAMMETHYST_ORE.getId(), getConfig(RegistryHandler.TAMMETHYST_ORE.get().getDefaultState(), 8, 128, 20, 10));
- }
- @SubscribeEvent
- public static void biomeLoad(BiomeLoadingEvent event) {
- if(event.getCategory() == Biome.Category.NETHER) {
- //Nether Generation
- } else if (event.getCategory() == Biome.Category.THEEND) {
- //End Generation
- } else {
- //Overworld Generation
- event.getGeneration().withFeature(GenerationStage.Decoration.UNDERGROUND_ORES, TAMMETHYST_ORE);
- }
- }
- private static ConfiguredFeature<?, ?> register(ResourceLocation location, ConfiguredFeature<?, ?> feature) {
- Registry<ConfiguredFeature<?, ?>> registry = WorldGenRegistries.CONFIGURED_FEATURE;
- return Registry.register(registry, location, feature);
- }
- private static ConfiguredFeature<?, ?> getConfig(BlockState blockState, int veinSize, int maxHeight, int minHeight, int veinsPerChunk) {
- ConfiguredFeature<?, ?> cf = Feature.ORE.withConfiguration(
- new OreFeatureConfig(
- OreFeatureConfig.FillerBlockType.BASE_STONE_OVERWORLD,
- blockState,
- veinSize
- )
- )
- .withPlacement(Placement.RANGE.configure(new TopSolidRangeConfig(minHeight, 0, maxHeight)))
- .square()
- .func_242731_b(veinsPerChunk)
- ;
- return cf;
- }
- }
Add Comment
Please, Sign In to add comment