* air-reachable blocks (up to 5 blocks away) and return true if breathable air is found
* in one of them, or false if not.
*/
public static boolean testContactWithBreathableAir(World world, Block block, int x, int y, int z, int limitCount)
{
BlockVec3 vec = new BlockVec3(x, y, z);
checked.add(vec);
if (block == GCBlocks.breatheableAir || block == GCBlocks.brightBreatheableAir)
{
return true;
}
if (block.getMaterial() == Material.air)
{
return false;
}
//Test for non-sided permeable or solid blocks first
boolean permeableFlag = false;
if (!(block instanceof BlockLeavesBase))
{
if (block.isOpaqueCube())
{
if (block instanceof BlockGravel || block.getMaterial() == Material.cloth || block instanceof BlockSponge)
{
permeableFlag = true;
}
else
{
return false;
}
}
else if (block instanceof BlockGlass || block instanceof BlockStainedGlass)
{
return false;
}
else if (block instanceof BlockLiquid)
{
return false;
}
else if (OxygenPressureProtocol.nonPermeableBlocks.containsKey(block))
{
ArrayList<Integer> metaList = OxygenPressureProtocol.nonPermeableBlocks.get(block);
if (metaList.contains(Integer.valueOf(-1)) || metaList.contains(world.getBlockMetadata(x, y, z)))
{
return false;
}
}
}
else
{
permeableFlag = true;
}
//Testing a non-air, permeable block (for example a torch or a ladder)
if (limitCount < 5)
{
for (int side = 0; side < 6; side++)
{
if (permeableFlag || OxygenUtil.canBlockPassAirOnSide(world, block, vec, side))
{
BlockVec3 sidevec = vec.newVecSide(side);
if (!checked.contains(sidevec))
{
Block newblock = sidevec.getBlockID_noChunkLoad(world);
if (OxygenUtil.testContactWithBreathableAir(world, newblock, sidevec.x, sidevec.y, sidevec.z, limitCount + 1))
{
return true;
}
}