    001/*
    002 * Forge Mod Loader
    003 * Copyright (c) 2012-2013 cpw.
    004 * All rights reserved. This program and the accompanying materials
    005 * are made available under the terms of the GNU Lesser Public License v2.1
    006 * which accompanies this distribution, and is available at
    007 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    008 *
    009 * Contributors:
    010 *     cpw - implementation
    011 */
    012
    013package cpw.mods.fml.common.modloader;
    014
    015import java.util.Random;
    016
    017import net.minecraft.world.World;
    018import net.minecraft.world.chunk.IChunkProvider;
    019import net.minecraft.world.gen.ChunkProviderGenerate;
    020import net.minecraft.world.gen.ChunkProviderHell;
    021
    022import cpw.mods.fml.common.IWorldGenerator;
    023
    024public class ModLoaderWorldGenerator implements IWorldGenerator
    025{
    026    private BaseModProxy mod;
    027
    028    public ModLoaderWorldGenerator(BaseModProxy mod)
    029    {
    030        this.mod = mod;
    031    }
    032
    033    @Override
    034    public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
    035    {
    036        if (chunkGenerator instanceof ChunkProviderGenerate)
    037        {
    038            mod.generateSurface(world, random, chunkX << 4, chunkZ << 4);
    039        }
    040        else if (chunkGenerator instanceof ChunkProviderHell)
    041        {
    042            mod.generateNether(world, random, chunkX << 4, chunkZ << 4);
    043        }
    044    }
    045}