public static Location fromString(String fields) throws CanaryDeserializeException {
Location loc = new Location(0, 0, 0);
String[] split = fields.split(";");
if (split.length != 7) {
throw new CanaryDeserializeException("Failed to deserialize Location: Expected fields are 7. Found " + split.length, "CanaryMod");
}
try {
loc.setX(Double.parseDouble(split[0]));
loc.setY(Double.parseDouble(split[1]));
loc.setZ(Double.parseDouble(split[2]));
loc.setPitch(Float.parseFloat(split[3]));
loc.setRotation(Float.parseFloat(split[4]));
loc.setType(DimensionType.fromId(Integer.parseInt(split[5])));
loc.setWorldName(split[6]);
return loc;
}
catch (NumberFormatException e) {
throw new CanaryDeserializeException("Failed to deserialize Location: " + e.getMessage(), "CanaryMod");
}
}