Fix plot schematic y

This commit is contained in:
Jesse Boyd 2019-04-06 01:54:02 +11:00
parent 3f194f90ce
commit 69a029a555
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
5 changed files with 32 additions and 12 deletions

View File

@ -112,7 +112,7 @@ public class BukkitHybridUtils extends HybridUtils {
}
int minY;
if (Settings.Schematics.PASTE_ON_TOP) {
minY = Math.min(hpw.PLOT_HEIGHT, hpw.ROAD_HEIGHT);
minY = hpw.SCHEM_Y;
} else {
minY = 1;
}

View File

@ -17,7 +17,7 @@ public class HybridGen extends IndependentPlotGenerator {
short relativeZ, int x, int z, boolean isRoad) {
int minY; // Math.min(world.PLOT_HEIGHT, world.ROAD_HEIGHT);
if (isRoad || Settings.Schematics.PASTE_ON_TOP) {
minY = Math.min(world.PLOT_HEIGHT, world.ROAD_HEIGHT);
minY = world.SCHEM_Y;
} else {
minY = 1;
}

View File

@ -78,7 +78,12 @@ 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);
int minY;
if (Settings.Schematics.PASTE_ON_TOP) {
minY = hpw.SCHEM_Y;
} else {
minY = 1;
}
for (int x = pos1.getX(); x <= pos2.getX(); x++) {
short absX = (short) ((x - hpw.ROAD_OFFSET_X) % size);
if (absX < 0) {

View File

@ -30,10 +30,12 @@ public class HybridPlotWorld extends ClassicPlotWorld {
private static AffineTransform transform = new AffineTransform().rotateY(90);
public boolean ROAD_SCHEMATIC_ENABLED;
public boolean PLOT_SCHEMATIC = false;
public int PLOT_SCHEMATIC_HEIGHT = -1;
public short PATH_WIDTH_LOWER;
public short PATH_WIDTH_UPPER;
public HashMap<Integer, BaseBlock[]> G_SCH;
private Location SIGN_LOCATION;
public int SCHEM_Y;
public HybridPlotWorld(String worldName, String id, IndependentPlotGenerator generator,
PlotId min, PlotId max) {
@ -143,7 +145,23 @@ public class HybridPlotWorld extends ClassicPlotWorld {
Schematic schematic3 = SchematicHandler.manager.getSchematic(schematic3File);
int shift = this.ROAD_WIDTH / 2;
int oddshift = (this.ROAD_WIDTH & 1) == 0 ? 0 : 1;
int minY = Math.min(PLOT_HEIGHT, ROAD_HEIGHT);
SCHEM_Y = Math.min(PLOT_HEIGHT, ROAD_HEIGHT);
int plotY = PLOT_HEIGHT - SCHEM_Y;
int roadY = ROAD_HEIGHT - SCHEM_Y;
if (schematic3.getClipboard().getDimensions().getY() == 256) {
SCHEM_Y = 0;
plotY = 0;
roadY = ROAD_HEIGHT;
}
if (schematic1.getClipboard().getDimensions().getY() == 256) {
SCHEM_Y = 0;
plotY = Math.min(plotY, PLOT_HEIGHT);
roadY = 0;
}
if (schematic3 != null) {
this.PLOT_SCHEMATIC = true;
BlockArrayClipboard blockArrayClipboard3 = schematic3.getClipboard();
@ -168,8 +186,6 @@ public class HybridPlotWorld extends ClassicPlotWorld {
centerShiftX = (PLOT_WIDTH - w3) / 2;
}
int startY = minY - PLOT_HEIGHT;
BlockVector3 min = blockArrayClipboard3.getMinimumPoint();
for (short x = 0; x < w3; x++) {
for (short z = 0; z < l3; z++) {
@ -177,7 +193,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
BaseBlock id = blockArrayClipboard3.getFullBlock(BlockVector3.at(x + min.getBlockX(), y + min.getBlockY(), z + min.getBlockZ()));
if (!id.getBlockType().getMaterial().isAir()) {
addOverlayBlock((short) (x + shift + oddshift + centerShiftX),
(short) (y + startY), (short) (z + shift + oddshift + centerShiftZ),
(short) (y + plotY), (short) (z + shift + oddshift + centerShiftZ),
id, false, h3);
}
}
@ -234,16 +250,15 @@ 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;
BlockVector3 min = blockArrayClipboard2.getMinimumPoint();
for (short x = 0; x < w2; x++) {
for (short z = 0; z < l2; z++) {
for (short y = 0; y < h2; y++) {
BaseBlock id = blockArrayClipboard2.getFullBlock(BlockVector3.at(x + min.getBlockX(), y + min.getBlockY(), z + min.getBlockZ()));
if (!id.getBlockType().getMaterial().isAir()) {
addOverlayBlock((short) (x - shift), (short) (y + startY),
addOverlayBlock((short) (x - shift), (short) (y + roadY),
(short) (z + shift + oddshift), id, false, h1);
addOverlayBlock((short) (z + shift + oddshift), (short) (y + startY),
addOverlayBlock((short) (z + shift + oddshift), (short) (y + roadY),
(short) (shift - x + (oddshift - 1)), id, true, h1);
}
}
@ -255,7 +270,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
for (short y = 0; y < h2; y++) {
BaseBlock id = blockArrayClipboard1.getFullBlock(BlockVector3.at(x + min.getBlockX(), y + min.getBlockY(), z + min.getBlockZ()));
if (!id.getBlockType().getMaterial().isAir()) {
addOverlayBlock((short) (x - shift), (short) (y + startY),
addOverlayBlock((short) (x - shift), (short) (y + roadY),
(short) (z - shift), id, false, h2);
}
}

View File

@ -343,7 +343,7 @@ public abstract class HybridUtils {
}
if (condition) {
BaseBlock[] blocks = plotWorld.G_SCH.get(MathMan.pair(absX, absZ));
int minY = Math.min(plotWorld.PLOT_HEIGHT, plotWorld.ROAD_HEIGHT);
int minY = plotWorld.SCHEM_Y;
int maxY = Math.max(extend, blocks.length);
if (blocks != null) {
for (int y = 0; y < maxY; y++) {