Fixed titles and schematic on clear offset for hybrid generation.

This commit is contained in:
boy0001 2015-07-21 16:03:27 +10:00
parent 488dbb0a63
commit 83bdcbfb97
2 changed files with 11 additions and 7 deletions

View File

@ -91,12 +91,12 @@ public class HybridPlotManager extends ClassicPlotManager {
public void createSchemAbs(HybridPlotWorld hpw, Location pos1, Location pos2, int height, boolean clear) { public void createSchemAbs(HybridPlotWorld hpw, Location pos1, Location pos2, int height, boolean clear) {
final int size = hpw.SIZE; final int size = hpw.SIZE;
for (int x = pos1.getX(); x <= pos2.getX(); x++) { for (int x = pos1.getX(); x <= pos2.getX(); x++) {
for (int z = pos1.getZ(); z <= pos2.getZ(); z++) { short absX = (short) ((x - hpw.ROAD_OFFSET_X) % size);
short absX = (short) (x % size);
short absZ = (short) (z % size);
if (absX < 0) { if (absX < 0) {
absX += size; absX += size;
} }
for (int z = pos1.getZ(); z <= pos2.getZ(); z++) {
short absZ = (short) ((z - hpw.ROAD_OFFSET_Z) % size);
if (absZ < 0) { if (absZ < 0) {
absZ += size; absZ += size;
} }
@ -171,9 +171,13 @@ public class HybridPlotManager extends ClassicPlotManager {
public boolean clearPlot(final PlotWorld plotworld, final Plot plot, final boolean isDelete, final Runnable whenDone) { public boolean clearPlot(final PlotWorld plotworld, final Plot plot, final boolean isDelete, final Runnable whenDone) {
final String world = plotworld.worldname; final String world = plotworld.worldname;
final HybridPlotWorld dpw = ((HybridPlotWorld) plotworld); final HybridPlotWorld dpw = ((HybridPlotWorld) plotworld);
final Location pos1 = MainUtil.getPlotBottomLocAbs(world, plot.id).add(1, 0, 1); final Location pos1 = MainUtil.getPlotBottomLocAbs(world, plot.id).add(1, 0, 1);
final Location pos2 = MainUtil.getPlotTopLocAbs(world, plot.id); final Location pos2 = MainUtil.getPlotTopLocAbs(world, plot.id);
System.out.print(pos1);
System.out.print(pos2);
setWallFilling(dpw, plot.id, new PlotBlock[] { dpw.WALL_FILLING }); setWallFilling(dpw, plot.id, new PlotBlock[] { dpw.WALL_FILLING });
final int p1x = pos1.getX(); final int p1x = pos1.getX();
final int p1z = pos1.getZ(); final int p1z = pos1.getZ();
@ -261,7 +265,7 @@ public class HybridPlotManager extends ClassicPlotManager {
if (!plotworld.PLOT_SCHEMATIC) { if (!plotworld.PLOT_SCHEMATIC) {
return; return;
} }
createSchemAbs(plotworld, l1.add(1,0,1), l2, plotworld.PLOT_HEIGHT, false); createSchemAbs(plotworld, l1, l2, plotworld.PLOT_HEIGHT, false);
} }
} }

View File

@ -202,7 +202,7 @@ public class PlotListener extends APlotListener {
@Override @Override
public void run() { public void run() {
Plot lastPlot = (Plot) pp.getMeta("lastplot"); Plot lastPlot = (Plot) pp.getMeta("lastplot");
if (plot.id.equals(lastPlot.id)) { if (lastPlot != null && plot.id.equals(lastPlot.id)) {
Map<String, String> replacements = new HashMap<>(); Map<String, String> replacements = new HashMap<>();
replacements.put("%x%", lastPlot.id.x + ""); replacements.put("%x%", lastPlot.id.x + "");
replacements.put("%z%", lastPlot.id.y + ""); replacements.put("%z%", lastPlot.id.y + "");