diff --git a/Core/src/main/java/com/intellectualcrafters/plot/generator/AugmentedUtils.java b/Core/src/main/java/com/intellectualcrafters/plot/generator/AugmentedUtils.java index baa6d93df..76e490f56 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/generator/AugmentedUtils.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/generator/AugmentedUtils.java @@ -27,6 +27,7 @@ public class AugmentedUtils { if (!enabled) { return false; } + final int bx = cx << 4; final int bz = cz << 4; RegionWrapper region = new RegionWrapper(bx, bx + 15, bz, bz + 15); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/ChunkManager.java b/Core/src/main/java/com/intellectualcrafters/plot/util/ChunkManager.java index 00cf94cdd..df973e3af 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/ChunkManager.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/ChunkManager.java @@ -8,7 +8,6 @@ import com.intellectualcrafters.plot.object.RegionWrapper; import com.intellectualcrafters.plot.object.RunnableVal; import com.intellectualcrafters.plot.util.block.GlobalBlockQueue; import com.intellectualcrafters.plot.util.block.LocalBlockQueue; -import com.intellectualcrafters.plot.util.block.OffsetLocalBlockQueue; import com.intellectualcrafters.plot.util.block.ScopedLocalBlockQueue; import java.io.File; import java.util.ArrayList; @@ -31,8 +30,9 @@ public abstract class ChunkManager { public static void setChunkInPlotArea(RunnableVal force, RunnableVal add, String world, ChunkLoc loc) { LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(world, false); if (PS.get().isAugmented(world)) { - OffsetLocalBlockQueue offset = new OffsetLocalBlockQueue(queue, loc.x >> 4, 0, loc.z >> 4); - ScopedLocalBlockQueue scoped = new ScopedLocalBlockQueue(offset, new Location(world, 0, 0, 0), new Location(world, 15, 255, 15)); + int bx = loc.x << 4; + int bz = loc.z << 4; + ScopedLocalBlockQueue scoped = new ScopedLocalBlockQueue(queue, new Location(world, bx, 0, bz), new Location(world, bx + 15, 255, bz + 15)); if (force != null) { force.run(scoped); } else { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/block/LocalBlockQueue.java b/Core/src/main/java/com/intellectualcrafters/plot/util/block/LocalBlockQueue.java index 3044902bc..96fd8811f 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/block/LocalBlockQueue.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/block/LocalBlockQueue.java @@ -19,7 +19,9 @@ public abstract class LocalBlockQueue { } public ScopedLocalBlockQueue getForChunk(int x, int z) { - return new ScopedLocalBlockQueue(this, new Location(getWorld(), x << 4, 0, z << 4), new Location(getWorld(), 15 + (x << 4), 255, 15 + (z << 4))); + int bx = x << 4; + int bz = z << 4; + ScopedLocalBlockQueue scoped = new ScopedLocalBlockQueue(this, new Location(getWorld(), bx, 0, bz), new Location(getWorld(), bx + 15, 255, bz + 15)); } public abstract boolean next(); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/block/ScopedLocalBlockQueue.java b/Core/src/main/java/com/intellectualcrafters/plot/util/block/ScopedLocalBlockQueue.java index 34946abe8..745e810cb 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/block/ScopedLocalBlockQueue.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/block/ScopedLocalBlockQueue.java @@ -16,6 +16,10 @@ public class ScopedLocalBlockQueue extends DelegateLocalBlockQueue { private final int maxY; private final int maxZ; + private final int dx; + private final int dy; + private final int dz; + public ScopedLocalBlockQueue(LocalBlockQueue parent, Location min, Location max) { super(parent); this.minX = min.getX(); @@ -25,12 +29,16 @@ public class ScopedLocalBlockQueue extends DelegateLocalBlockQueue { this.maxX = max.getX(); this.maxY = max.getY(); this.maxZ = max.getZ(); + + this.dx = maxX - minX; + this.dy = maxY - minY; + this.dz = maxZ - minZ; } @Override public boolean setBiome(int x, int z, String biome) { - return x >= minX && x <= maxX && z >= minZ && z <= maxZ && super.setBiome(x + minX, z + minZ, biome); + return x >= 0 && x <= dx && z >= 0 && z <= dz && super.setBiome(x + minX, z + minZ, biome); } public void fillBiome(String biome) { @@ -43,7 +51,7 @@ public class ScopedLocalBlockQueue extends DelegateLocalBlockQueue { @Override public boolean setBlock(int x, int y, int z, int id, int data) { - return x >= minX && x <= maxX && y >= minY && y <= maxY && z >= minZ && z <= maxZ && super.setBlock(x + minX, y + minY, z + minZ, id, data); + return x >= 0 && x <= dx && y >= 0 && y <= dy && z >= 0 && z <= dz && super.setBlock(x + minX, y + minY, z + minZ, id, data); } public Location getMin() {