This commit is contained in:
Jesse Boyd 2017-03-13 18:02:05 +11:00
parent 93717e670c
commit ad11ad3472
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
4 changed files with 14 additions and 8 deletions

View File

@ -24,12 +24,13 @@ public class HybridGen extends IndependentPlotGenerator {
}
private void placeSchem(HybridPlotWorld world, ScopedLocalBlockQueue result, short relativeX, short relativeZ, int x, int z) {
int minY = Math.min(world.PLOT_HEIGHT, world.ROAD_HEIGHT);
char[] blocks = world.G_SCH.get(MathMan.pair(relativeX, relativeZ));
if (blocks != null) {
for (int y = 0; y < blocks.length; y++) {
PlotBlock block = PlotBlock.get(blocks[y]);
if (block != null) {
result.setBlock(x, y, z, block);
result.setBlock(x, minY + y, z, block);
}
}
}

View File

@ -72,6 +72,7 @@ public class HybridPlotManager extends ClassicPlotManager {
private void createSchemAbs(HybridPlotWorld hpw, LocalBlockQueue queue, Location pos1, Location pos2, boolean clear) {
int size = hpw.SIZE;
int minY = Math.min(hpw.PLOT_HEIGHT, hpw.ROAD_HEIGHT);
for (int x = pos1.getX(); x <= pos2.getX(); x++) {
short absX = (short) ((x - hpw.ROAD_OFFSET_X) % size);
if (absX < 0) {
@ -87,7 +88,7 @@ public class HybridPlotManager extends ClassicPlotManager {
for (int y = 0; y < blocks.length; y++) {
PlotBlock block = PlotBlock.get(blocks[y]);
if (block != null) {
queue.setBlock(x, y, z, block);
queue.setBlock(x, minY + y, z, block);
}
}
}

View File

@ -185,6 +185,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
Schematic schematic3 = SchematicHandler.manager.getSchematic(schem3File);
int shift = this.ROAD_WIDTH / 2;
int oddshift = (this.ROAD_WIDTH & 1) == 0 ? 0 : 1;
int minY = Math.min(PLOT_HEIGHT, ROAD_HEIGHT);
if (schematic3 != null) {
this.PLOT_SCHEMATIC = true;
short[] ids = schematic3.getIds();
@ -201,6 +202,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
if (w3 < this.PLOT_WIDTH) {
centerShiftX = (this.PLOT_WIDTH - w3) / 2;
}
int startY = minY - PLOT_HEIGHT;
for (short x = 0; x < w3; x++) {
for (short z = 0; z < l3; z++) {
for (short y = 0; y < h3; y++) {
@ -208,7 +210,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
short id = ids[index];
byte data = datas[index];
if (id != 0) {
addOverlayBlock((short) (x + shift + oddshift + centerShiftX), (short) (y + this.PLOT_HEIGHT),
addOverlayBlock((short) (x + shift + oddshift + centerShiftX), (short) (y + startY),
(short) (z + shift + oddshift + centerShiftZ), id,
data, false, h3);
}
@ -255,6 +257,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
short w2 = (short) d2.getX();
short l2 = (short) d2.getZ();
short h2 = (short) d2.getY();
int startY = minY - ROAD_HEIGHT;
for (short x = 0; x < w1; x++) {
for (short z = 0; z < l1; z++) {
for (short y = 0; y < h1; y++) {
@ -262,8 +265,8 @@ public class HybridPlotWorld extends ClassicPlotWorld {
short id = ids1[index];
byte data = datas1[index];
if (id != 0) {
addOverlayBlock((short) (x - shift), (short) (y + this.ROAD_HEIGHT), (short) (z + shift + oddshift), id, data, false, h1);
addOverlayBlock((short) (z + shift + oddshift), (short) (y + this.ROAD_HEIGHT), (short) (x - shift), id, data, true, h1);
addOverlayBlock((short) (x - shift), (short) (y + startY), (short) (z + shift + oddshift), id, data, false, h1);
addOverlayBlock((short) (z + shift + oddshift), (short) (y + startY), (short) (x - shift), id, data, true, h1);
}
}
}
@ -275,7 +278,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
short id = ids2[index];
byte data = datas2[index];
if (id != 0) {
addOverlayBlock((short) (x - shift), (short) (y + this.ROAD_HEIGHT), (short) (z - shift), id, data, false, h2);
addOverlayBlock((short) (x - shift), (short) (y + startY), (short) (z - shift), id, data, false, h2);
}
}
}
@ -304,6 +307,6 @@ public class HybridPlotWorld extends ClassicPlotWorld {
if (id == 0) {
data = 1;
}
existing[(int) y] = (char) ((id << 4) + data);
existing[y] = (char) ((id << 4) + data);
}
}

View File

@ -433,11 +433,12 @@ public abstract class HybridUtils {
}
if (condition) {
char[] blocks = plotWorld.G_SCH.get(MathMan.pair(absX, absZ));
int minY = Math.min(plotWorld.PLOT_HEIGHT, plotWorld.ROAD_HEIGHT);
if (blocks != null) {
for (int y = 0; y < blocks.length; y++) {
PlotBlock block = PlotBlock.get(blocks[y]);
if (block != null) {
queue.setBlock(x + X + plotWorld.ROAD_OFFSET_X, y, z + Z + plotWorld.ROAD_OFFSET_Z, block);
queue.setBlock(x + X + plotWorld.ROAD_OFFSET_X, minY + y, z + Z + plotWorld.ROAD_OFFSET_Z, block);
}
}
}