mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-06 16:37:38 +01:00
documentation
This commit is contained in:
parent
5954988498
commit
0f98877b95
@ -1,11 +1,16 @@
|
|||||||
package net.minestom.server.utils.incubator;
|
package net.minestom.server.utils.incubator;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
import org.jetbrains.annotations.Contract;
|
import org.jetbrains.annotations.Contract;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a 3D point.
|
* Represents a 3D point.
|
||||||
|
* <p>
|
||||||
|
* Can either be a {@link Pos} or {@link Vec}.
|
||||||
|
* Interface will become {@code sealed} in the future.
|
||||||
*/
|
*/
|
||||||
|
@ApiStatus.NonExtendable
|
||||||
public interface Point {
|
public interface Point {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,6 +5,11 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
import java.util.function.DoubleUnaryOperator;
|
import java.util.function.DoubleUnaryOperator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a position containing coordinates and a view.
|
||||||
|
* <p>
|
||||||
|
* To become record and primitive.
|
||||||
|
*/
|
||||||
public final class Pos implements Point {
|
public final class Pos implements Point {
|
||||||
private final double x, y, z;
|
private final double x, y, z;
|
||||||
private final float yaw, pitch;
|
private final float yaw, pitch;
|
||||||
@ -21,12 +26,12 @@ public final class Pos implements Point {
|
|||||||
this(x, y, z, 0, 0);
|
this(x, y, z, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pos(@NotNull Vec vec, float yaw, float pitch) {
|
public Pos(@NotNull Point point, float yaw, float pitch) {
|
||||||
this(vec.x(), vec.y(), vec.z(), yaw, pitch);
|
this(point.x(), point.y(), point.z(), yaw, pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pos(@NotNull Vec vec) {
|
public Pos(@NotNull Point point) {
|
||||||
this(vec.x(), vec.y(), vec.z(), 0, 0);
|
this(point, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Contract(pure = true)
|
@Contract(pure = true)
|
||||||
@ -35,8 +40,8 @@ public final class Pos implements Point {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Contract(pure = true)
|
@Contract(pure = true)
|
||||||
public @NotNull Pos withCoord(@NotNull Vec vec) {
|
public @NotNull Pos withCoord(@NotNull Point point) {
|
||||||
return withCoord(vec.x(), vec.y(), vec.z());
|
return withCoord(point.x(), point.y(), point.z());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Contract(pure = true)
|
@Contract(pure = true)
|
||||||
|
@ -10,6 +10,8 @@ import java.util.function.UnaryOperator;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an immutable 3D vector.
|
* Represents an immutable 3D vector.
|
||||||
|
* <p>
|
||||||
|
* To become record and primitive.
|
||||||
*/
|
*/
|
||||||
public final class Vec implements Point {
|
public final class Vec implements Point {
|
||||||
public static final Vec ZERO = new Vec(0);
|
public static final Vec ZERO = new Vec(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user