fix: make IntVector2 not return references

This commit is contained in:
punchready 2021-06-04 05:13:37 +02:00
parent 27adfd1b6f
commit e10fbb15eb

View File

@ -79,9 +79,7 @@ public class IntVector2 implements Serializable {
} }
public IntVector2 sub(int x, int y) { public IntVector2 sub(int x, int y) {
this.x -= x; return new IntVector2(this.x - x, this.y - y);
this.y -= y;
return this;
} }
public IntVector2 sub(IntVector2 v) { public IntVector2 sub(IntVector2 v) {
@ -89,9 +87,7 @@ public class IntVector2 implements Serializable {
} }
public IntVector2 add(int x, int y) { public IntVector2 add(int x, int y) {
this.x += x; return new IntVector2(this.x + x, this.y + y);
this.y += y;
return this;
} }
public IntVector2 add(IntVector2 v) { public IntVector2 add(IntVector2 v) {
@ -111,9 +107,7 @@ public class IntVector2 implements Serializable {
} }
public IntVector2 scale(float x, float y) { public IntVector2 scale(float x, float y) {
this.x *= x; return new IntVector2((int)(this.x * x), (int)(this.y * y));
this.y *= y;
return this;
} }
public IntVector2 scale(float scalar) { public IntVector2 scale(float scalar) {