From d752e72ef0f66e6c6448b8857bf0d673ab2bdd95 Mon Sep 17 00:00:00 2001 From: Morlok8k Date: Tue, 11 Sep 2012 11:45:30 -0700 Subject: [PATCH] fixed region filling gap! --- src/morlok8k/MinecraftLandGenerator/Main.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/morlok8k/MinecraftLandGenerator/Main.java b/src/morlok8k/MinecraftLandGenerator/Main.java index ab2d5b6..829eb40 100644 --- a/src/morlok8k/MinecraftLandGenerator/Main.java +++ b/src/morlok8k/MinecraftLandGenerator/Main.java @@ -456,16 +456,21 @@ public class Main { return; } + //TODO: make this optional boolean useChunks = false; if (useChunks) { // use Chunks or Regions xRange = (int) (Math.ceil(((double) xRange) / ((double) 16))) * 16; //say xRange was entered as 1000. this changes it to be 1008, a multiple of 16. (the size of a chunk) zRange = (int) (Math.ceil(((double) zRange) / ((double) 16))) * 16; //say zRange was entered as 2000. there is no change, as it already is a multiple of 16. + xOffset = (int) (Math.ceil(((double) xOffset) / ((double) 16))) * 16; + zOffset = (int) (Math.ceil(((double) zOffset) / ((double) 16))) * 16; } else { xRange = (int) (Math.ceil(((double) xRange) / ((double) 512))) * 512; //say xRange was entered as 1000. this changes it to be 1024, a multiple of 512. (the size of a region) zRange = (int) (Math.ceil(((double) zRange) / ((double) 512))) * 512; //say zRange was entered as 2048. there is no change, as it already is a multiple of 512. - + xOffset = (int) (Math.ceil(((double) xOffset) / ((double) 512))) * 512; + zOffset = (int) (Math.ceil(((double) zOffset) / ((double) 512))) * 512; } + FileWrite.AppendTxtFile(var.worldPath + var.fileSeparator + "MinecraftLandGenerator.log", "# " + var.PROG_NAME + " " + var.VERSION + " - " + SelfAware.JVMinfo() @@ -524,11 +529,13 @@ public class Main { xLoops = ((double) xRange / (double) var.increment); //How many loops do we need? xLoops = Math.ceil(xLoops); //round up to find out! xRangeAdj = (int) (xLoops * var.increment); + xLoops = xLoops + 1; // Z zLoops = ((double) zRange / (double) var.increment); //How many loops do we need? zLoops = Math.ceil(zLoops); //round up to find out! zRangeAdj = (int) (zLoops * var.increment); + zLoops = zLoops + 1; Out.out("Calculating Spawn Points..."); @@ -545,7 +552,7 @@ public class Main { curXloops++; if (curXloops == 1) { currentX = (((0 - xRange) / 2) + (var.incrementFull / 2)); // West Edge of map - } else if (curXloops == ((int) xLoops)) { + } else if (currentX >= ((xRangeAdj / 2) - (var.increment / 2))) { currentX = ((xRange / 2) - (var.incrementFull / 2)); // East Edge of map } @@ -555,7 +562,7 @@ public class Main { curZloops++; if (curZloops == 1) { currentZ = (((0 - zRange) / 2) + (var.incrementFull / 2)); // North Edge of map - } else if (curZloops == ((int) zLoops)) { + } else if (currentZ >= ((zRangeAdj / 2) - (var.increment / 2))) { currentZ = ((zRange / 2) - (var.incrementFull / 2)); // South Edge of map }