2015-01-05 22:14:01 +01:00
|
|
|
package ellpeck.someprettytechystuff.gen;
|
2014-11-10 16:47:04 +01:00
|
|
|
|
|
|
|
import cpw.mods.fml.common.IWorldGenerator;
|
2014-12-18 19:24:06 +01:00
|
|
|
import cpw.mods.fml.common.registry.GameRegistry;
|
2015-01-05 22:14:01 +01:00
|
|
|
import ellpeck.someprettytechystuff.blocks.InitBlocks;
|
|
|
|
import ellpeck.someprettytechystuff.util.Util;
|
2014-11-10 16:47:04 +01:00
|
|
|
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 java.util.Random;
|
|
|
|
|
|
|
|
public class OreGen implements IWorldGenerator {
|
|
|
|
|
|
|
|
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider){
|
|
|
|
switch (world.provider.dimensionId){
|
|
|
|
case -1:
|
2014-11-19 18:01:44 +01:00
|
|
|
generateNether(world, random, chunkX*16, chunkZ*16);
|
2014-11-10 16:47:04 +01:00
|
|
|
case 0:
|
2014-11-19 18:01:44 +01:00
|
|
|
generateSurface(world, random, chunkX*16, chunkZ*16);
|
2014-11-10 16:47:04 +01:00
|
|
|
case 1:
|
2014-11-19 18:01:44 +01:00
|
|
|
generateEnd(world, random, chunkX*16, chunkZ*16);
|
2014-11-10 16:47:04 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@SuppressWarnings("unused")
|
|
|
|
private void generateEnd(World world, Random random, int x, int z){
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void generateSurface(World world, Random random, int x, int z){
|
2014-12-03 21:55:53 +01:00
|
|
|
for(int i = 0; i < Util.gemList.size(); i++) {
|
|
|
|
this.addOreSpawn(InitBlocks.oreGem, i, Blocks.stone, world, random, x, z, 4 + random.nextInt(3), 6, 1, 70);
|
2014-11-10 16:47:04 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@SuppressWarnings("unused")
|
|
|
|
private void generateNether(World world, Random random, int x, int z){
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void addOreSpawn(Block block, int meta, Block blockIn, World world, Random random, int blockXPos, int blockZPos, int maxVeinSize, int chancesToSpawn, int minY, int maxY){
|
|
|
|
int yDiff = maxY - minY;
|
|
|
|
for(int i = 0; i < chancesToSpawn; i++){
|
|
|
|
int posX = blockXPos + random.nextInt(16);
|
|
|
|
int posY = minY + random.nextInt(yDiff);
|
|
|
|
int posZ = blockZPos + random.nextInt(16);
|
|
|
|
(new WorldGenMinable(block, meta, maxVeinSize, blockIn)).generate(world, random, posX, posY, posZ);
|
|
|
|
}
|
|
|
|
}
|
2014-12-18 19:24:06 +01:00
|
|
|
|
|
|
|
public static void init(){
|
|
|
|
GameRegistry.registerWorldGenerator(new OreGen(), 0);
|
|
|
|
}
|
2014-11-10 16:47:04 +01:00
|
|
|
}
|