    001    package cpw.mods.fml.common.modloader;
    002
    003    import java.util.Random;
    004
    005    import net.minecraft.world.World;
    006    import net.minecraft.world.chunk.IChunkProvider;
    007    import net.minecraft.world.gen.ChunkProviderGenerate;
    008    import net.minecraft.world.gen.ChunkProviderHell;
    009
    010    import cpw.mods.fml.common.IWorldGenerator;
    011
    012    public 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    }