mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-17 01:15:52 +01:00
Fix whitespace [skip actions]
This commit is contained in:
@@ -85,7 +85,7 @@ public final class Language {
|
||||
String translated = Grasscutter.getLanguage().get(key);
|
||||
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
args[i] = switch(args[i].getClass().getSimpleName()) {
|
||||
args[i] = switch (args[i].getClass().getSimpleName()) {
|
||||
case "String" -> args[i];
|
||||
case "TextStrings" -> ((TextStrings) args[i]).get(0).replace("\\\\n", "\\n"); // TODO: Change this to server language
|
||||
default -> args[i].toString();
|
||||
@@ -116,7 +116,7 @@ public final class Language {
|
||||
String translated = getLanguage(langCode).get(key);
|
||||
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
args[i] = switch(args[i].getClass().getSimpleName()) {
|
||||
args[i] = switch (args[i].getClass().getSimpleName()) {
|
||||
case "String" -> args[i];
|
||||
case "TextStrings" -> ((TextStrings) args[i]).getGC(langCode).replace("\\\\n", "\n"); // Note that we don't unescape \n for server console
|
||||
default -> args[i].toString();
|
||||
@@ -347,7 +347,7 @@ public final class Language {
|
||||
Map<Integer, Int2ObjectMap<String>> mapLanguageMaps = // Separate step to process the textmaps in parallel
|
||||
TextStrings.LIST_LANGUAGES.parallelStream().collect(
|
||||
Collectors.toConcurrentMap(s -> TextStrings.MAP_LANGUAGES.getInt(s), s -> loadTextMapFile(s, nameHashes)));
|
||||
List<Int2ObjectMap<String>> languageMaps =
|
||||
List<Int2ObjectMap<String>> languageMaps =
|
||||
IntStream.range(0, TextStrings.NUM_LANGUAGES)
|
||||
.mapToObj(i -> mapLanguageMaps.get(i))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@@ -38,4 +38,4 @@ public class Location extends Position {
|
||||
public String toString() {
|
||||
return String.format("%s:%s,%s,%s", this.scene.getId(), this.getX(), this.getY(), this.getZ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,191 +9,191 @@ import emu.grasscutter.net.proto.VectorOuterClass.Vector;
|
||||
|
||||
@Entity
|
||||
public class Position implements Serializable {
|
||||
private static final long serialVersionUID = -2001232313615923575L;
|
||||
private static final long serialVersionUID = -2001232313615923575L;
|
||||
|
||||
@SerializedName(value="x", alternate={"_x", "X"})
|
||||
private float x;
|
||||
@SerializedName(value="x", alternate={"_x", "X"})
|
||||
private float x;
|
||||
|
||||
@SerializedName(value="y", alternate={"_y", "Y"})
|
||||
private float y;
|
||||
@SerializedName(value="y", alternate={"_y", "Y"})
|
||||
private float y;
|
||||
|
||||
@SerializedName(value="z", alternate={"_z", "Z"})
|
||||
private float z;
|
||||
@SerializedName(value="z", alternate={"_z", "Z"})
|
||||
private float z;
|
||||
|
||||
public Position() {
|
||||
public Position() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public Position(float x, float y) {
|
||||
set(x, y);
|
||||
}
|
||||
public Position(float x, float y) {
|
||||
set(x, y);
|
||||
}
|
||||
|
||||
public Position(float x, float y, float z) {
|
||||
set(x, y, z);
|
||||
}
|
||||
public Position(float x, float y, float z) {
|
||||
set(x, y, z);
|
||||
}
|
||||
|
||||
public Position(String p) {
|
||||
String[] split = p.split(",");
|
||||
if (split.length >= 2) {
|
||||
this.x = Float.parseFloat(split[0]);
|
||||
this.y = Float.parseFloat(split[1]);
|
||||
}
|
||||
if (split.length >= 3) {
|
||||
this.z = Float.parseFloat(split[2]);
|
||||
}
|
||||
}
|
||||
public Position(String p) {
|
||||
String[] split = p.split(",");
|
||||
if (split.length >= 2) {
|
||||
this.x = Float.parseFloat(split[0]);
|
||||
this.y = Float.parseFloat(split[1]);
|
||||
}
|
||||
if (split.length >= 3) {
|
||||
this.z = Float.parseFloat(split[2]);
|
||||
}
|
||||
}
|
||||
|
||||
public Position(Vector vector) {
|
||||
this.set(vector);
|
||||
}
|
||||
public Position(Vector vector) {
|
||||
this.set(vector);
|
||||
}
|
||||
|
||||
public Position(Position pos) {
|
||||
this.set(pos);
|
||||
}
|
||||
public Position(Position pos) {
|
||||
this.set(pos);
|
||||
}
|
||||
|
||||
public float getX() {
|
||||
return x;
|
||||
}
|
||||
public float getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(float x) {
|
||||
this.x = x;
|
||||
}
|
||||
public void setX(float x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public float getZ() {
|
||||
return z;
|
||||
}
|
||||
public float getZ() {
|
||||
return z;
|
||||
}
|
||||
|
||||
public void setZ(float z) {
|
||||
this.z = z;
|
||||
}
|
||||
public void setZ(float z) {
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public float getY() {
|
||||
return y;
|
||||
}
|
||||
public float getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setY(float y) {
|
||||
this.y = y;
|
||||
}
|
||||
public void setY(float y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public Position set(float x, float y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
return this;
|
||||
}
|
||||
public Position set(float x, float y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
return this;
|
||||
}
|
||||
|
||||
// Deep copy
|
||||
public Position set(Position pos) {
|
||||
return this.set(pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
// Deep copy
|
||||
public Position set(Position pos) {
|
||||
return this.set(pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
public Position set(Vector pos) {
|
||||
return this.set(pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
public Position set(Vector pos) {
|
||||
return this.set(pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
public Position set(float x, float y, float z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
return this;
|
||||
}
|
||||
public Position set(float x, float y, float z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Position add(Position add) {
|
||||
this.x += add.getX();
|
||||
this.y += add.getY();
|
||||
this.z += add.getZ();
|
||||
return this;
|
||||
}
|
||||
public Position add(Position add) {
|
||||
this.x += add.getX();
|
||||
this.y += add.getY();
|
||||
this.z += add.getZ();
|
||||
return this;
|
||||
}
|
||||
|
||||
public Position addX(float d) {
|
||||
this.x += d;
|
||||
return this;
|
||||
}
|
||||
public Position addX(float d) {
|
||||
this.x += d;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Position addY(float d) {
|
||||
this.y += d;
|
||||
return this;
|
||||
}
|
||||
public Position addY(float d) {
|
||||
this.y += d;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Position addZ(float d) {
|
||||
this.z += d;
|
||||
return this;
|
||||
}
|
||||
public Position addZ(float d) {
|
||||
this.z += d;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Position subtract(Position sub) {
|
||||
this.x -= sub.getX();
|
||||
this.y -= sub.getY();
|
||||
this.z -= sub.getZ();
|
||||
return this;
|
||||
}
|
||||
public Position subtract(Position sub) {
|
||||
this.x -= sub.getX();
|
||||
this.y -= sub.getY();
|
||||
this.z -= sub.getZ();
|
||||
return this;
|
||||
}
|
||||
|
||||
/** In radians
|
||||
* */
|
||||
public Position translate(float dist, float angle) {
|
||||
this.x += dist * Math.sin(angle);
|
||||
this.y += dist * Math.cos(angle);
|
||||
return this;
|
||||
}
|
||||
/** In radians
|
||||
* */
|
||||
public Position translate(float dist, float angle) {
|
||||
this.x += dist * Math.sin(angle);
|
||||
this.y += dist * Math.cos(angle);
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean equal2d(Position other) {
|
||||
// Y is height
|
||||
return getX() == other.getX() && getZ() == other.getZ();
|
||||
}
|
||||
public boolean equal2d(Position other) {
|
||||
// Y is height
|
||||
return getX() == other.getX() && getZ() == other.getZ();
|
||||
}
|
||||
|
||||
public boolean equal3d(Position other) {
|
||||
return getX() == other.getX() && getY() == other.getY() && getZ() == other.getZ();
|
||||
}
|
||||
public boolean equal3d(Position other) {
|
||||
return getX() == other.getX() && getY() == other.getY() && getZ() == other.getZ();
|
||||
}
|
||||
|
||||
public double computeDistance(Position b){
|
||||
double detX = getX()-b.getX();
|
||||
double detY = getY()-b.getY();
|
||||
double detZ = getZ()-b.getZ();
|
||||
return Math.sqrt(detX*detX+detY*detY+detZ*detZ);
|
||||
}
|
||||
public double computeDistance(Position b) {
|
||||
double detX = getX()-b.getX();
|
||||
double detY = getY()-b.getY();
|
||||
double detZ = getZ()-b.getZ();
|
||||
return Math.sqrt(detX*detX+detY*detY+detZ*detZ);
|
||||
}
|
||||
|
||||
public Position nearby2d(int range){
|
||||
public Position nearby2d(int range) {
|
||||
Position position = clone();
|
||||
position.z += (float)Utils.randomRange(-range,range)/10;
|
||||
position.x += (float)Utils.randomRange(-range,range)/10;
|
||||
return position;
|
||||
}
|
||||
public Position translateWithDegrees(float dist, float angle) {
|
||||
angle = (float) Math.toRadians(angle);
|
||||
this.x += dist * Math.sin(angle);
|
||||
this.y += -dist * Math.cos(angle);
|
||||
return this;
|
||||
}
|
||||
public Position translateWithDegrees(float dist, float angle) {
|
||||
angle = (float) Math.toRadians(angle);
|
||||
this.x += dist * Math.sin(angle);
|
||||
this.y += -dist * Math.cos(angle);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Position clone() {
|
||||
return new Position(x, y, z);
|
||||
}
|
||||
@Override
|
||||
public Position clone() {
|
||||
return new Position(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "(" + this.getX() + ", " + this.getY() + ", " + this.getZ() + ")";
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "(" + this.getX() + ", " + this.getY() + ", " + this.getZ() + ")";
|
||||
}
|
||||
|
||||
public Vector toProto() {
|
||||
return Vector.newBuilder()
|
||||
.setX(this.getX())
|
||||
.setY(this.getY())
|
||||
.setZ(this.getZ())
|
||||
.build();
|
||||
}
|
||||
public Point toPoint(){
|
||||
return Point.create(x,y,z);
|
||||
}
|
||||
public Vector toProto() {
|
||||
return Vector.newBuilder()
|
||||
.setX(this.getX())
|
||||
.setY(this.getY())
|
||||
.setZ(this.getZ())
|
||||
.build();
|
||||
}
|
||||
public Point toPoint() {
|
||||
return Point.create(x,y,z);
|
||||
}
|
||||
|
||||
/**
|
||||
* To XYZ array for Spatial Index
|
||||
*/
|
||||
public double[] toDoubleArray(){
|
||||
return new double[]{ x, y, z};
|
||||
}
|
||||
/**
|
||||
* To XZ array for Spatial Index (Blocks)
|
||||
*/
|
||||
public double[] toXZDoubleArray(){
|
||||
return new double[]{x, z};
|
||||
}
|
||||
/**
|
||||
* To XYZ array for Spatial Index
|
||||
*/
|
||||
public double[] toDoubleArray() {
|
||||
return new double[]{ x, y, z};
|
||||
}
|
||||
/**
|
||||
* To XZ array for Spatial Index (Blocks)
|
||||
*/
|
||||
public double[] toXZDoubleArray() {
|
||||
return new double[]{x, z};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public final class StartupArguments {
|
||||
boolean exitEarly = false;
|
||||
|
||||
// Parse the arguments.
|
||||
for(var input : args) {
|
||||
for (var input : args) {
|
||||
var containsParameter = input.contains("=");
|
||||
|
||||
var argument = containsParameter ? input.split("=")[0] : input;
|
||||
|
||||
Reference in New Issue
Block a user