mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-05 06:51:22 +01:00
hashCode and equals for BlockPosition
This commit is contained in:
parent
05acfdf59f
commit
edf2def4e4
@ -1,5 +1,7 @@
|
||||
package net.minestom.server.utils;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
// TODO: pool block positions?
|
||||
public class BlockPosition {
|
||||
|
||||
@ -75,6 +77,21 @@ public class BlockPosition {
|
||||
return new Position(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
BlockPosition that = (BlockPosition) o;
|
||||
return x == that.x &&
|
||||
y == that.y &&
|
||||
z == that.z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BlockPosition[" + x + ":" + y + ":" + z + "]";
|
||||
|
Loading…
Reference in New Issue
Block a user