    001package cpw.mods.fml.common.modloader;
    002
    003import java.util.Random;
    004
    005import net.minecraft.world.World;
    006import net.minecraft.world.chunk.IChunkProvider;
    007import net.minecraft.world.gen.ChunkProviderGenerate;
    008import net.minecraft.world.gen.ChunkProviderHell;
    009
    010import cpw.mods.fml.common.IWorldGenerator;
    011
    012public class ModLoaderWorldGenerator implements IWorldGenerator
    013{
    014    private BaseModProxy mod;
    015
    016    public ModLoaderWorldGenerator(BaseModProxy mod)
    017    {
    018        this.mod = mod;
    019    }
    020
    021    @Override
    022    public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
    023    {
    024        if (chunkGenerator instanceof ChunkProviderGenerate)
    025        {
    026            mod.generateSurface(world, random, chunkX << 4, chunkZ << 4);
    027        }
    028        else if (chunkGenerator instanceof ChunkProviderHell)
    029        {
    030            mod.generateNether(world, random, chunkX << 4, chunkZ << 4);
    031        }
    032    }
    033}