1.4.5 (1.5.0 beta) -- untested
This commit is contained in:
parent
d0bd26fe25
commit
bd162821de
58
README
58
README
@ -1,15 +1,13 @@
|
|||||||
Minecraft Land Generator version 1.4.4
|
Minecraft Land Generator version 1.5.0
|
||||||
|
|
||||||
Updated May 15, 2011
|
Updated May 27, 2011
|
||||||
|
|
||||||
Original Code by Corrodias November 2010
|
Original Code by Corrodias November 2010
|
||||||
Enhanced Code by Morlok8k Feb. 2011 to Now (or at least to the date listed above!)
|
Enhanced Code by Morlok8k Feb. 2011 to Now (or at least to the date listed above!)
|
||||||
|
|
||||||
Forum: http://www.minecraftforum.net/viewtopic.php?f=1022&t=203394
|
Forum: http://www.minecraftforum.net/topic/187737-minecraft-land-generator/
|
||||||
Source: https://github.com/Morlok8k/MinecraftLandGenerator
|
Source: https://github.com/Morlok8k/MinecraftLandGenerator
|
||||||
|
|
||||||
Original Forum (Now Locked): http://www.minecraftforum.net/viewtopic.php?f=1012&t=76563&start=60#p1299186
|
|
||||||
|
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
|
|
||||||
This program lets you generate an area of land with your Minecraft Beta SMP server (and is prossibly future-proof for newer versions). You set up your java command line and minecraft server paths in the MinecraftLandGenerator.conf file, set up the server's server.properties file with the name of the world you wish to use, and then run this program.
|
This program lets you generate an area of land with your Minecraft Beta SMP server (and is prossibly future-proof for newer versions). You set up your java command line and minecraft server paths in the MinecraftLandGenerator.conf file, set up the server's server.properties file with the name of the world you wish to use, and then run this program.
|
||||||
@ -26,6 +24,14 @@ The JNLP library is included (inside the .jar) as jnbt-1.1.jar. It is not public
|
|||||||
Version History:
|
Version History:
|
||||||
Morlok8k:
|
Morlok8k:
|
||||||
|
|
||||||
|
1.5.0
|
||||||
|
- Supports Server Beta 1.6.4
|
||||||
|
- Added "-a","-alt" to use alternate method (a simplier version of 1.3.0's code)
|
||||||
|
- Added world specific output for 9 dimensions (DIM-1 is the Nether, DIM-2 through DIM-9 dont exist yet, but when they do, you can configure it's text)
|
||||||
|
- Updated Config File for these Dimensions.
|
||||||
|
- Reads and outputs the Seed to the output. (If you had used text for the Seed, Minecraft converts it into a number. This outputs the number.)
|
||||||
|
- Changed the default 300 blocks to 380. The server now makes a 400x400 square block terrain instead of 320x320
|
||||||
|
|
||||||
1.4.4
|
1.4.4
|
||||||
- Added ablilty to ignore [WARNING] and [SEVERE] errors with "-w"
|
- Added ablilty to ignore [WARNING] and [SEVERE] errors with "-w"
|
||||||
|
|
||||||
@ -72,23 +78,25 @@ Corrodias:
|
|||||||
|
|
||||||
|
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
Minecraft Land Generator version 1.4.4
|
Minecraft Land Generator version 1.5.0
|
||||||
Uses a Minecraft server to generate square land of a specified size.
|
Uses a Minecraft server to generate square land of a specified size.
|
||||||
|
|
||||||
Usage: java -jar MinecraftLandGenerator.jar x y [serverpath] [switches]
|
Usage: java -jar MinecraftLandGenerator.jar x y [serverpath] [switches]
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
x : X range to generate
|
x : X range to generate
|
||||||
y : Y range to generate
|
y : Y range to generate
|
||||||
serverpath : the path to the directory in which the server runs (takes precedence over the config file setting)
|
serverpath : the path to the directory in which the server runs (takes precedence over the config file setting)
|
||||||
|
|
||||||
Switches:
|
Switches:
|
||||||
-verbose : causes the application to output the server's messages to the console
|
-verbose : causes the application to output the server's messages to the console
|
||||||
-v : same as -verbose
|
-v : same as -verbose
|
||||||
-w : Ignore [WARNING] and [SEVERE] messages.
|
-w : Ignore [WARNING] and [SEVERE] messages.
|
||||||
-i# : override the iteration spawn offset increment (default 300) (example: -i100)
|
-alt : alternate server launch sequence
|
||||||
-x# : set the X offset to generate land around (example: -x0)
|
-a : same as -alt
|
||||||
-y# : set the X offset to generate land around (example: -y0)
|
-i# : override the iteration spawn offset increment (default 300) (example: -i100)
|
||||||
|
-x# : set the X offset to generate land around (example: -x0)
|
||||||
|
-y# : set the X offset to generate land around (example: -y0)
|
||||||
|
|
||||||
Other options:
|
Other options:
|
||||||
java -jar MinecraftLandGenerator.jar -printspawn
|
java -jar MinecraftLandGenerator.jar -printspawn
|
||||||
@ -107,17 +115,27 @@ When launched with the -conf switch, this application creates a MinecraftLandGen
|
|||||||
If this file does not exist or does not contain all required properties, the application will not run.
|
If this file does not exist or does not contain all required properties, the application will not run.
|
||||||
|
|
||||||
MinecraftLandGenerator.conf properties:
|
MinecraftLandGenerator.conf properties:
|
||||||
Java : The command line to use to launch the server
|
Java : The command line to use to launch the server
|
||||||
ServerPath : The path to the directory in which the server runs (can be overridden by the serverpath argument)
|
ServerPath : The path to the directory in which the server runs (can be overridden by the serverpath argument)
|
||||||
Done_Text : The output from the server that tells us that we are done
|
Done_Text : The output from the server that tells us that we are done
|
||||||
Preparing_Text : The output from the server that tells us the percentage
|
Preparing_Text : The output from the server that tells us the percentage
|
||||||
|
Preparing_Level : The output from the server that tells us the level it is working on
|
||||||
|
DIM-1 : Name of DIM-1: Nether
|
||||||
|
DIM-2 : Name of DIM-2: (Future Level)
|
||||||
|
DIM-3 : Name of DIM-3: (Future Level)
|
||||||
|
DIM-4 : Name of DIM-4: (Future Level)
|
||||||
|
DIM-5 : Name of DIM-5: (Future Level)
|
||||||
|
DIM-6 : Name of DIM-6: (Future Level)
|
||||||
|
DIM-7 : Name of DIM-7: (Future Level)
|
||||||
|
DIM-8 : Name of DIM-8: (Future Level)
|
||||||
|
DIM-9 : Name of DIM-9: (Future Level)
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
|
|
||||||
This doesn't touch the nether unless you specify hellworld=true in server.properties
|
Due to changes in server beta 1.6, it now generates the nether as well as the world at the same time.
|
||||||
|
|
||||||
I recommend using MCE or MCEDIT to relight the map after you generate it. This will take a long time, but should fix all those incorrectly dark spots in your level.
|
I recommend using MCE or MCEDIT to relight the map after you generate it. This will take a long time, but should fix all those incorrectly dark spots in your level.
|
||||||
|
|
||||||
|
Binary file not shown.
@ -23,12 +23,13 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Locale;
|
//import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.jnbt.CompoundTag;
|
import org.jnbt.CompoundTag;
|
||||||
import org.jnbt.IntTag;
|
import org.jnbt.IntTag;
|
||||||
|
import org.jnbt.LongTag;
|
||||||
import org.jnbt.NBTInputStream;
|
import org.jnbt.NBTInputStream;
|
||||||
import org.jnbt.NBTOutputStream;
|
import org.jnbt.NBTOutputStream;
|
||||||
import org.jnbt.Tag;
|
import org.jnbt.Tag;
|
||||||
@ -42,21 +43,31 @@ import org.jnbt.Tag;
|
|||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
//Version Number!
|
//Version Number!
|
||||||
private static final String VERSION = "1.4.4";
|
private static final String VERSION = "1.4.5 (pre-1.5.0)";
|
||||||
|
|
||||||
private static final String separator = System.getProperty("file.separator");
|
private static final String separator = System.getProperty("file.separator");
|
||||||
//private static final String classpath = System.getProperty("java.class.path");
|
//private static final String classpath = System.getProperty("java.class.path");
|
||||||
//private static final String javaPath = System.getProperty("java.home") + separator + "bin" + separator + "java";
|
//private static final String javaPath = System.getProperty("java.home") + separator + "bin" + separator + "java";
|
||||||
|
|
||||||
private int increment = 300;
|
private int increment = 380;
|
||||||
private ProcessBuilder minecraft = null;
|
private ProcessBuilder minecraft = null;
|
||||||
private String javaLine = null;
|
private String javaLine = null;
|
||||||
private String serverPath = null;
|
private String serverPath = null;
|
||||||
private String worldPath = null;
|
private String worldPath = null;
|
||||||
private String worldName = null;
|
private static String worldName = "world";
|
||||||
private static String doneText = null;
|
private static String doneText = null;
|
||||||
private static String preparingText = null;
|
private static String preparingText = null;
|
||||||
private String hell = null;
|
private static String preparingLevel = null;
|
||||||
|
// private static String level_0 = null; //the world
|
||||||
|
private static String level_1 = null; //the nether
|
||||||
|
private static String level_2 = null; //future worlds
|
||||||
|
private static String level_3 = null;
|
||||||
|
private static String level_4 = null;
|
||||||
|
private static String level_5 = null;
|
||||||
|
private static String level_6 = null;
|
||||||
|
private static String level_7 = null;
|
||||||
|
private static String level_8 = null;
|
||||||
|
private static String level_9 = null;
|
||||||
private int xRange = 0;
|
private int xRange = 0;
|
||||||
private int yRange = 0;
|
private int yRange = 0;
|
||||||
private Integer xOffset = null;
|
private Integer xOffset = null;
|
||||||
@ -64,6 +75,7 @@ public class Main {
|
|||||||
private boolean verbose = false;
|
private boolean verbose = false;
|
||||||
private boolean alternate = false;
|
private boolean alternate = false;
|
||||||
private static boolean ignoreWarnings = false;
|
private static boolean ignoreWarnings = false;
|
||||||
|
private static LongTag randomSeed = null;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -86,19 +98,19 @@ public class Main {
|
|||||||
System.out.println("Usage: java -jar MinecraftLandGenerator.jar x y [serverpath] [switches]");
|
System.out.println("Usage: java -jar MinecraftLandGenerator.jar x y [serverpath] [switches]");
|
||||||
System.out.println("");
|
System.out.println("");
|
||||||
System.out.println("Arguments:");
|
System.out.println("Arguments:");
|
||||||
System.out.println(" x : X range to generate");
|
System.out.println(" x : X range to generate");
|
||||||
System.out.println(" y : Y range to generate");
|
System.out.println(" y : Y range to generate");
|
||||||
System.out.println(" serverpath : the path to the directory in which the server runs (takes precedence over the config file setting)");
|
System.out.println(" serverpath : the path to the directory in which the server runs (takes precedence over the config file setting)");
|
||||||
System.out.println("");
|
System.out.println("");
|
||||||
System.out.println("Switches:");
|
System.out.println("Switches:");
|
||||||
System.out.println(" -verbose : causes the application to output the server's messages to the console");
|
System.out.println(" -verbose : causes the application to output the server's messages to the console");
|
||||||
System.out.println(" -v : same as -verbose");
|
System.out.println(" -v : same as -verbose");
|
||||||
System.out.println(" -w : Ignore [WARNING] and [SEVERE] messages.");
|
System.out.println(" -w : Ignore [WARNING] and [SEVERE] messages.");
|
||||||
//System.out.println(" -alt : alternate server launch sequence");
|
System.out.println(" -alt : alternate server launch sequence");
|
||||||
//System.out.println(" -a : same as -alt");
|
System.out.println(" -a : same as -alt");
|
||||||
System.out.println(" -i# : override the iteration spawn offset increment (default 300) (example: -i100)");
|
System.out.println(" -i# : override the iteration spawn offset increment (default 300) (example: -i100)");
|
||||||
System.out.println(" -x# : set the X offset to generate land around (example: -x0)");
|
System.out.println(" -x# : set the X offset to generate land around (example: -x0)");
|
||||||
System.out.println(" -y# : set the X offset to generate land around (example: -y0)");
|
System.out.println(" -y# : set the X offset to generate land around (example: -y0)");
|
||||||
System.out.println("");
|
System.out.println("");
|
||||||
System.out.println("Other options:");
|
System.out.println("Other options:");
|
||||||
System.out.println(" java -jar MinecraftLandGenerator.jar -printspawn");
|
System.out.println(" java -jar MinecraftLandGenerator.jar -printspawn");
|
||||||
@ -117,10 +129,20 @@ public class Main {
|
|||||||
System.out.println("If this file does not exist or does not contain all required properties, the application will not run.");
|
System.out.println("If this file does not exist or does not contain all required properties, the application will not run.");
|
||||||
System.out.println("");
|
System.out.println("");
|
||||||
System.out.println("MinecraftLandGenerator.conf properties:");
|
System.out.println("MinecraftLandGenerator.conf properties:");
|
||||||
System.out.println(" Java : The command line to use to launch the server");
|
System.out.println(" Java : The command line to use to launch the server");
|
||||||
System.out.println(" ServerPath : The path to the directory in which the server runs (can be overridden by the serverpath argument)");
|
System.out.println(" ServerPath : The path to the directory in which the server runs (can be overridden by the serverpath argument)");
|
||||||
System.out.println(" Done_Text : The output from the server that tells us that we are done");
|
System.out.println(" Done_Text : The output from the server that tells us that we are done");
|
||||||
System.out.println("Preparing_Text : The output from the server that tells us the percentage");
|
System.out.println(" Preparing_Text : The output from the server that tells us the percentage");
|
||||||
|
System.out.println("Preparing_Level : The output from the server that tells us the level it is working on");
|
||||||
|
System.out.println(" DIM-1 : Name of DIM-1: Nether");
|
||||||
|
System.out.println(" DIM-2 : Name of DIM-2: (Future Level)");
|
||||||
|
System.out.println(" DIM-3 : Name of DIM-3: (Future Level)");
|
||||||
|
System.out.println(" DIM-4 : Name of DIM-4: (Future Level)");
|
||||||
|
System.out.println(" DIM-5 : Name of DIM-5: (Future Level)");
|
||||||
|
System.out.println(" DIM-6 : Name of DIM-6: (Future Level)");
|
||||||
|
System.out.println(" DIM-7 : Name of DIM-7: (Future Level)");
|
||||||
|
System.out.println(" DIM-8 : Name of DIM-8: (Future Level)");
|
||||||
|
System.out.println(" DIM-9 : Name of DIM-9: (Future Level)");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -144,15 +166,44 @@ public class Main {
|
|||||||
out.newLine();
|
out.newLine();
|
||||||
out.write("#Auto-Generated: " + dateFormat.format(date));
|
out.write("#Auto-Generated: " + dateFormat.format(date));
|
||||||
out.newLine();
|
out.newLine();
|
||||||
|
out.newLine();
|
||||||
|
out.write("#Line to run server:");
|
||||||
|
out.newLine();
|
||||||
out.write("Java=java -Djline.terminal=jline.UnsupportedTerminal -Duser.language=en -Xms1024m -Xmx1024m -Xincgc -jar minecraft_server.jar nogui");
|
out.write("Java=java -Djline.terminal=jline.UnsupportedTerminal -Duser.language=en -Xms1024m -Xmx1024m -Xincgc -jar minecraft_server.jar nogui");
|
||||||
// I added the jline tag for future proofing...
|
// I added the jline tag for future proofing...
|
||||||
out.newLine();
|
out.newLine();
|
||||||
|
out.newLine();
|
||||||
|
out.write("#Location of server. use \".\" for the same folder as MLG");
|
||||||
|
out.newLine();
|
||||||
out.write("ServerPath=.");
|
out.write("ServerPath=.");
|
||||||
out.newLine();
|
out.newLine();
|
||||||
|
out.newLine();
|
||||||
|
out.write("#Strings read from the server");
|
||||||
|
out.newLine();
|
||||||
out.write("Done_Text=[INFO] Done");
|
out.write("Done_Text=[INFO] Done");
|
||||||
out.newLine();
|
out.newLine();
|
||||||
out.write("Preparing_Text=[INFO] Preparing spawn area:");
|
out.write("Preparing_Text=[INFO] Preparing spawn area:");
|
||||||
out.newLine();
|
out.newLine();
|
||||||
|
out.write("Preparing_Level=[INFO] Preparing start region for");
|
||||||
|
out.newLine();
|
||||||
|
out.write("DIM-1=Nether");
|
||||||
|
out.newLine();
|
||||||
|
out.write("DIM-2=DIM-2");
|
||||||
|
out.newLine();
|
||||||
|
out.write("DIM-3=DIM-3");
|
||||||
|
out.newLine();
|
||||||
|
out.write("DIM-4=DIM-4");
|
||||||
|
out.newLine();
|
||||||
|
out.write("DIM-5=DIM-5");
|
||||||
|
out.newLine();
|
||||||
|
out.write("DIM-6=DIM-6");
|
||||||
|
out.newLine();
|
||||||
|
out.write("DIM-7=DIM-7");
|
||||||
|
out.newLine();
|
||||||
|
out.write("DIM-8=DIM-8");
|
||||||
|
out.newLine();
|
||||||
|
out.write("DIM-9=DIM-9");
|
||||||
|
out.newLine();
|
||||||
out.close();
|
out.close();
|
||||||
System.out.println("MinecraftLandGenerator.conf file created.");
|
System.out.println("MinecraftLandGenerator.conf file created.");
|
||||||
return;
|
return;
|
||||||
@ -177,11 +228,9 @@ public class Main {
|
|||||||
int pos = line.indexOf('=');
|
int pos = line.indexOf('=');
|
||||||
int end = line.lastIndexOf('#'); //comments, ignored lines
|
int end = line.lastIndexOf('#'); //comments, ignored lines
|
||||||
|
|
||||||
|
|
||||||
if (end == -1){ // If we have no hash sign, then we read till the end of the line
|
if (end == -1){ // If we have no hash sign, then we read till the end of the line
|
||||||
end = line.length();
|
end = line.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end <= pos){ // If hash is before the '=', we may have a issue... it should be fine, cause we check for issues next, but lets make sure.
|
if (end <= pos){ // If hash is before the '=', we may have a issue... it should be fine, cause we check for issues next, but lets make sure.
|
||||||
end = line.length();
|
end = line.length();
|
||||||
}
|
}
|
||||||
@ -195,6 +244,26 @@ public class Main {
|
|||||||
doneText = line.substring(pos + 1, end);
|
doneText = line.substring(pos + 1, end);
|
||||||
} else if (line.substring(0, pos).toLowerCase().equals("preparing_text")) {
|
} else if (line.substring(0, pos).toLowerCase().equals("preparing_text")) {
|
||||||
preparingText = line.substring(pos + 1, end);
|
preparingText = line.substring(pos + 1, end);
|
||||||
|
} else if (line.substring(0, pos).toLowerCase().equals("preparing_level")) {
|
||||||
|
preparingLevel = line.substring(pos + 1, end);
|
||||||
|
} else if (line.substring(0, pos).toLowerCase().equals("DIM-1")) {
|
||||||
|
level_1 = line.substring(pos + 1, end);
|
||||||
|
} else if (line.substring(0, pos).toLowerCase().equals("DIM-2")) {
|
||||||
|
level_2 = line.substring(pos + 1, end);
|
||||||
|
} else if (line.substring(0, pos).toLowerCase().equals("DIM-3")) {
|
||||||
|
level_3 = line.substring(pos + 1, end);
|
||||||
|
} else if (line.substring(0, pos).toLowerCase().equals("DIM-4")) {
|
||||||
|
level_4 = line.substring(pos + 1, end);
|
||||||
|
} else if (line.substring(0, pos).toLowerCase().equals("DIM-5")) {
|
||||||
|
level_5 = line.substring(pos + 1, end);
|
||||||
|
} else if (line.substring(0, pos).toLowerCase().equals("DIM-6")) {
|
||||||
|
level_6 = line.substring(pos + 1, end);
|
||||||
|
} else if (line.substring(0, pos).toLowerCase().equals("DIM-7")) {
|
||||||
|
level_7 = line.substring(pos + 1, end);
|
||||||
|
} else if (line.substring(0, pos).toLowerCase().equals("DIM-8")) {
|
||||||
|
level_8 = line.substring(pos + 1, end);
|
||||||
|
} else if (line.substring(0, pos).toLowerCase().equals("DIM-9")) {
|
||||||
|
level_9 = line.substring(pos + 1, end);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -205,7 +274,7 @@ public class Main {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doneText == null || preparingText == null) {
|
if (doneText == null || preparingText == null || preparingLevel == null || level_1 == null || level_9 == null) {
|
||||||
System.err.println("Old Version of MinecraftLandGenerator.conf found. Updating...");
|
System.err.println("Old Version of MinecraftLandGenerator.conf found. Updating...");
|
||||||
try {
|
try {
|
||||||
File configUpdate = new File("MinecraftLandGenerator.conf");
|
File configUpdate = new File("MinecraftLandGenerator.conf");
|
||||||
@ -224,6 +293,26 @@ public class Main {
|
|||||||
out.newLine();
|
out.newLine();
|
||||||
out.write("Preparing_Text=[INFO] Preparing spawn area:");
|
out.write("Preparing_Text=[INFO] Preparing spawn area:");
|
||||||
out.newLine();
|
out.newLine();
|
||||||
|
out.write("Preparing_Level=[INFO] Preparing start region for");
|
||||||
|
out.newLine();
|
||||||
|
out.write("DIM-1=Nether");
|
||||||
|
out.newLine();
|
||||||
|
out.write("DIM-2=DIM-2");
|
||||||
|
out.newLine();
|
||||||
|
out.write("DIM-3=DIM-3");
|
||||||
|
out.newLine();
|
||||||
|
out.write("DIM-4=DIM-4");
|
||||||
|
out.newLine();
|
||||||
|
out.write("DIM-5=DIM-5");
|
||||||
|
out.newLine();
|
||||||
|
out.write("DIM-6=DIM-6");
|
||||||
|
out.newLine();
|
||||||
|
out.write("DIM-7=DIM-7");
|
||||||
|
out.newLine();
|
||||||
|
out.write("DIM-8=DIM-8");
|
||||||
|
out.newLine();
|
||||||
|
out.write("DIM-9=DIM-9");
|
||||||
|
out.newLine();
|
||||||
out.close();
|
out.close();
|
||||||
System.out.println("MinecraftLandGenerator.conf file created.");
|
System.out.println("MinecraftLandGenerator.conf file created.");
|
||||||
return;
|
return;
|
||||||
@ -264,11 +353,8 @@ public class Main {
|
|||||||
} else if (nextSwitch.startsWith("-w")) {
|
} else if (nextSwitch.startsWith("-w")) {
|
||||||
ignoreWarnings = true;
|
ignoreWarnings = true;
|
||||||
} else if (nextSwitch.equals("-alt") || nextSwitch.equals("-a")) {
|
} else if (nextSwitch.equals("-alt") || nextSwitch.equals("-a")) {
|
||||||
// System.out.println("Using Alternate Launching...");
|
System.out.println("Using Alternate Launching...");
|
||||||
System.out.println("Alternate Launch Disabled.");
|
alternate = true;
|
||||||
// This is a failed attempt to fix issues with Windows XP 32bit.
|
|
||||||
// alternate = true;
|
|
||||||
alternate = false; // force Alt to be off, just in case
|
|
||||||
} else if (nextSwitch.startsWith("-x")) {
|
} else if (nextSwitch.startsWith("-x")) {
|
||||||
xOffset = Integer.valueOf(args[i + 2].substring(2));
|
xOffset = Integer.valueOf(args[i + 2].substring(2));
|
||||||
} else if (nextSwitch.startsWith("-y")) {
|
} else if (nextSwitch.startsWith("-y")) {
|
||||||
@ -301,9 +387,6 @@ public class Main {
|
|||||||
if (line.substring(0, pos).toLowerCase().equals("level-name")) {
|
if (line.substring(0, pos).toLowerCase().equals("level-name")) {
|
||||||
worldPath = serverPath + separator + line.substring(pos + 1);
|
worldPath = serverPath + separator + line.substring(pos + 1);
|
||||||
worldName = line.substring(pos + 1);
|
worldName = line.substring(pos + 1);
|
||||||
} else if (line.substring(0, pos).toLowerCase().equals("hellworld")) {
|
|
||||||
hell = line.substring(pos + 1);
|
|
||||||
hell = hell.toLowerCase(Locale.ENGLISH);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -331,11 +414,8 @@ public class Main {
|
|||||||
// =====================================================================
|
// =====================================================================
|
||||||
|
|
||||||
System.out.println("Processing world \"" + worldPath + "\", in " + increment + " block increments, with: " + javaLine);
|
System.out.println("Processing world \"" + worldPath + "\", in " + increment + " block increments, with: " + javaLine);
|
||||||
if (hell.contains("true")){
|
//System.out.println("Processing \"" + worldName + "\"...");
|
||||||
System.out.println("Processing The Nether of \"" + worldName + "\"... (DIM-1)");
|
|
||||||
} else if (hell.contains("false")) {
|
|
||||||
System.out.println("Processing \"" + worldName + "\"...");
|
|
||||||
}
|
|
||||||
System.out.println("");
|
System.out.println("");
|
||||||
|
|
||||||
// prepare our two ProcessBuilders
|
// prepare our two ProcessBuilders
|
||||||
@ -344,8 +424,6 @@ public class Main {
|
|||||||
minecraft.directory(new File(serverPath));
|
minecraft.directory(new File(serverPath));
|
||||||
minecraft.redirectErrorStream(true);
|
minecraft.redirectErrorStream(true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
System.out.println("Launching server once to make sure there is a world.");
|
System.out.println("Launching server once to make sure there is a world.");
|
||||||
runMinecraft(minecraft, verbose, alternate, javaLine);
|
runMinecraft(minecraft, verbose, alternate, javaLine);
|
||||||
@ -386,6 +464,9 @@ public class Main {
|
|||||||
for (int currentX = 0 - xRange / 2; currentX <= xRange / 2; currentX += increment) {
|
for (int currentX = 0 - xRange / 2; currentX <= xRange / 2; currentX += increment) {
|
||||||
for (int currentY = 0 - yRange / 2; currentY <= yRange / 2; currentY += increment) {
|
for (int currentY = 0 - yRange / 2; currentY <= yRange / 2; currentY += increment) {
|
||||||
currentIteration++;
|
currentIteration++;
|
||||||
|
|
||||||
|
System.out.println(Integer.toString(currentIteration / totalIterations) + "% Done");
|
||||||
|
|
||||||
System.out.println("Setting spawn to [" + Integer.toString(currentX + xOffset) + ", " + Integer.toString(currentY + yOffset) + "] (" + currentIteration + "/" + totalIterations + ")");
|
System.out.println("Setting spawn to [" + Integer.toString(currentX + xOffset) + ", " + Integer.toString(currentY + yOffset) + "] (" + currentIteration + "/" + totalIterations + ")");
|
||||||
|
|
||||||
// Time Remaining estimate
|
// Time Remaining estimate
|
||||||
@ -432,6 +513,11 @@ public class Main {
|
|||||||
IntTag spawnY = (IntTag) newData.get("SpawnY");
|
IntTag spawnY = (IntTag) newData.get("SpawnY");
|
||||||
IntTag spawnZ = (IntTag) newData.get("SpawnZ");
|
IntTag spawnZ = (IntTag) newData.get("SpawnZ");
|
||||||
|
|
||||||
|
randomSeed = (LongTag) newData.get("RandomSeed");
|
||||||
|
if (randomSeed.getValue() != 0) {
|
||||||
|
System.out.println("Seed: " + randomSeed.getValue()); //lets output the seed, cause why not?
|
||||||
|
}
|
||||||
|
|
||||||
Integer[] ret = new Integer[]{spawnX.getValue(), spawnY.getValue(), spawnZ.getValue()};
|
Integer[] ret = new Integer[]{spawnX.getValue(), spawnY.getValue(), spawnZ.getValue()};
|
||||||
return ret;
|
return ret;
|
||||||
} catch (ClassCastException ex) {
|
} catch (ClassCastException ex) {
|
||||||
@ -442,7 +528,7 @@ public class Main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the spawn point in the given Alpha level to the given coordinates.
|
* Changes the spawn point in the given Alpha/Beta level to the given coordinates.
|
||||||
* Note that, in Minecraft levels, the Y coordinate is height, while Z is
|
* Note that, in Minecraft levels, the Y coordinate is height, while Z is
|
||||||
* what may normally be thought of as Y.
|
* what may normally be thought of as Y.
|
||||||
* @param level the level file to change the spawn point in
|
* @param level the level file to change the spawn point in
|
||||||
@ -474,7 +560,7 @@ public class Main {
|
|||||||
// * TAG_Int("SpawnX"): X coordinate of the player's spawn position. Default is 0.
|
// * TAG_Int("SpawnX"): X coordinate of the player's spawn position. Default is 0.
|
||||||
// * TAG_Int("SpawnY"): Y coordinate of the player's spawn position. Default is 64.
|
// * TAG_Int("SpawnY"): Y coordinate of the player's spawn position. Default is 64.
|
||||||
// * TAG_Int("SpawnZ"): Z coordinate of the player's spawn position. Default is 0.
|
// * TAG_Int("SpawnZ"): Z coordinate of the player's spawn position. Default is 0.
|
||||||
// * TAG_Byte("SnowCovered"): 1 enables, 0 disables, see Winter Mode
|
// * TAG_Byte("SnowCovered"): 1 enables, 0 disables, see Winter Mode //Old!
|
||||||
// * TAG_Long("SizeOnDisk"): Estimated size of the entire world in bytes.
|
// * TAG_Long("SizeOnDisk"): Estimated size of the entire world in bytes.
|
||||||
// * TAG_Long("RandomSeed"): Random number providing the Random Seed for the terrain.
|
// * TAG_Long("RandomSeed"): Random number providing the Random Seed for the terrain.
|
||||||
// </editor-fold>
|
// </editor-fold>
|
||||||
@ -483,12 +569,14 @@ public class Main {
|
|||||||
// This is our map of data. It is an unmodifiable map, for some reason, so we have to make a copy.
|
// This is our map of data. It is an unmodifiable map, for some reason, so we have to make a copy.
|
||||||
Map<String, Tag> newData = new LinkedHashMap<String, Tag>(originalData);
|
Map<String, Tag> newData = new LinkedHashMap<String, Tag>(originalData);
|
||||||
// .get() a couple of values, just to make sure we're dealing with a valid level file, here. Good for debugging, too.
|
// .get() a couple of values, just to make sure we're dealing with a valid level file, here. Good for debugging, too.
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
IntTag spawnX = (IntTag) newData.get("SpawnX"); //we never use these...
|
IntTag spawnX = (IntTag) newData.get("SpawnX"); // we never use these... Its only here for potential debugging.
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
IntTag spawnY = (IntTag) newData.get("SpawnY"); //but whatever...
|
IntTag spawnY = (IntTag) newData.get("SpawnY"); // but whatever... so I (Morlok8k) suppressed these warnings.
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
IntTag spawnZ = (IntTag) newData.get("SpawnZ");
|
IntTag spawnZ = (IntTag) newData.get("SpawnZ"); // I don't want to remove existing code, either by myself (Morlok8k) or Corrodias
|
||||||
|
|
||||||
newData.put("SpawnX", new IntTag("SpawnX", x));
|
newData.put("SpawnX", new IntTag("SpawnX", x));
|
||||||
newData.put("SpawnY", new IntTag("SpawnY", y));
|
newData.put("SpawnY", new IntTag("SpawnY", y));
|
||||||
newData.put("SpawnZ", new IntTag("SpawnZ", z));
|
newData.put("SpawnZ", new IntTag("SpawnZ", z));
|
||||||
@ -532,43 +620,25 @@ public class Main {
|
|||||||
// So, here is a bunch of duplicate code...
|
// So, here is a bunch of duplicate code...
|
||||||
// Stupid compile errors...
|
// Stupid compile errors...
|
||||||
|
|
||||||
if (alternate) { //Alternate is currently disabled.
|
if (alternate) { //Alternate - a replication of MLG 1.3.0's code. simplest code possible.
|
||||||
// Runtime minecraftAlt = Runtime.getRuntime();
|
System.out.println("Starting server.");
|
||||||
// Process process = minecraftAlt.exec(javaLine.split("\\s"));
|
Process process = minecraft.start();
|
||||||
// //InputStream is = processAlt.getInputStream();
|
|
||||||
// // this didn't work - Minecraft Server uses the error stream for almost all the output.
|
// monitor output and print to console where required.
|
||||||
// // the input stream only reads the amount of recipes the server has, for instance, beta 1.4 reports: "144 recipes"
|
// STOP the server when it's done.
|
||||||
// // with the standard way, ProcessBuilder, we can combine Error and Input.
|
BufferedReader pOut = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||||
// //InputStreamReader isr = new InputStreamReader(is);
|
String line;
|
||||||
// //BufferedReader pOut = new BufferedReader(isr);
|
while ((line = pOut.readLine()) != null) {
|
||||||
// BufferedReader pOut = new BufferedReader(new InputStreamReader(process.getErrorStream()));
|
System.out.println(line);
|
||||||
//
|
if (line.contains("[INFO] Done")) { //EDITED By Morlok8k for Minecraft 1.3+ Beta
|
||||||
// String line = null;
|
System.out.println("Stopping server.");
|
||||||
//
|
byte[] stop = {'s', 't', 'o', 'p', '\r', '\n'};
|
||||||
// byte[] stop = {'s', 't', 'o', 'p', '\r', '\n'}; //Moved here, so this code wont run every loop, thus Faster!
|
OutputStream outputStream = process.getOutputStream();
|
||||||
// //and no, i can't use a string here!
|
outputStream.write(stop);
|
||||||
//
|
outputStream.flush();
|
||||||
// while ((line = pOut.readLine()) != null) {
|
}
|
||||||
// if (verbose) {
|
}
|
||||||
// System.out.println(line);
|
// readLine() returns null when the process exits
|
||||||
// }
|
|
||||||
// if (line.contains("[INFO] Done")) { //EDITED By Morlok8k for Minecraft 1.3+ Beta
|
|
||||||
// System.out.println("Stopping server.");
|
|
||||||
// OutputStream outputStream = process.getOutputStream();
|
|
||||||
// outputStream.write(stop);
|
|
||||||
// outputStream.flush();
|
|
||||||
// outputStream.close();
|
|
||||||
// }
|
|
||||||
// if (line.contains("[SEVERE]")) { //If we have a severe error, stop...
|
|
||||||
// System.out.println("Severe error found: Stopping server.");
|
|
||||||
// OutputStream outputStream = process.getOutputStream();
|
|
||||||
// outputStream.write(stop);
|
|
||||||
// outputStream.flush();
|
|
||||||
// outputStream.close();
|
|
||||||
System.exit(1);
|
|
||||||
// //Quit!
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
} else { //start minecraft server normally!
|
} else { //start minecraft server normally!
|
||||||
Process process = minecraft.start();
|
Process process = minecraft.start();
|
||||||
@ -581,12 +651,14 @@ public class Main {
|
|||||||
System.out.println("Accessing Server Output...");
|
System.out.println("Accessing Server Output...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
String line = null;
|
String line = null;
|
||||||
|
|
||||||
byte[] stop = {'s', 't', 'o', 'p', '\r', '\n'}; //Moved here, so this code wont run every loop, thus Faster!
|
byte[] stop = {'s', 't', 'o', 'p', '\r', '\n'}; //Moved here, so this code wont run every loop, thus Faster!
|
||||||
//and no, i can't use a string here!
|
//and no, i can't use a string here!
|
||||||
|
|
||||||
|
OutputStream outputStream = process.getOutputStream(); //moved here to remove some redundancy
|
||||||
|
|
||||||
|
|
||||||
while ((line = pOut.readLine()) != null) {
|
while ((line = pOut.readLine()) != null) {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
if (line.contains("[INFO]")){
|
if (line.contains("[INFO]")){
|
||||||
@ -596,51 +668,82 @@ public class Main {
|
|||||||
}
|
}
|
||||||
} else if (line.contains(preparingText)){
|
} else if (line.contains(preparingText)){
|
||||||
System.out.print(line.substring(line.length() - 3, line.length()) + "... ");
|
System.out.print(line.substring(line.length() - 3, line.length()) + "... ");
|
||||||
|
} else if (line.contains(preparingLevel)){
|
||||||
|
if (line.contains("level 0")) { //"Preparing start region for level 0"
|
||||||
|
System.out.println("\r\n" + worldName + ":");
|
||||||
|
} else if (line.contains("level 1")) { //"Preparing start region for level 1"
|
||||||
|
System.out.println("\r\n" + level_1 + ":");
|
||||||
|
} else if (line.contains("level 2")) { //"Preparing start region for level 2"
|
||||||
|
System.out.println("\r\n" + level_2 + ":");
|
||||||
|
} else if (line.contains("level 3")) { //"Preparing start region for level 3"
|
||||||
|
System.out.println("\r\n" + level_3 + ":");
|
||||||
|
} else if (line.contains("level 4")) { //"Preparing start region for level 4"
|
||||||
|
System.out.println("\r\n" + level_4 + ":");
|
||||||
|
} else if (line.contains("level 5")) { //"Preparing start region for level 5"
|
||||||
|
System.out.println("\r\n" + level_5 + ":");
|
||||||
|
} else if (line.contains("level 6")) { //"Preparing start region for level 6"
|
||||||
|
System.out.println("\r\n" + level_6 + ":");
|
||||||
|
} else if (line.contains("level 7")) { //"Preparing start region for level 7"
|
||||||
|
System.out.println("\r\n" + level_7 + ":");
|
||||||
|
} else if (line.contains("level 8")) { //"Preparing start region for level 8"
|
||||||
|
System.out.println("\r\n" + level_8 + ":");
|
||||||
|
} else if (line.contains("level 9")) { //"Preparing start region for level 9"
|
||||||
|
System.out.println("\r\n" + level_9 + ":");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (line.contains(doneText)) { // now this is configurable!
|
if (line.contains(doneText)) { // now this is configurable!
|
||||||
System.out.println("");
|
System.out.println("");
|
||||||
System.out.println("Stopping server.");
|
System.out.println("Stopping server.");
|
||||||
OutputStream outputStream = process.getOutputStream();
|
//OutputStream outputStream = process.getOutputStream();
|
||||||
outputStream.write(stop);
|
outputStream.write(stop);
|
||||||
outputStream.flush();
|
outputStream.flush();
|
||||||
outputStream.close();
|
//outputStream.close();
|
||||||
}
|
}
|
||||||
if (ignoreWarnings == false) {
|
if (ignoreWarnings == false) {
|
||||||
if (line.contains("[WARNING]")) { //If we have a severe error, stop...
|
if (line.contains("[WARNING]")) { //If we have a severe error, stop...
|
||||||
System.out.println("");
|
System.out.println("");
|
||||||
System.out.println("Warning found: Stopping Minecraft Land Generator");
|
System.out.println("Warning found: Stopping Minecraft Land Generator");
|
||||||
System.out.println("");
|
System.out.println("");
|
||||||
OutputStream outputStream = process.getOutputStream();
|
//OutputStream outputStream = process.getOutputStream();
|
||||||
outputStream.write(stop); //if the warning was a fail to bind to port, we may need to write stop twice! (but since we write stop every time we see a warning, we should be fine.)
|
outputStream.write(stop); //if the warning was a fail to bind to port, we may need to write stop twice!
|
||||||
outputStream.flush();
|
outputStream.flush();
|
||||||
outputStream.close();
|
outputStream.write(stop);
|
||||||
|
outputStream.flush();
|
||||||
|
//outputStream.close();
|
||||||
warning = true;
|
warning = true;
|
||||||
|
//System.exit(1);
|
||||||
}
|
}
|
||||||
if (line.contains("[SEVERE]")) { //If we have a severe error, stop...
|
if (line.contains("[SEVERE]")) { //If we have a severe error, stop...
|
||||||
System.out.println("");
|
System.out.println("");
|
||||||
System.out.println("Severe error found: Stopping server.");
|
System.out.println("Severe error found: Stopping server.");
|
||||||
OutputStream outputStream = process.getOutputStream();
|
System.out.println("");
|
||||||
|
//OutputStream outputStream = process.getOutputStream();
|
||||||
outputStream.write(stop);
|
outputStream.write(stop);
|
||||||
outputStream.flush();
|
outputStream.flush();
|
||||||
outputStream.close();
|
outputStream.write(stop); //sometimes we need to do stop twice...
|
||||||
System.exit(1);
|
outputStream.flush();
|
||||||
|
//outputStream.close();
|
||||||
|
warning = true;
|
||||||
|
//System.exit(1);
|
||||||
//Quit!
|
//Quit!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (warning == true){
|
if (warning == true){ //in 1.4.4 we had a issue. tried to write stop twice, but we had closed the stream already. this, and other lines should fix this.
|
||||||
|
outputStream.flush();
|
||||||
|
outputStream.close();
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
outputStream.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// readLine() returns null when the process exits
|
// readLine() returns null when the process exits
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Corrodias:
|
||||||
// I'd love to use nio, but it requires Java 7.
|
// I'd love to use nio, but it requires Java 7.
|
||||||
// I could use Apache Commons, but i don't want to include a library for one little thing.
|
// I could use Apache Commons, but i don't want to include a library for one little thing.
|
||||||
// Copies src file to dst file.
|
// Copies src file to dst file.
|
||||||
|
Reference in New Issue
Block a user