Split road and plot paste-on-top settings

This commit is contained in:
dordsor21 2020-07-09 22:39:06 +01:00
parent 5b260ea8da
commit 2fb76e6636
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B
4 changed files with 21 additions and 15 deletions

View File

@ -388,6 +388,9 @@ public class Settings extends Config {
@Comment(
"Whether schematic based generation should paste schematic on top of plots, or from Y=1")
public static boolean PASTE_ON_TOP = true;
@Comment(
"Whether schematic based road generation should paste schematic on top of roads, or from Y=1")
public static boolean PASTE_ROAD_ON_TOP = true;
}

View File

@ -47,7 +47,8 @@ public class HybridGen extends IndependentPlotGenerator {
private void placeSchem(HybridPlotWorld world, ScopedLocalBlockQueue result, short relativeX,
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) {
if ((isRoad && Settings.Schematics.PASTE_ROAD_ON_TOP) || (!isRoad
&& Settings.Schematics.PASTE_ON_TOP)) {
minY = world.SCHEM_Y;
} else {
minY = 1;

View File

@ -112,15 +112,17 @@ public class HybridPlotManager extends ClassicPlotManager {
return true;
}
LocalBlockQueue queue = hybridPlotWorld.getQueue(false);
createSchemAbs(queue, pos1, pos2);
createSchemAbs(queue, pos1, pos2, true);
queue.enqueue();
return true;
}
private void createSchemAbs(LocalBlockQueue queue, Location pos1, Location pos2) {
private void createSchemAbs(LocalBlockQueue queue, Location pos1, Location pos2,
boolean isRoad) {
int size = hybridPlotWorld.SIZE;
int minY;
if (Settings.Schematics.PASTE_ON_TOP) {
if ((isRoad && Settings.Schematics.PASTE_ROAD_ON_TOP) || (!isRoad
&& Settings.Schematics.PASTE_ON_TOP)) {
minY = hybridPlotWorld.SCHEM_Y;
} else {
minY = 1;
@ -172,7 +174,7 @@ public class HybridPlotManager extends ClassicPlotManager {
return true;
}
LocalBlockQueue queue = hybridPlotWorld.getQueue(false);
createSchemAbs(queue, pos1, pos2);
createSchemAbs(queue, pos1, pos2, true);
queue.enqueue();
return true;
}
@ -186,9 +188,9 @@ public class HybridPlotManager extends ClassicPlotManager {
pos1.setY(0);
pos2.setY(Math.min(getWorldHeight(), 255));
LocalBlockQueue queue = hybridPlotWorld.getQueue(false);
createSchemAbs(queue, pos1, pos2);
createSchemAbs(queue, pos1, pos2, true);
if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
createSchemAbs(queue, pos1, pos2);
createSchemAbs(queue, pos1, pos2, true);
}
return queue.enqueue();
}
@ -267,7 +269,7 @@ public class HybridPlotManager extends ClassicPlotManager {
if (!hybridPlotWorld.PLOT_SCHEMATIC) {
return;
}
createSchemAbs(queue, bottom, top);
createSchemAbs(queue, bottom, top, false);
}
/**

View File

@ -83,6 +83,11 @@ public abstract class HybridUtils {
public static PlotArea area;
public static boolean UPDATE = false;
public static boolean regeneratePlotWalls(final PlotArea area) {
PlotManager plotManager = area.getPlotManager();
return plotManager.regenerateAllPlotWalls();
}
public void analyzeRegion(final String world, final CuboidRegion region,
final RunnableVal<PlotAnalysis> whenDone) {
// int diff, int variety, int vertices, int rotation, int height_sd
@ -501,7 +506,7 @@ public abstract class HybridUtils {
PlotManager plotManager = plotworld.getPlotManager();
int sx = bot.getX() - plotworld.ROAD_WIDTH + 1;
int sz = bot.getZ() + 1;
int sy = plotworld.ROAD_HEIGHT;
int sy = Settings.Schematics.PASTE_ROAD_ON_TOP ? plotworld.ROAD_HEIGHT : 1;
int ex = bot.getX();
int ez = top.getZ();
int ey = get_ey(plotManager, queue, sx, ex, sz, ez, sy);
@ -621,7 +626,7 @@ public abstract class HybridUtils {
}
if (condition) {
BaseBlock[] blocks = plotWorld.G_SCH.get(MathMan.pair(absX, absZ));
int minY = plotWorld.SCHEM_Y;
int minY = Settings.Schematics.PASTE_ROAD_ON_TOP ? plotWorld.SCHEM_Y : 1;
int maxY = Math.max(extend, blocks.length);
for (int y = 0; y < maxY; y++) {
if (y > blocks.length - 1) {
@ -656,9 +661,4 @@ public abstract class HybridUtils {
}
return false;
}
public static boolean regeneratePlotWalls(final PlotArea area) {
PlotManager plotManager = area.getPlotManager();
return plotManager.regenerateAllPlotWalls();
}
}