Fix augmented

This commit is contained in:
Jesse Boyd 2016-06-18 12:44:56 +10:00
parent 600d060b6e
commit 232091454a
4 changed files with 17 additions and 6 deletions

View File

@ -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);

View File

@ -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<ScopedLocalBlockQueue> force, RunnableVal<ScopedLocalBlockQueue> 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 {

View File

@ -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();

View File

@ -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() {