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