Fix clearing and deleting not restoring plot schematic

This commit is contained in:
Byteflux 2015-06-08 19:14:01 -07:00
parent 2b3a4f738a
commit 835d72063e
2 changed files with 26 additions and 37 deletions

View File

@ -170,17 +170,17 @@ public class HybridGen extends PlotGenerator {
}
}
}
if (region != null) {
final int X = cx << 4;
final int Z = cz << 4;
int sx = ((X) % this.size);
int sz = ((Z) % this.size);
int sx = (short) ((this.X) % this.size);
int sz = (short) ((this.Z) % this.size);
if (sx < 0) {
sx += this.size;
}
if (sz < 0) {
sz += this.size;
}
if (region != null) {
for (short x = 0; x < 16; x++) {
for (short z = 0; z < 16; z++) {
if (biomes != null) {
@ -191,7 +191,9 @@ public class HybridGen extends PlotGenerator {
setBlock(x, y, z, this.filling);
}
setBlock(x, this.plotheight, z, this.plotfloors);
final PlotLoc loc = new PlotLoc((X + x), (Z + z));
final int absX = ((sx + x) % this.size);
final int absZ = ((sz + z) % this.size);
final PlotLoc loc = new PlotLoc(absX, absZ);
final HashMap<Short, Short> blocks = plotworld.G_SCH.get(loc);
if (blocks != null) {
for (final Entry<Short, Short> entry : blocks.entrySet()) {
@ -203,14 +205,6 @@ public class HybridGen extends PlotGenerator {
}
return;
}
int sx = (short) ((this.X) % this.size);
int sz = (short) ((this.Z) % this.size);
if (sx < 0) {
sx += this.size;
}
if (sz < 0) {
sz += this.size;
}
for (short x = 0; x < 16; x++) {
for (short z = 0; z < 16; z++) {

View File

@ -112,9 +112,9 @@ public class HybridPop extends PlotPopulator {
@Override
public void populate(World world, RegionWrapper requiredRegion, PseudoRandom random, int cx, int cz) {
PlotSquared.getPlotManager(world.getName());
if (requiredRegion != null) {
short sx = (short) ((this.X) % this.size);
short sz = (short) ((this.Z) % this.size);
int sx = (short) ((this.X) % this.size);
int sz = (short) ((this.Z) % this.size);
if (sx < 0) {
sx += this.size;
}
@ -122,6 +122,7 @@ public class HybridPop extends PlotPopulator {
sz += this.size;
}
if (requiredRegion != null) {
for (short x = 0; x < 16; x++) {
for (short z = 0; z < 16; z++) {
if (contains(requiredRegion, x, z)) {
@ -134,7 +135,9 @@ public class HybridPop extends PlotPopulator {
setBlock(x, (short) this.plotheight, z, this.plotfloors);
}
if (this.plotworld.PLOT_SCHEMATIC) {
final PlotLoc loc = new PlotLoc((short) (this.X + x), (short) (this.Z + z));
final int absX = ((sx + x) % this.size);
final int absZ = ((sz + z) % this.size);
final PlotLoc loc = new PlotLoc(absX, absZ);
final HashMap<Short, Byte> blocks = this.plotworld.G_SCH_DATA.get(loc);
if (blocks != null) {
for (final short y : blocks.keySet()) {
@ -155,14 +158,6 @@ public class HybridPop extends PlotPopulator {
}
return;
}
int sx = (short) ((this.X) % this.size);
int sz = (short) ((this.Z) % this.size);
if (sx < 0) {
sx += this.size;
}
if (sz < 0) {
sz += this.size;
}
for (short x = 0; x < 16; x++) {
for (short z = 0; z < 16; z++) {