Game_Spriter

EventHandlerPost.java

Oct 30th, 2020
733
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.gamespriter.runictechnology.world.gen;
  2.  
  3. import com.gamespriter.runictechnology.RunicTechnology;
  4. import com.gamespriter.runictechnology.util.RegistryHandler;
  5. import net.minecraft.util.ResourceLocation;
  6. import net.minecraft.util.registry.Registry;
  7. import net.minecraft.util.registry.WorldGenRegistries;
  8. import net.minecraft.world.biome.Biome;
  9. import net.minecraft.world.gen.GenerationStage;
  10. import net.minecraft.world.gen.feature.ConfiguredFeature;
  11. import net.minecraft.world.gen.feature.Feature;
  12. import net.minecraft.world.gen.feature.OreFeatureConfig;
  13. import net.minecraft.world.gen.placement.Placement;
  14. import net.minecraft.world.gen.placement.TopSolidRangeConfig;
  15. import net.minecraftforge.event.world.BiomeLoadingEvent;
  16. import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
  17.  
  18. public class EventHandler {
  19.    
  20.     private static ConfiguredFeature<?, ?> TAMMETHYST_ORE;
  21.     private static int to_veinSize = 8;
  22.     private static int to_minHeight = 20;
  23.     private static int to_maxHeight = 128;
  24.     private static int to_veinsPerChunk = 10;
  25.    
  26.     public static void registerConfiguredFeatures(FMLCommonSetupEvent event) {
  27.         Registry<ConfiguredFeature<?, ?>> registry = WorldGenRegistries.CONFIGURED_FEATURE;
  28.        
  29.         TAMMETHYST_ORE = Feature.ORE.withConfiguration(
  30.             new OreFeatureConfig(
  31.                 OreFeatureConfig.FillerBlockType.BASE_STONE_OVERWORLD,
  32.                 RegistryHandler.TAMMETHYST_ORE.get().getDefaultState(),
  33.                 to_veinSize
  34.             )
  35.         )
  36.             .withPlacement(Placement.RANGE.configure(new TopSolidRangeConfig(to_minHeight, 0, to_maxHeight)))
  37.             .square()
  38.             .func_242731_b(to_veinsPerChunk)
  39.         ;
  40.        
  41.         Registry.register(registry, new ResourceLocation(RunicTechnology.MOD_ID, "tammethyst_ore"), TAMMETHYST_ORE);
  42.     }
  43.    
  44.     public static void biomeLoad(BiomeLoadingEvent event) {
  45.         if(event.getCategory() == Biome.Category.NETHER) {
  46.             //Nether Generation
  47.            
  48.         } else if (event.getCategory() == Biome.Category.THEEND) {
  49.             //End Generation
  50.            
  51.         } else {
  52.             //Overworld Generation
  53.             event.getGeneration().withFeature(GenerationStage.Decoration.UNDERGROUND_ORES, TAMMETHYST_ORE);
  54.         }
  55.     }
  56.    
  57. }
RAW Paste Data