Added Ores to cave worlds.

Not final though.
This commit is contained in:
Ellpeck 2015-12-20 20:53:07 +01:00
parent 2931aad871
commit e77aee70de

View file

@ -18,6 +18,7 @@ import ellpeck.actuallyadditions.config.ConfigValues;
import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util;
import ellpeck.actuallyadditions.world.WorldTypeActAddCaves;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.util.MathHelper;
@ -40,39 +41,42 @@ public class OreGen implements IWorldGenerator{
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider){
if(world.provider.terrainType == WorldType.FLAT){
return;
}
if(Util.arrayContains(ConfigValues.oreGenDimensionBlacklist, world.provider.dimensionId) < 0){
boolean caves = WorldTypeActAddCaves.isActAddCave(world);
if(caves || (world.provider.terrainType != WorldType.FLAT && Util.arrayContains(ConfigValues.oreGenDimensionBlacklist, world.provider.dimensionId) < 0)){
switch(world.provider.dimensionId){
case -1:
generateNether(world, random, chunkX*16, chunkZ*16);
generateNether(world, random, chunkX*16, chunkZ*16, caves);
//case 0:
// generateSurface(world, random, chunkX*16, chunkZ*16);
case 1:
generateEnd(world, random, chunkX*16, chunkZ*16);
generateEnd(world, random, chunkX*16, chunkZ*16, caves);
default:
generateSurface(world, random, chunkX*16, chunkZ*16);
generateSurface(world, random, chunkX*16, chunkZ*16, caves);
}
}
}
@SuppressWarnings("unused")
private void generateNether(World world, Random random, int x, int z){
private void generateNether(World world, Random random, int x, int z, boolean caves){
}
@SuppressWarnings("unused")
private void generateEnd(World world, Random random, int x, int z){
private void generateEnd(World world, Random random, int x, int z, boolean caves){
}
private void generateSurface(World world, Random random, int x, int z){
private void generateSurface(World world, Random random, int x, int z, boolean caves){
if(caves){
this.addOreSpawn(InitBlocks.blockMisc, TheMiscBlocks.ORE_QUARTZ.ordinal(), Blocks.stone, world, random, x, z, MathHelper.getRandomIntegerInRange(random, 8, 12), 12, 0, 256);
this.addOreSpawn(Blocks.iron_ore, 0, Blocks.stone, world, random, x, z, 8, 20, 0, 256);
}
else{
if(ConfigBoolValues.GENERATE_QUARTZ.isEnabled()){
this.addOreSpawn(InitBlocks.blockMisc, TheMiscBlocks.ORE_QUARTZ.ordinal(), Blocks.stone, world, random, x, z, MathHelper.getRandomIntegerInRange(random, 5, 8), 10, QUARTZ_MIN, QUARTZ_MAX);
}
}
}
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){
if(maxY > minY){