Paper/patches/api/0469-Split-Position-from-Lo...

52 lines
1.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Tue, 19 Dec 2023 23:39:49 -0800
Subject: [PATCH] Split Position from Location type hierarchy
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
index c6049747fc286acb4e8053901fcc517e5170afa2..4c86700438276c56f75d1904d687e3fdf83ef2d4 100644
--- a/src/main/java/org/bukkit/Location.java
+++ b/src/main/java/org/bukkit/Location.java
@@ -30,7 +30,7 @@ import org.bukkit.entity.Player;
* magnitude than 360 are valid, but may be normalized to any other equivalent
* representation by the implementation.
*/
-public class Location implements Cloneable, ConfigurationSerializable, io.papermc.paper.math.FinePosition { // Paper
+public class Location implements Cloneable, ConfigurationSerializable/*, io.papermc.paper.math.FinePosition*/ { // Paper
private Reference<World> world;
private double x;
private double y;
@@ -1172,29 +1172,8 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm
}
// Paper - add Position
- @Override
- public double x() {
- return this.getX();
- }
-
- @Override
- public double y() {
- return this.getY();
- }
-
- @Override
- public double z() {
- return this.getZ();
- }
-
- @Override
- public boolean isFinite() {
- return io.papermc.paper.math.FinePosition.super.isFinite() && Float.isFinite(this.getYaw()) && Float.isFinite(this.getPitch());
- }
-
- @Override
- public @NotNull Location toLocation(@NotNull World world) {
- return new Location(world, this.x(), this.y(), this.z(), this.getYaw(), this.getPitch());
+ public io.papermc.paper.math.@NotNull Position asPosition() {
+ return io.papermc.paper.math.Position.fine(this);
}
// Paper end
}