fix air checks in oil generation

This commit is contained in:
asiekierka 2014-10-30 09:41:11 +01:00
parent 11e8c06564
commit bf9bfc5c50
3 changed files with 6 additions and 17 deletions

View file

@ -97,7 +97,6 @@ public class BuildCraftEnergy extends BuildCraftMod {
public static Block blockOil; public static Block blockOil;
public static Block blockFuel; public static Block blockFuel;
public static Block blockRedPlasma; public static Block blockRedPlasma;
public static Block blockEnergyConverter;
public static Item bucketOil; public static Item bucketOil;
public static Item bucketFuel; public static Item bucketFuel;
public static Item bucketRedPlasma; public static Item bucketRedPlasma;
@ -366,12 +365,6 @@ public class BuildCraftEnergy extends BuildCraftMod {
CoreProxy.proxy.addCraftingRecipe(new ItemStack(engineBlock, 1, 2), CoreProxy.proxy.addCraftingRecipe(new ItemStack(engineBlock, 1, 2),
"www", " g ", "GpG", 'w', Items.iron_ingot, "www", " g ", "GpG", 'w', Items.iron_ingot,
'g', Blocks.glass, 'G', BuildCraftCore.ironGearItem, 'p', Blocks.piston); 'g', Blocks.glass, 'G', BuildCraftCore.ironGearItem, 'p', Blocks.piston);
if (blockEnergyConverter != null) {
CoreProxy.proxy.addCraftingRecipe(new ItemStack(blockEnergyConverter, 1), "rcr", "sgs", "rcr",
'r', Items.redstone, 'c', BuildCraftTransport.pipePowerCobblestone,
's', BuildCraftTransport.pipePowerStone, 'g', Blocks.glass);
}
} }
private int findUnusedBiomeID(String biomeName) { private int findUnusedBiomeID(String biomeName) {

View file

@ -48,11 +48,7 @@ public final class BlockUtil {
public static List<ItemStack> getItemStackFromBlock(WorldServer world, int i, int j, int k) { public static List<ItemStack> getItemStackFromBlock(WorldServer world, int i, int j, int k) {
Block block = world.getBlock(i, j, k); Block block = world.getBlock(i, j, k);
if (block == null) { if (block == null || block.isAir(world, i, j, k)) {
return null;
}
if (block.isAir(world, i, j, k)) {
return null; return null;
} }

View file

@ -267,11 +267,11 @@ public final class OilPopulate {
} }
private boolean isReplaceableForLake(World world, BiomeGenBase biome, int x, int y, int z) { private boolean isReplaceableForLake(World world, BiomeGenBase biome, int x, int y, int z) {
Block block = world.getBlock(x, y, z); if (world.isAirBlock(x, y, z)) {
if (block == null) {
return true; return true;
} }
Block block = world.getBlock(x, y, z);
if (block == biome.fillerBlock || block == biome.topBlock) { if (block == biome.fillerBlock || block == biome.topBlock) {
return true; return true;
@ -311,7 +311,7 @@ public final class OilPopulate {
} }
private void setOilWithProba(World world, BiomeGenBase biome, Random rand, float proba, int x, int y, int z, int depth) { private void setOilWithProba(World world, BiomeGenBase biome, Random rand, float proba, int x, int y, int z, int depth) {
if (rand.nextFloat() <= proba && world.getBlock(x, y - depth - 1, z) != null) { if (rand.nextFloat() <= proba && !world.isAirBlock(x, y - depth - 1, z)) {
if (isOilAdjacent(world, x, y, z)) { if (isOilAdjacent(world, x, y, z)) {
setOilColumnForLake(world, biome, x, y, z, depth, 3); setOilColumnForLake(world, biome, x, y, z, depth, 3);
} }
@ -351,7 +351,7 @@ public final class OilPopulate {
for (; y > 0; --y) { for (; y > 0; --y) {
Block block = chunk.getBlock(trimmedX, y, trimmedZ); Block block = chunk.getBlock(trimmedX, y, trimmedZ);
if (block == null) { if (block.isAir(world, x, y, z)) {
continue; continue;
} }