Recover from world gen error.

This commit is contained in:
boy0001 2015-09-15 00:35:28 +10:00
parent b524d5fcfe
commit 9682e2914c
3 changed files with 29 additions and 24 deletions

View File

@ -26,38 +26,43 @@ public abstract class BukkitPlotPopulator extends BlockPopulator {
@Override @Override
public void populate(final World world, final Random rand, final Chunk chunk) { public void populate(final World world, final Random rand, final Chunk chunk) {
this.world = world; try {
worldname = world.getName(); this.world = world;
X = chunk.getX() << 4; worldname = world.getName();
Z = chunk.getZ() << 4; X = chunk.getX() << 4;
if (ChunkManager.FORCE_PASTE) { Z = chunk.getZ() << 4;
for (short x = 0; x < 16; x++) { if (ChunkManager.FORCE_PASTE) {
for (short z = 0; z < 16; z++) { for (short x = 0; x < 16; x++) {
final PlotLoc loc = new PlotLoc((short) (X + x), (short) (Z + z)); for (short z = 0; z < 16; z++) {
final HashMap<Short, Byte> blocks = ChunkManager.GENERATE_DATA.get(loc); final PlotLoc loc = new PlotLoc((short) (X + x), (short) (Z + z));
for (final Entry<Short, Byte> entry : blocks.entrySet()) { final HashMap<Short, Byte> blocks = ChunkManager.GENERATE_DATA.get(loc);
setBlock(x, entry.getKey(), z, entry.getValue()); for (final Entry<Short, Byte> entry : blocks.entrySet()) {
setBlock(x, entry.getKey(), z, entry.getValue());
}
} }
} }
return;
} }
return; populate(world, ChunkManager.CURRENT_PLOT_CLEAR, random, X, Z);
} if (ChunkManager.CURRENT_PLOT_CLEAR != null) {
populate(world, ChunkManager.CURRENT_PLOT_CLEAR, random, X, Z); PlotLoc loc;
if (ChunkManager.CURRENT_PLOT_CLEAR != null) { for (final Entry<PlotLoc, HashMap<Short, Byte>> entry : ChunkManager.GENERATE_DATA.entrySet()) {
PlotLoc loc; for (final Entry<Short, Byte> entry2 : entry.getValue().entrySet()) {
for (final Entry<PlotLoc, HashMap<Short, Byte>> entry : ChunkManager.GENERATE_DATA.entrySet()) { loc = entry.getKey();
for (final Entry<Short, Byte> entry2 : entry.getValue().entrySet()) { final int xx = loc.x - X;
loc = entry.getKey(); final int zz = loc.z - Z;
final int xx = loc.x - X; if ((xx >= 0) && (xx < 16)) {
final int zz = loc.z - Z; if ((zz >= 0) && (zz < 16)) {
if ((xx >= 0) && (xx < 16)) { setBlock(xx, entry2.getKey(), zz, entry2.getValue());
if ((zz >= 0) && (zz < 16)) { }
setBlock(xx, entry2.getKey(), zz, entry2.getValue());
} }
} }
} }
} }
} }
catch (Exception e) {
e.printStackTrace();
}
} }
public abstract void populate(final World world, final RegionWrapper requiredRegion, final PseudoRandom random, final int cx, final int cz); public abstract void populate(final World world, final RegionWrapper requiredRegion, final PseudoRandom random, final int cx, final int cz);

Binary file not shown.

Binary file not shown.