aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/api/0009-Add-Position.patch
diff options
context:
space:
mode:
authorTonytheMacaroni <[email protected]>2023-11-04 18:00:51 -0400
committerGitHub <[email protected]>2023-11-04 15:00:51 -0700
commit23860da6c2f306fdc598fb0d09132636c7141dfd (patch)
tree612c364ffabbefde18c9ed2680583c240075ba94 /patches/api/0009-Add-Position.patch
parent8a3980c60bd09eb1d0d21bfc846181a49c0d74df (diff)
downloadPaper-23860da6c2f306fdc598fb0d09132636c7141dfd.tar.gz
Paper-23860da6c2f306fdc598fb0d09132636c7141dfd.zip
Add predicate for block when raytracing (#9691)
* Add predicate for block data when raytracing blocks * Match based on block, instead of block data * Use instanceof instead of casting * Use Position instead of Location, add overload for rayTraceEntities * Implement requested changes * Invert predicate * Cleanup
Diffstat (limited to 'patches/api/0009-Add-Position.patch')
-rw-r--r--patches/api/0009-Add-Position.patch20
1 files changed, 16 insertions, 4 deletions
diff --git a/patches/api/0009-Add-Position.patch b/patches/api/0009-Add-Position.patch
index 4d6b5f241e..c56e4e0a0e 100644
--- a/patches/api/0009-Add-Position.patch
+++ b/patches/api/0009-Add-Position.patch
@@ -192,10 +192,10 @@ index 0000000000000000000000000000000000000000..93476aaf8d21efb5a30b6d2cc2eeda81
+}
diff --git a/src/main/java/io/papermc/paper/math/Position.java b/src/main/java/io/papermc/paper/math/Position.java
new file mode 100644
-index 0000000000000000000000000000000000000000..300da713dcc303b340efad70efe57facf5422964
+index 0000000000000000000000000000000000000000..26bc5a0fa67855af87c8fd4cd8229b4d9f242740
--- /dev/null
+++ b/src/main/java/io/papermc/paper/math/Position.java
-@@ -0,0 +1,184 @@
+@@ -0,0 +1,191 @@
+package io.papermc.paper.math;
+
+import org.bukkit.Location;
@@ -273,6 +273,13 @@ index 0000000000000000000000000000000000000000..300da713dcc303b340efad70efe57fac
+ boolean isFine();
+
+ /**
++ * Checks if each component of this position is finite.
++ */
++ default boolean isFinite() {
++ return Double.isFinite(this.x()) && Double.isFinite(this.y()) && Double.isFinite(this.z());
++ }
++
++ /**
+ * Returns a position offset by the specified amounts.
+ *
+ * @param x x value to offset
@@ -381,7 +388,7 @@ index 0000000000000000000000000000000000000000..300da713dcc303b340efad70efe57fac
+ }
+}
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
-index 7c4db051472fb6a6c6d24092dc6f75487356690a..3b99f359f556e6f2c341d55fa69b7462e69b6546 100644
+index 7c4db051472fb6a6c6d24092dc6f75487356690a..85c342fc50f2fe0ce9a1b3980df9e088c3dea92d 100644
--- a/src/main/java/org/bukkit/Location.java
+++ b/src/main/java/org/bukkit/Location.java
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.Nullable;
@@ -393,7 +400,7 @@ index 7c4db051472fb6a6c6d24092dc6f75487356690a..3b99f359f556e6f2c341d55fa69b7462
private Reference<World> world;
private double x;
private double y;
-@@ -706,4 +706,26 @@ public class Location implements Cloneable, ConfigurationSerializable {
+@@ -706,4 +706,31 @@ public class Location implements Cloneable, ConfigurationSerializable {
}
return pitch;
}
@@ -415,6 +422,11 @@ index 7c4db051472fb6a6c6d24092dc6f75487356690a..3b99f359f556e6f2c341d55fa69b7462
+ }
+
+ @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());
+ }