UtilBlock: Modified getInRadius() to allow option of a hollow sphere

This commit is contained in:
libraryaddict 2015-04-03 19:34:24 +13:00
parent 6faf5011a8
commit 05319511ff

View File

@ -304,7 +304,13 @@ public class UtilBlock
return blockList;
}
public static HashMap<Block, Double> getInRadius(Block block, double dR)
{
return getInRadius(block, dR, false);
}
public static HashMap<Block, Double> getInRadius(Block block, double dR, boolean hollow)
{
HashMap<Block, Double> blockList = new HashMap<Block, Double>();
int iR = (int)dR + 1;
@ -317,9 +323,11 @@ public class UtilBlock
double offset = UtilMath.offset(block.getLocation(), curBlock.getLocation());
if (offset <= dR)
if (offset <= dR && !(hollow && offset < dR - 1))
{
blockList.put(curBlock, 1 - (offset / dR));
}
}
return blockList;
}