@Override
    public boolean equals(Object o) {
        if (o == this) return true;
        if (!(o instanceof Direction)) return false;
        final Direction other = (Direction) o;
        return Float.compare(this.getYaw(), other.getYaw()) == 0 &&
                Float.compare(this.getPitch(), other.getPitch()) == 0;
    }
An immutable and serializable direction object
helper/src/main/java/me/lucko/helper/serialize/Direction.java