add hashCode to Vector2Int

This commit is contained in:
dfsek
2021-12-21 23:10:35 -07:00
parent 0e87da2eff
commit 849b3116c9

View File

@@ -2,6 +2,8 @@ package com.dfsek.terra.api.util.vector;
import com.dfsek.terra.api.util.Rotation;
import java.util.Objects;
/**
* oh yeah
@@ -82,4 +84,17 @@ public class Vector2Int {
return new Vector2Int(x, z);
}
}
@Override
public int hashCode() {
return (31 * x) + z;
}
@Override
public boolean equals(Object obj) {
if(obj instanceof Vector2Int that) {
return this.x == that.x && this.z == that.z;
}
return false;
}
}