modified jaseg's patch to actually compile
This commit is contained in:
parent
c8ace9f87f
commit
267474b20c
@ -1,5 +1,8 @@
|
|||||||
package morlok8k.MinecraftLandGenerator;
|
package morlok8k.MinecraftLandGenerator;
|
||||||
|
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Coordinates are in the form of [X,Y,Z] or (X,Z)<br>
|
* Coordinates are in the form of [X,Y,Z] or (X,Z)<br>
|
||||||
* <br>
|
* <br>
|
||||||
@ -79,38 +82,39 @@ public class Coordinates {
|
|||||||
*/
|
*/
|
||||||
public void setZ(final int z) {
|
public void setZ(final int z) {
|
||||||
Z = z;
|
Z = z;
|
||||||
=======
|
|
||||||
public void setX(int x) {
|
|
||||||
x = x;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setY(int y) {
|
public void clear() {
|
||||||
y = y;
|
X = 0;
|
||||||
}
|
Y = 0;
|
||||||
|
Z = 0;
|
||||||
public void setZ(int z) {
|
|
||||||
z = z;
|
|
||||||
>>>>>>> 8979eb4... Fixed some pretty hairy code in Coordinates.java, THEREBY BREAKING THE:src/morlok8k/minecraft/landgenerator/Coordinates.java
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses a Coordinates object from a String. Leading and trailing garbage is ignored (FIXME).
|
* Parses a Coordinates object from a String. Leading and trailing garbage is ignored (FIXME).
|
||||||
* @param s A short- or long-form coordinate string as described at the two toString() methods
|
*
|
||||||
* @throws IllegalArgumentException if s does not match a short or long form coordinate
|
* @param stringOfCoords
|
||||||
|
* A short- or long-form coordinate string as described at the two toString() methods
|
||||||
|
* @author jaseg
|
||||||
*/
|
*/
|
||||||
public static Coordinates parseString(String s) {
|
public static Coordinates parseStringRegEx(String stringOfCoords) {
|
||||||
Matcher shortForm = Pattern.compile("\\((\\d+),(\\d+)\\)").matcher(s);
|
Matcher shortForm = Pattern.compile("\\((\\d+),(\\d+)\\)").matcher(stringOfCoords);
|
||||||
if(shortForm.matches()){
|
if (shortForm.matches()) { return new Coordinates(Integer.parseInt(shortForm.group(1)), 64,
|
||||||
return new Coordinates(Interger.parseInt(shortForm.group(1)), 64, Integer.parseInt(shortForm.group(2)));
|
Integer.parseInt(shortForm.group(2))); }
|
||||||
}
|
Matcher normalForm = Pattern.compile("\\[(\\d+),(\\d+),(\\d+)\\]").matcher(stringOfCoords);
|
||||||
Matcher normalForm = Pattern.compile("\\[(\\d+),(\\d+),(\\d+)\\]").matcher(s);
|
if (normalForm.matches()) { return new Coordinates(Integer.parseInt(shortForm.group(1)),
|
||||||
if(normalForm.matches()){
|
Integer.parseInt(shortForm.group(2)), Integer.parseInt(shortForm.group(3))); }
|
||||||
return new Coordinates(Interger.parseInt(shortForm.group(1)), Integer.parseInt(shortForm.group(2)), Integer.parseInt(shortForm.group(3)));
|
Main.err("Invalid coordinate format: " + stringOfCoords);
|
||||||
}
|
return new Coordinates(0, 0, 0);
|
||||||
throw new InvalidArgumentException("Invalid coordinate format: "+s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD:src/morlok8k/MinecraftLandGenerator/Coordinates.java
|
/**
|
||||||
|
* Parses a Coordinates object from a String. Leading and trailing garbage is ignored (FIXME).
|
||||||
|
*
|
||||||
|
* @param StringOfCoords
|
||||||
|
* A short- or long-form coordinate string as described at the two toString() methods
|
||||||
|
* @author Morlok8k
|
||||||
|
*/
|
||||||
public static Coordinates parseString(String StringOfCoords) {
|
public static Coordinates parseString(String StringOfCoords) {
|
||||||
//parse out string
|
//parse out string
|
||||||
StringOfCoords = StringOfCoords.trim();
|
StringOfCoords = StringOfCoords.trim();
|
||||||
|
Reference in New Issue
Block a user