001    package net.minecraftforge.event.terraingen;
002    
003    import java.util.Random;
004    
005    import net.minecraft.src.*;
006    import net.minecraftforge.event.*;
007    
008    public class OreGenEvent extends Event
009    {
010        public final World world;
011        public final Random rand;
012        public final int worldX;
013        public final int worldZ;
014        
015        public OreGenEvent(World world, Random rand, int worldX, int worldZ)
016        {
017            this.world = world;
018            this.rand = rand;
019            this.worldX = worldX;
020            this.worldZ = worldZ;
021        }
022        
023        public static class Pre extends OreGenEvent
024        {
025            public Pre(World world, Random rand, int worldX, int worldZ)
026            {
027                super(world, rand, worldX, worldZ);
028            }
029        }
030        
031        public static class Post extends OreGenEvent
032        {
033            public Post(World world, Random rand, int worldX, int worldZ)
034            {
035                super(world, rand, worldX, worldZ);
036            }
037        }
038        
039        /**
040         * This event is fired when an ore is generated in a chunk.
041         * 
042         * You can set the result to DENY to prevent the default ore generation.
043         */
044        @HasResult
045        public static class GenerateMinable extends OreGenEvent
046        {
047            public static enum EventType { COAL, DIAMOND, DIRT, GOLD, GRAVEL, IRON, LAPIS, REDSTONE, CUSTOM }
048            
049            public final EventType type;
050            public final WorldGenerator generator;
051            
052            public GenerateMinable(World world, Random rand, WorldGenerator generator, int worldX, int worldZ, EventType type)
053            {
054                super(world, rand, worldX, worldZ);
055                this.generator = generator;
056                this.type = type;
057            }
058        }
059    }