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

View File

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