    001package net.minecraftforge.event.terraingen;
    002
    003import java.util.Random;
    004
    005import net.minecraft.world.World;
    006import net.minecraft.world.chunk.IChunkProvider;
    007import net.minecraft.world.gen.MapGenBase;
    008import net.minecraft.world.gen.NoiseGeneratorOctaves;
    009import net.minecraft.world.gen.feature.WorldGenerator;
    010import net.minecraftforge.common.*;
    011import net.minecraftforge.event.Event.*;
    012import net.minecraftforge.event.terraingen.DecorateBiomeEvent.*;
    013import net.minecraftforge.event.terraingen.OreGenEvent.*;
    014import net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.*;
    015import net.minecraftforge.event.terraingen.PopulateChunkEvent.*;
    016
    017public 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}