From e10fbb15eb115c90083dac154ac0fc8208f3a38c Mon Sep 17 00:00:00 2001 From: punchready Date: Fri, 4 Jun 2021 05:13:37 +0200 Subject: [PATCH] fix: make IntVector2 not return references --- .../teamname/marvelous/gamelibrary/IntVector2.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/IntVector2.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/IntVector2.java index f409a48..16493f3 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/IntVector2.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/IntVector2.java @@ -79,9 +79,7 @@ public class IntVector2 implements Serializable { } public IntVector2 sub(int x, int y) { - this.x -= x; - this.y -= y; - return this; + return new IntVector2(this.x - x, this.y - y); } public IntVector2 sub(IntVector2 v) { @@ -89,9 +87,7 @@ public class IntVector2 implements Serializable { } public IntVector2 add(int x, int y) { - this.x += x; - this.y += y; - return this; + return new IntVector2(this.x + x, this.y + y); } public IntVector2 add(IntVector2 v) { @@ -111,9 +107,7 @@ public class IntVector2 implements Serializable { } public IntVector2 scale(float x, float y) { - this.x *= x; - this.y *= y; - return this; + return new IntVector2((int)(this.x * x), (int)(this.y * y)); } public IntVector2 scale(float scalar) {