mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-17 01:15:52 +01:00
Blossom Implement (#1606)
* Blossom! * rename * delete SpawnBlossomEntry.java * use MAP * use List * use LIST * use List * useCondensedResin * useCondensedResin * fix build * enhance * fix bug * REMOVE BOSS * fix condensed resin * fix condensed resin * use POSITIVE_INFINITY * use RewardPreviewData * fix build * fix resources * add BLOSSOM_MONSTER_FIGHTING_VOLUME * edit monster score * edit monster score * fix bug * fix bug * improve logic * fix monsters level * Deleted comment blocks * nitpick * Fix compilation problems * nitpick * Refactor + nitpick * Clean up overall diff to develop * Clean up other usage of condensed resin * Clean up overall diff to develop * Lombokify Scene.java * Missed an odd getter name * Unhardcode reward previews * EDIT NAME * remove leyline 1 * remove leyline 2 * Update BlossomManager.java Co-authored-by: AnimeGitB <AnimeGitB@bigblueball.in>
This commit is contained in:
@@ -10,28 +10,28 @@ import emu.grasscutter.net.proto.VectorOuterClass.Vector;
|
||||
@Entity
|
||||
public class Position implements Serializable {
|
||||
private static final long serialVersionUID = -2001232313615923575L;
|
||||
|
||||
|
||||
@SerializedName(value="x", alternate={"_x", "X"})
|
||||
private float x;
|
||||
|
||||
|
||||
@SerializedName(value="y", alternate={"_y", "Y"})
|
||||
private float y;
|
||||
|
||||
|
||||
@SerializedName(value="z", alternate={"_z", "Z"})
|
||||
private float z;
|
||||
|
||||
|
||||
public Position() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public Position(float x, float y) {
|
||||
set(x, y);
|
||||
}
|
||||
|
||||
|
||||
public Position(float x, float y, float z) {
|
||||
set(x, y, z);
|
||||
}
|
||||
|
||||
|
||||
public Position(String p) {
|
||||
String[] split = p.split(",");
|
||||
if (split.length >= 2) {
|
||||
@@ -42,7 +42,7 @@ public class Position implements Serializable {
|
||||
this.z = Float.parseFloat(split[2]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Position(Vector vector) {
|
||||
this.set(vector);
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public class Position implements Serializable {
|
||||
public void setZ(float z) {
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
|
||||
public float getY() {
|
||||
return y;
|
||||
}
|
||||
@@ -74,22 +74,22 @@ public class Position implements Serializable {
|
||||
public void setY(float y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
@@ -103,17 +103,17 @@ public class Position implements Serializable {
|
||||
this.z += add.getZ();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public Position addX(float d) {
|
||||
this.x += d;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public Position addY(float d) {
|
||||
this.y += d;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public Position addZ(float d) {
|
||||
this.z += d;
|
||||
return this;
|
||||
@@ -125,7 +125,7 @@ public class Position implements Serializable {
|
||||
this.z -= sub.getZ();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/** In radians
|
||||
* */
|
||||
public Position translate(float dist, float angle) {
|
||||
@@ -149,13 +149,20 @@ public class Position implements Serializable {
|
||||
double detZ = getZ()-b.getZ();
|
||||
return Math.sqrt(detX*detX+detY*detY+detZ*detZ);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Position clone() {
|
||||
return new Position(x, y, z);
|
||||
@@ -165,7 +172,7 @@ public class Position implements Serializable {
|
||||
public String toString() {
|
||||
return "(" + this.getX() + ", " + this.getY() + ", " + this.getZ() + ")";
|
||||
}
|
||||
|
||||
|
||||
public Vector toProto() {
|
||||
return Vector.newBuilder()
|
||||
.setX(this.getX())
|
||||
|
||||
Reference in New Issue
Block a user