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