1.7.1 region file filling

This commit is contained in:
Morlok8k 2012-09-11 03:04:58 -07:00
parent 463cd91dea
commit b614488516
2 changed files with 17 additions and 12 deletions

View File

@ -456,9 +456,16 @@ public class Main {
return; return;
} }
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) boolean useChunks = false;
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.
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.
} 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.
}
FileWrite.AppendTxtFile(var.worldPath + var.fileSeparator FileWrite.AppendTxtFile(var.worldPath + var.fileSeparator
+ "MinecraftLandGenerator.log", + "MinecraftLandGenerator.log",
"# " + var.PROG_NAME + " " + var.VERSION + " - " + SelfAware.JVMinfo() "# " + var.PROG_NAME + " " + var.VERSION + " - " + SelfAware.JVMinfo()
@ -517,13 +524,11 @@ public class Main {
xLoops = ((double) xRange / (double) var.increment); //How many loops do we need? xLoops = ((double) xRange / (double) var.increment); //How many loops do we need?
xLoops = Math.ceil(xLoops); //round up to find out! xLoops = Math.ceil(xLoops); //round up to find out!
xRangeAdj = (int) (xLoops * var.increment); xRangeAdj = (int) (xLoops * var.increment);
xLoops = xLoops + 1;
// Z // Z
zLoops = ((double) zRange / (double) var.increment); //How many loops do we need? zLoops = ((double) zRange / (double) var.increment); //How many loops do we need?
zLoops = Math.ceil(zLoops); //round up to find out! zLoops = Math.ceil(zLoops); //round up to find out!
zRangeAdj = (int) (zLoops * var.increment); zRangeAdj = (int) (zLoops * var.increment);
zLoops = zLoops + 1;
Out.out("Calculating Spawn Points..."); Out.out("Calculating Spawn Points...");
@ -539,9 +544,9 @@ public class Main {
for (int currentX = 0; currentX <= (xRangeAdj / 2); currentX += var.increment) { for (int currentX = 0; currentX <= (xRangeAdj / 2); currentX += var.increment) {
curXloops++; curXloops++;
if (curXloops == 1) { if (curXloops == 1) {
currentX = (((0 - xRange) / 2) + (var.increment / 2) + 16); currentX = (((0 - xRange) / 2) + (var.incrementFull / 2)); // West Edge of map
} else if (curXloops == xLoops) { } else if (curXloops == ((int) xLoops)) {
currentX = (xRange / 2) - (var.increment / 2); currentX = ((xRange / 2) - (var.incrementFull / 2)); // East Edge of map
} }
for (int currentZ = 0; currentZ <= (zRangeAdj / 2); currentZ += var.increment) { for (int currentZ = 0; currentZ <= (zRangeAdj / 2); currentZ += var.increment) {
@ -549,9 +554,9 @@ public class Main {
curZloops++; curZloops++;
if (curZloops == 1) { if (curZloops == 1) {
currentZ = (((0 - zRange) / 2) + (var.increment / 2) + 16); currentZ = (((0 - zRange) / 2) + (var.incrementFull / 2)); // North Edge of map
} else if (curZloops == zLoops) { } else if (curZloops == ((int) zLoops)) {
currentZ = (zRange / 2) - (var.increment / 2); currentZ = ((zRange / 2) - (var.incrementFull / 2)); // South Edge of map
} }
{ {
@ -690,5 +695,4 @@ public class Main {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); Logger.getLogger(Main.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
} }
} }
} }

View File

@ -115,7 +115,8 @@ public class var {
public static boolean dontWait = false; public static boolean dontWait = false;
public static boolean alternate = false; public static boolean alternate = false;
public static int MinecraftServerChunkPlayerCache = 625; //You see this number when you first launch the server in GUI mode, after the world is loaded, but before anyone has connected. public static int MinecraftServerChunkPlayerCache = 625; //You see this number when you first launch the server in GUI mode, after the world is loaded, but before anyone has connected.
public static int increment = (int) (Math.sqrt(MinecraftServerChunkPlayerCache) * 16) - 20; //private int increment = 380; public static int incrementFull = (int) (Math.sqrt(MinecraftServerChunkPlayerCache) * 16); // 400, the length of a fresh (no players have ever logged in) server map.
public static int increment = incrementFull - 16; //public static int increment = 384; // 384, what we use to iterate between sections of the map. Allows for some overlap to prevent "stripes"
public static boolean assertsEnabled = false; //debugging use... use java -ea -jar MinecraftlandGenerator.jar... public static boolean assertsEnabled = false; //debugging use... use java -ea -jar MinecraftlandGenerator.jar...
public static long startTime = 0L; public static long startTime = 0L;
public static Boolean recheckFlag = false; public static Boolean recheckFlag = false;