UtilBlock: Modified getInRadius() to allow option of a hollow sphere
This commit is contained in:
parent
6faf5011a8
commit
05319511ff
@ -304,7 +304,13 @@ public class UtilBlock
|
|||||||
return blockList;
|
return blockList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static HashMap<Block, Double> getInRadius(Block block, double dR)
|
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>();
|
HashMap<Block, Double> blockList = new HashMap<Block, Double>();
|
||||||
int iR = (int)dR + 1;
|
int iR = (int)dR + 1;
|
||||||
@ -317,8 +323,10 @@ public class UtilBlock
|
|||||||
|
|
||||||
double offset = UtilMath.offset(block.getLocation(), curBlock.getLocation());
|
double offset = UtilMath.offset(block.getLocation(), curBlock.getLocation());
|
||||||
|
|
||||||
if (offset <= dR)
|
if (offset <= dR && !(hollow && offset < dR - 1))
|
||||||
blockList.put(curBlock, 1 - (offset/dR));
|
{
|
||||||
|
blockList.put(curBlock, 1 - (offset / dR));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return blockList;
|
return blockList;
|
||||||
|
Loading…
Reference in New Issue
Block a user