001package net.minecraftforge.event.terraingen;
002
003import java.util.Random;
004
005import net.minecraft.world.World;
006import net.minecraft.world.chunk.IChunkProvider;
007import net.minecraftforge.event.world.*;
008
009public class PopulateChunkEvent extends ChunkProviderEvent
010{
011    public final World world;
012    public final Random rand;
013    public final int chunkX;
014    public final int chunkZ;
015    public final boolean hasVillageGenerated;
016    
017    public PopulateChunkEvent(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated)
018    {
019        super(chunkProvider);
020        this.world = world;
021        this.rand = rand;
022        this.chunkX = chunkX;
023        this.chunkZ = chunkZ;
024        this.hasVillageGenerated = hasVillageGenerated;
025    }
026    
027    public static class Pre extends PopulateChunkEvent
028    {
029        public Pre(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated)
030        {
031            super(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated);
032        }
033    }
034    
035    public static class Post extends PopulateChunkEvent
036    {
037        public Post(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated)
038        {
039            super(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated);
040        }
041    }
042    
043    /**
044     * This event is fired when a chunk is populated with a terrain feature.
045     * 
046     * You can set the result to DENY to prevent the default generation
047     * of a terrain feature.
048     */
049    @HasResult
050    public static class Populate extends PopulateChunkEvent
051    {
052        /** Use CUSTOM to filter custom event types
053         */
054        public static enum EventType { DUNGEON, FIRE, GLOWSTONE, ICE, LAKE, LAVA, NETHER_LAVA, CUSTOM }
055        
056        public final EventType type;
057
058        public Populate(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated, EventType type)
059        {
060            super(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated);
061            this.type = type;
062        }
063    }
064}