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