Game_Spriter

EventHandlerBackup.java

Oct 28th, 2020 (edited)
2,321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.68 KB | None | 0 0
  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.block.BlockState;
  6. import net.minecraft.util.ResourceLocation;
  7. import net.minecraft.util.registry.Registry;
  8. import net.minecraft.util.registry.WorldGenRegistries;
  9. import net.minecraft.world.biome.Biome;
  10. import net.minecraft.world.gen.GenerationStage;
  11. import net.minecraft.world.gen.feature.ConfiguredFeature;
  12. import net.minecraft.world.gen.feature.Feature;
  13. import net.minecraft.world.gen.feature.OreFeatureConfig;
  14. import net.minecraft.world.gen.placement.Placement;
  15. import net.minecraft.world.gen.placement.TopSolidRangeConfig;
  16. import net.minecraftforge.event.world.BiomeLoadingEvent;
  17. import net.minecraftforge.eventbus.api.SubscribeEvent;
  18. import net.minecraftforge.fml.common.Mod;
  19. import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
  20.  
  21. @Mod.EventBusSubscriber
  22. public class EventHandler {
  23.    
  24.     private static ConfiguredFeature<?, ?> TAMMETHYST_ORE;
  25.    
  26.     @SubscribeEvent
  27.     public static void registerConfiguredFeatures(final FMLCommonSetupEvent event) {
  28.         TAMMETHYST_ORE = register(RegistryHandler.TAMMETHYST_ORE.getId(), getConfig(RegistryHandler.TAMMETHYST_ORE.get().getDefaultState(), 8, 128, 20, 10));
  29.     }
  30.    
  31.     @SubscribeEvent
  32.     public static void biomeLoad(BiomeLoadingEvent event) {
  33.         if(event.getCategory() == Biome.Category.NETHER) {
  34.             //Nether Generation
  35.            
  36.         } else if (event.getCategory() == Biome.Category.THEEND) {
  37.             //End Generation
  38.            
  39.         } else {
  40.             //Overworld Generation
  41.             event.getGeneration().withFeature(GenerationStage.Decoration.UNDERGROUND_ORES, TAMMETHYST_ORE);
  42.         }
  43.     }
  44.    
  45.     private static ConfiguredFeature<?, ?> register(ResourceLocation location, ConfiguredFeature<?, ?> feature) {
  46.         Registry<ConfiguredFeature<?, ?>> registry = WorldGenRegistries.CONFIGURED_FEATURE;
  47.         return Registry.register(registry, location, feature);
  48.     }
  49.    
  50.     private static ConfiguredFeature<?, ?> getConfig(BlockState blockState, int veinSize, int maxHeight, int minHeight, int veinsPerChunk) {
  51.         ConfiguredFeature<?, ?> cf = Feature.ORE.withConfiguration(
  52.             new OreFeatureConfig(
  53.                 OreFeatureConfig.FillerBlockType.BASE_STONE_OVERWORLD,
  54.                     blockState,
  55.                     veinSize
  56.             )
  57.         )
  58.         .withPlacement(Placement.RANGE.configure(new TopSolidRangeConfig(minHeight, 0, maxHeight)))
  59.         .square()
  60.         .func_242731_b(veinsPerChunk)
  61.         ;
  62.         return cf;
  63.     }
  64.    
  65. }
Add Comment
Please, Sign In to add comment