Vector and BlockVector should use the same hashCode

For example, the getChunks method returns a Set<Vector2D> which is
actually comprised of BlockVector2D, so using set.contains(some vector)
will always return false.

There's unlikely to be multiple entities on the same block, or above
y=256, so using the int coords is better.
This commit is contained in:
Jesse Boyd
2017-01-10 16:03:10 +11:00
parent 9f24f84c2b
commit ad7fdd19fb
4 changed files with 2 additions and 21 deletions

View File

@@ -80,12 +80,6 @@ public class BlockVector2D extends Vector2D {
}
@Override
public int hashCode() {
return (Integer.valueOf((int) x).hashCode() >> 13) ^
Integer.valueOf((int) z).hashCode();
}
@Override
public BlockVector2D toBlockVector2D() {
return this;