package tchestplate;
import cpw.mods.fml.common.IWorldGenerator;
import java.util.Random;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
public class WorldgeneratorOre implements IWorldGenerator {
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
switch(world.provider.dimensionId) {
case -1:
this.generateNether(world, random, chunkX * 16, chunkZ * 16);
case 0:
this.generateSurface(world, random, chunkX * 16, chunkZ * 16);
case 1:
this.generateEnd(world, random, chunkX * 16, chunkZ * 16);
default:
}
}
private void generateEnd(World world, Random random, int chunkX, int chunkZ) {
}
private void generateSurface(World world, Random random, int chunkX, int chunkZ) {
this.genOre(world, random, chunkX, chunkZ, LavaChestPlate.ferromolibdeniumOre.blockID, 1, 1, 5, 3);
this.genOre(world, random, chunkX, chunkZ, LavaChestPlate.stelliteOre.blockID, 2, 10, 20, 5);
this.genOre(world, random, chunkX, chunkZ, LavaChestPlate.chromelOre.blockID, 3, 25, 40, 10);
this.genOre(world, random, chunkX, chunkZ, LavaChestPlate.duraluminiumOre.blockID, 4, 30, 50, 20);
this.genOre(world, random, chunkX, chunkZ, LavaChestPlate.cobaltOre.blockID, 5, 35, 50, 25);
this.genOre(world, random, chunkX, chunkZ, LavaChestPlate.cobaltOre.blockID, 5, 35, 50, 25);
this.genOre1(world, random, chunkX, chunkZ, LavaChestPlate.cobaltOre.blockID);
}
private void genOre(World world, Random random, int chunkX, int chunkZ, int BlockID, int BlockSum, int Min, int Max, int count) {
int rY = 1;
for(int i = 0; i < random.nextInt(count); ++i) {
int randPosX = chunkX + random.nextInt(16);
int randPosZ = chunkZ + random.nextInt(16);
(new WorldGenMinable(BlockID, BlockSum)).generate(world, random, randPosX, rY, randPosZ);
}
}
private void genOre2(World world, Random random, int chunkX, int chunkZ, int BlockID, int count) {
int y = -1;
int x = chunkX + random.nextInt(16);
int z = chunkZ + random.nextInt(16);
for(int i = 256; i > 0; i--){
if(world.isAirBlock(x, i, z) && !world.isAirBlock(x, i - 1, z)){
y = i;
break;
}
}
if(y != -1){
(new WorldGenMinable(BlockID, 1)).generate(world, random, x, y, z);
}
}
private void genOre1(World world, Random random, int chunkX, int chunkZ, int BlockID) {
int x = chunkX + random.nextInt(16);
int z = chunkZ + random.nextInt(16);
int y = -1;
for(int i = 256; i > 0; i--){
if(world.isAirBlock(x, i, z) && !world.isAirBlock(x, i - 1, z)){
y = i;
break;
}
}
// Генерим руду
if(y != -1){
world.setBlock(BlockID, x, y, z);
}
}
private void generateNether(World world, Random random, int chunkX, int chunkZ) {
}
}