fixed region filling gap!

This commit is contained in:
Morlok8k 2012-09-11 11:45:30 -07:00
parent b614488516
commit d752e72ef0

View File

@ -456,16 +456,21 @@ public class Main {
return; return;
} }
//TODO: make this optional
boolean useChunks = false; boolean useChunks = false;
if (useChunks) { // use Chunks or Regions 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) 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. 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 { } 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) 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. 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 FileWrite.AppendTxtFile(var.worldPath + var.fileSeparator
+ "MinecraftLandGenerator.log", + "MinecraftLandGenerator.log",
"# " + var.PROG_NAME + " " + var.VERSION + " - " + SelfAware.JVMinfo() "# " + 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 = ((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...");
@ -545,7 +552,7 @@ public class Main {
curXloops++; curXloops++;
if (curXloops == 1) { if (curXloops == 1) {
currentX = (((0 - xRange) / 2) + (var.incrementFull / 2)); // West Edge of map 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 currentX = ((xRange / 2) - (var.incrementFull / 2)); // East Edge of map
} }
@ -555,7 +562,7 @@ public class Main {
curZloops++; curZloops++;
if (curZloops == 1) { if (curZloops == 1) {
currentZ = (((0 - zRange) / 2) + (var.incrementFull / 2)); // North Edge of map 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 currentZ = ((zRange / 2) - (var.incrementFull / 2)); // South Edge of map
} }