diff --git a/src/main/java/WayofTime/bloodmagic/api/ritual/AreaDescriptor.java b/src/main/java/WayofTime/bloodmagic/api/ritual/AreaDescriptor.java index 6bc56b12..dd1c59f1 100644 --- a/src/main/java/WayofTime/bloodmagic/api/ritual/AreaDescriptor.java +++ b/src/main/java/WayofTime/bloodmagic/api/ritual/AreaDescriptor.java @@ -21,15 +21,33 @@ public class AreaDescriptor public static class Rectangle extends AreaDescriptor { private BlockPos minimumOffset; - private BlockPos maximumOffset; + private BlockPos maximumOffset; // Non-inclusive maximum offset. private ArrayList blockPosCache = new ArrayList(); private BlockPos cachedPosition = new BlockPos(0, 0, 0); + /** + * This constructor takes in the minimum and maximum BlockPos. The + * maximum offset is non-inclusive, meaning if you pass in (0,0,0) and + * (1,1,1), calling getContainedPositions() will only give (0,0,0). + * + * @param minimumOffset + * @param maximumOffset + */ public Rectangle(BlockPos minimumOffset, BlockPos maximumOffset) { setOffsets(minimumOffset, maximumOffset); } + + public Rectangle(BlockPos minimumOffset, int sizeX, int sizeY, int sizeZ) + { + this(minimumOffset, minimumOffset.add(sizeX, sizeY, sizeZ)); + } + + public Rectangle(BlockPos minimumOffset, int size) + { + this(minimumOffset, size, size, size); + } @Override public List getContainedPositions(BlockPos pos) @@ -38,21 +56,20 @@ public class AreaDescriptor { ArrayList posList = new ArrayList(); - for (int i = minimumOffset.getX(); i <= maximumOffset.getX(); i++) + for (int i = minimumOffset.getX(); i < maximumOffset.getX(); i++) { - for (int j = minimumOffset.getY(); j <= maximumOffset.getY(); j++) + for (int j = minimumOffset.getY(); j < maximumOffset.getY(); j++) { - for (int k = minimumOffset.getZ(); k <= maximumOffset.getZ(); k++) + for (int k = minimumOffset.getZ(); k < maximumOffset.getZ(); k++) { posList.add(pos.add(i, j, k)); } } } - + blockPosCache = posList; cachedPosition = pos; } - return blockPosCache; } @@ -60,7 +77,7 @@ public class AreaDescriptor @Override public AxisAlignedBB getAABB(BlockPos pos) { - AxisAlignedBB tempAABB = new AxisAlignedBB(minimumOffset.getX(), minimumOffset.getY(), minimumOffset.getZ(), maximumOffset.getX() + 1, maximumOffset.getY() + 1, maximumOffset.getZ() + 1); + AxisAlignedBB tempAABB = new AxisAlignedBB(minimumOffset, maximumOffset); return tempAABB.offset(pos.getX(), pos.getY(), pos.getZ()); } diff --git a/src/main/java/WayofTime/bloodmagic/ritual/RitualGreenGrove.java b/src/main/java/WayofTime/bloodmagic/ritual/RitualGreenGrove.java index 72130e13..dfc52c9e 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/RitualGreenGrove.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/RitualGreenGrove.java @@ -25,7 +25,7 @@ public class RitualGreenGrove extends Ritual public RitualGreenGrove() { super("ritualGreenGrove", 0, 1000, "ritual." + Constants.Mod.MODID + ".greenGroveRitual"); - addBlockRange(GROW_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-1, 2, -1), new BlockPos(1, 2, 1))); + addBlockRange(GROW_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-1, 2, -1), 3, 1, 3)); } @Override diff --git a/src/main/java/WayofTime/bloodmagic/ritual/RitualJumping.java b/src/main/java/WayofTime/bloodmagic/ritual/RitualJumping.java index 9005c435..68534c20 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/RitualJumping.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/RitualJumping.java @@ -24,7 +24,7 @@ public class RitualJumping extends Ritual public RitualJumping() { super("ritualJump", 0, 1000, "ritual." + Constants.Mod.MODID + ".jumpRitual"); - addBlockRange(JUMP_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-1, 1, -1), new BlockPos(1, 2, 1))); + addBlockRange(JUMP_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-1, 1, -1), 3, 1, 3)); } @Override diff --git a/src/main/java/WayofTime/bloodmagic/ritual/RitualLava.java b/src/main/java/WayofTime/bloodmagic/ritual/RitualLava.java index e8e13448..8640a877 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/RitualLava.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/RitualLava.java @@ -17,7 +17,7 @@ public class RitualLava extends Ritual public RitualLava() { super("ritualLava", 0, 10000, "ritual." + Constants.Mod.MODID + ".lavaRitual"); - addBlockRange(LAVA_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 1, 0), new BlockPos(0, 1, 0))); + addBlockRange(LAVA_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 1, 0), 1)); } @Override diff --git a/src/main/java/WayofTime/bloodmagic/ritual/RitualWater.java b/src/main/java/WayofTime/bloodmagic/ritual/RitualWater.java index a92d0fb6..c6256353 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/RitualWater.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/RitualWater.java @@ -17,7 +17,7 @@ public class RitualWater extends Ritual public RitualWater() { super("ritualWater", 0, 500, "ritual." + Constants.Mod.MODID + ".waterRitual"); - addBlockRange(WATER_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 1, 0), new BlockPos(0, 1, 0))); + addBlockRange(WATER_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 1, 0), 1)); } @Override