mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-29 16:46:45 +01:00
Should be functional now
This commit is contained in:
parent
3b52b7909a
commit
f8f7dec5f6
@ -776,19 +776,19 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
public static void swapChunk(World world, Chunk pos1, Chunk pos2, RegionWrapper r1, RegionWrapper r2) {
|
public static void swapChunk(World world, Chunk pos1, Chunk pos2, RegionWrapper r1, RegionWrapper r2) {
|
||||||
System.out.print("SWAPPING: " + pos1 +" and " + pos2);
|
System.out.print("SWAPPING: " + pos1 +" and " + pos2);
|
||||||
initMaps();
|
initMaps();
|
||||||
int relX = (pos2.getX() - pos1.getX()) << 4;
|
int relX = (r2.minX - r1.minX);
|
||||||
int relZ = (pos2.getZ() - pos1.getZ()) << 4;
|
int relZ = (r2.minZ - r1.minZ);
|
||||||
|
|
||||||
saveEntitiesIn(pos1, r1, relX, relZ);
|
saveEntitiesIn(pos1, r1, relX, relZ);
|
||||||
saveEntitiesIn(pos2, r2, -relX, -relZ);
|
saveEntitiesIn(pos2, r2, -relX, -relZ);
|
||||||
|
|
||||||
int sx = pos1.getX() << 4;
|
int sx = pos1.getX() << 4;
|
||||||
int sz = pos1.getX() << 4;
|
int sz = pos1.getZ() << 4;
|
||||||
|
|
||||||
int maxY = world.getMaxHeight();
|
int maxY = world.getMaxHeight();
|
||||||
|
|
||||||
for (int x = sx; x< sx + 15; x++) {
|
for (int x = Math.max(r1.minX, sx); x <= Math.min(r1.maxX, sx + 15); x++) {
|
||||||
for (int z = sz; z< sz + 15; z++) {
|
for (int z = Math.max(r1.minZ, sz); z <= Math.min(r1.maxZ, sz + 15); z++) {
|
||||||
saveBlocks(world, maxY, sx, sz, relX, relZ);
|
saveBlocks(world, maxY, sx, sz, relX, relZ);
|
||||||
for (int y = 0; y < maxY; y++) {
|
for (int y = 0; y < maxY; y++) {
|
||||||
Block block1 = world.getBlockAt(x, y, z);
|
Block block1 = world.getBlockAt(x, y, z);
|
||||||
@ -797,16 +797,18 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
int xx = x + relX;
|
int xx = x + relX;
|
||||||
int zz = z + relZ;
|
int zz = z + relZ;
|
||||||
Block block2 = world.getBlockAt(xx, y, zz);
|
Block block2 = world.getBlockAt(xx, y, zz);
|
||||||
int id2 = block1.getTypeId();
|
int id2 = block2.getTypeId();
|
||||||
byte data2 = block1.getData();
|
byte data2 = block2.getData();
|
||||||
if (id1 == 0) {
|
if (id1 == 0) {
|
||||||
if (id2 != 0) {
|
if (id2 != 0) {
|
||||||
BukkitSetBlockManager.setBlockManager.set(world, x, y, z, id2, data2);
|
BukkitSetBlockManager.setBlockManager.set(world, x, y, z, id2, data2);
|
||||||
|
BukkitSetBlockManager.setBlockManager.set(world, xx, y, zz, 0, (byte) 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (id2 == 0) {
|
else if (id2 == 0) {
|
||||||
if (id1 != 0) {
|
if (id1 != 0) {
|
||||||
BukkitSetBlockManager.setBlockManager.set(world, xx, y, zz, id1, data1);
|
BukkitSetBlockManager.setBlockManager.set(world, xx, y, zz, id1, data1);
|
||||||
|
BukkitSetBlockManager.setBlockManager.set(world, x, y, z, 0, (byte) 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (id1 == id2) {
|
else if (id1 == id2) {
|
||||||
|
Loading…
Reference in New Issue
Block a user