From 05319511ff1a05a8191b051e31e5c37aaa34ea98 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Fri, 3 Apr 2015 19:34:24 +1300 Subject: [PATCH] UtilBlock: Modified getInRadius() to allow option of a hollow sphere --- .../src/mineplex/core/common/util/UtilBlock.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java index a2a9272d5..a1d040f18 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java @@ -304,7 +304,13 @@ public class UtilBlock return blockList; } + public static HashMap getInRadius(Block block, double dR) + { + return getInRadius(block, dR, false); + } + + public static HashMap getInRadius(Block block, double dR, boolean hollow) { HashMap blockList = new HashMap(); int iR = (int)dR + 1; @@ -317,8 +323,10 @@ public class UtilBlock double offset = UtilMath.offset(block.getLocation(), curBlock.getLocation()); - if (offset <= dR) - blockList.put(curBlock, 1 - (offset/dR)); + if (offset <= dR && !(hollow && offset < dR - 1)) + { + blockList.put(curBlock, 1 - (offset / dR)); + } } return blockList;