diff --git a/src/main/java/net/minestom/server/utils/incubator/Point.java b/src/main/java/net/minestom/server/utils/incubator/Point.java index 9e59d4b3d..7d106570d 100644 --- a/src/main/java/net/minestom/server/utils/incubator/Point.java +++ b/src/main/java/net/minestom/server/utils/incubator/Point.java @@ -1,11 +1,16 @@ package net.minestom.server.utils.incubator; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; /** * Represents a 3D point. + *
+ * Can either be a {@link Pos} or {@link Vec}. + * Interface will become {@code sealed} in the future. */ +@ApiStatus.NonExtendable public interface Point { /** diff --git a/src/main/java/net/minestom/server/utils/incubator/Pos.java b/src/main/java/net/minestom/server/utils/incubator/Pos.java index e002279f4..4f2113dd3 100644 --- a/src/main/java/net/minestom/server/utils/incubator/Pos.java +++ b/src/main/java/net/minestom/server/utils/incubator/Pos.java @@ -5,6 +5,11 @@ import org.jetbrains.annotations.NotNull; import java.util.function.DoubleUnaryOperator; +/** + * Represents a position containing coordinates and a view. + *
+ * To become record and primitive. + */ public final class Pos implements Point { private final double x, y, z; private final float yaw, pitch; @@ -21,12 +26,12 @@ public final class Pos implements Point { this(x, y, z, 0, 0); } - public Pos(@NotNull Vec vec, float yaw, float pitch) { - this(vec.x(), vec.y(), vec.z(), yaw, pitch); + public Pos(@NotNull Point point, float yaw, float pitch) { + this(point.x(), point.y(), point.z(), yaw, pitch); } - public Pos(@NotNull Vec vec) { - this(vec.x(), vec.y(), vec.z(), 0, 0); + public Pos(@NotNull Point point) { + this(point, 0, 0); } @Contract(pure = true) @@ -35,8 +40,8 @@ public final class Pos implements Point { } @Contract(pure = true) - public @NotNull Pos withCoord(@NotNull Vec vec) { - return withCoord(vec.x(), vec.y(), vec.z()); + public @NotNull Pos withCoord(@NotNull Point point) { + return withCoord(point.x(), point.y(), point.z()); } @Contract(pure = true) diff --git a/src/main/java/net/minestom/server/utils/incubator/Vec.java b/src/main/java/net/minestom/server/utils/incubator/Vec.java index ce42006bc..5a45e940e 100644 --- a/src/main/java/net/minestom/server/utils/incubator/Vec.java +++ b/src/main/java/net/minestom/server/utils/incubator/Vec.java @@ -10,6 +10,8 @@ import java.util.function.UnaryOperator; /** * Represents an immutable 3D vector. + *
+ * To become record and primitive. */ public final class Vec implements Point { public static final Vec ZERO = new Vec(0);