Game_Spriter

EventHandlerReset.java

Oct 30th, 2020
1,783
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.util.RegistryHandler;
  4. import net.minecraft.util.registry.Registry;
  5. import net.minecraft.util.registry.WorldGenRegistries;
  6. import net.minecraft.world.biome.Biome;
  7. import net.minecraft.world.gen.GenerationStage;
  8. import net.minecraft.world.gen.feature.ConfiguredFeature;
  9. import net.minecraft.world.gen.feature.Feature;
  10. import net.minecraft.world.gen.feature.OreFeatureConfig;
  11. import net.minecraft.world.gen.placement.Placement;
  12. import net.minecraft.world.gen.placement.TopSolidRangeConfig;
  13. import net.minecraftforge.event.world.BiomeLoadingEvent;
  14.  
  15. //@Mod.EventBusSubscriber
  16. public class EventHandler {
  17.    
  18.     private static ConfiguredFeature<?, ?> TAMMETHYST_ORE = register(
  19.             "tammethyst_ore",
  20.             Feature.ORE.withConfiguration(
  21.                     new OreFeatureConfig(
  22.                             OreFeatureConfig.FillerBlockType.BASE_STONE_OVERWORLD,
  23.                             RegistryHandler.TAMMETHYST_ORE.get().getDefaultState(),
  24.                             4
  25.                     )
  26.             )
  27.             .withPlacement(
  28.                     Placement.RANGE.configure(
  29.                             new TopSolidRangeConfig(20, 0, 128) //Min, zero, Max
  30.                     )
  31.             )
  32.             .square()
  33.             .func_242731_b(10)
  34.     );
  35.    
  36.     //@SubscribeEvent
  37.     public static void biomeLoad(BiomeLoadingEvent event) {
  38.         if(event.getCategory() == Biome.Category.NETHER) {
  39.             //Nether Generation
  40.            
  41.         } else if (event.getCategory() == Biome.Category.THEEND) {
  42.             //End Generation
  43.            
  44.         } else {
  45.             //Overworld Generation
  46.             event.getGeneration().withFeature(GenerationStage.Decoration.UNDERGROUND_ORES, TAMMETHYST_ORE);
  47.         }
  48.     }
  49.    
  50.     private static ConfiguredFeature<?, ?> register(String name, ConfiguredFeature<?, ?> feature) {
  51.         return Registry.register(WorldGenRegistries.CONFIGURED_FEATURE, name, feature);
  52.     }
  53.    
  54. }
RAW Paste Data