package com.alloys.world;
import java.util.Random;
import com.alloys.tile.ModBlocks;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import cpw.mods.fml.common.IWorldGenerator;
public class WorldGen implements IWorldGenerator {
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
genNormal(world, random, chunkX * 16, chunkZ * 16);
}
private void genNormal(World world, Random rand, int x, int z) {
this.addOre(ModBlocks.corundum_ore_gre, world, rand, x, z, 10, 100, 100, 5, 30);
}
public void addOre(Block block, World world, Random random, int blockXPos, int blockZPos, int veinM, int veinX, int chancesToSpawn, int minY, int maxY )
{
for(int i = 0; i < chancesToSpawn; i++)
{
int posX = blockXPos + random.nextInt(16);
int posY = minY + random.nextInt(maxY - minY);
int posZ = blockZPos + random.nextInt(16);
(new WorldGenMinable(block, (veinM + random.nextInt(veinX - veinM)))).generate(world, random, posX, posY, posZ);
}
}
}