    001    package net.minecraftforge.event.terraingen;
    002
    003    import java.util.Random;
    004
    005    import net.minecraft.world.World;
    006    import net.minecraft.world.chunk.IChunkProvider;
    007    import net.minecraft.world.gen.MapGenBase;
    008    import net.minecraft.world.gen.NoiseGeneratorOctaves;
    009    import net.minecraft.world.gen.feature.WorldGenerator;
    010    import net.minecraftforge.common.*;
    011    import net.minecraftforge.event.Event.*;
    012    import net.minecraftforge.event.terraingen.DecorateBiomeEvent.*;
    013    import net.minecraftforge.event.terraingen.OreGenEvent.*;
    014    import net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.*;
    015    import net.minecraftforge.event.terraingen.PopulateChunkEvent.*;
    016
    017    public abstract class TerrainGen
    018    {
    019        public static NoiseGeneratorOctaves[] getModdedNoiseGenerators(World world, Random rand, NoiseGeneratorOctaves[] original)
    020        {
    021            InitNoiseGensEvent event = new InitNoiseGensEvent(world, rand, original);
    022            MinecraftForge.TERRAIN_GEN_BUS.post(event);
    023            return event.newNoiseGens;
    024        }
    025
    026        public static MapGenBase getModdedMapGen(MapGenBase original, InitMapGenEvent.EventType type)
    027        {
    028            InitMapGenEvent event = new InitMapGenEvent(type, original);
    029            MinecraftForge.TERRAIN_GEN_BUS.post(event);
    030            return event.newGen;
    031        }
    032
    033        public static boolean populate(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated, Populate.EventType type)
    034        {
    035            PopulateChunkEvent.Populate event = new PopulateChunkEvent.Populate(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated, type);
    036            MinecraftForge.TERRAIN_GEN_BUS.post(event);
    037            return event.getResult() != Result.DENY;
    038        }
    039
    040        public static boolean decorate(World world, Random rand, int chunkX, int chunkZ, Decorate.EventType type)
    041        {
    042            Decorate event = new Decorate(world, rand, chunkX, chunkZ, type);
    043            MinecraftForge.TERRAIN_GEN_BUS.post(event);
    044            return event.getResult() != Result.DENY;
    045        }
    046
    047        public static boolean generateOre(World world, Random rand, WorldGenerator generator, int worldX, int worldZ, GenerateMinable.EventType type)
    048        {
    049            GenerateMinable event = new GenerateMinable(world, rand, generator, worldX, worldZ, type);
    050            MinecraftForge.ORE_GEN_BUS.post(event);
    051            return event.getResult() != Result.DENY;
    052        }
    053
    054        public static boolean saplingGrowTree(World world, Random rand, int x, int y, int z)
    055        {
    056            SaplingGrowTreeEvent event = new SaplingGrowTreeEvent(world, rand, x, y, z);
    057            MinecraftForge.TERRAIN_GEN_BUS.post(event);
    058            return event.getResult() != Result.DENY;
    059        }
    060    }