Finish converting most of the undeprecated api to jspecify

This commit is contained in:
Jake Potrebic 2024-09-30 11:44:36 -07:00
parent ba3c29b92e
commit e7e1ab56ca
No known key found for this signature in database
GPG key ID: ECE0B3C133C016C5
45 changed files with 1046 additions and 982 deletions

View file

@ -6,22 +6,23 @@ Subject: [PATCH] Add FluidState API
diff --git a/src/main/java/io/papermc/paper/block/fluid/FluidData.java b/src/main/java/io/papermc/paper/block/fluid/FluidData.java
new file mode 100644
index 0000000000000000000000000000000000000000..913acd58547d97cafc1466f6e2b3b4d22cf0b02d
index 0000000000000000000000000000000000000000..0750219fc68261e5c396636967e0b633ae17b72e
--- /dev/null
+++ b/src/main/java/io/papermc/paper/block/fluid/FluidData.java
@@ -0,0 +1,68 @@
@@ -0,0 +1,69 @@
+package io.papermc.paper.block.fluid;
+
+import org.bukkit.Fluid;
+import org.bukkit.Location;
+import org.bukkit.util.Vector;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Range;
+import org.jspecify.annotations.NullMarked;
+
+/**
+ * A representation of a fluid in a specific state of data.
+ * This type is not linked to a specific location and hence mostly resembles a {@link org.bukkit.block.data.BlockData}.
+ */
+@NullMarked
+public interface FluidData extends Cloneable {
+
+ /**
@ -29,14 +30,14 @@ index 0000000000000000000000000000000000000000..913acd58547d97cafc1466f6e2b3b4d2
+ *
+ * @return the fluid type
+ */
+ @NotNull Fluid getFluidType();
+ Fluid getFluidType();
+
+ /**
+ * Returns a copy of this FluidData.
+ *
+ * @return a copy of the fluid data
+ */
+ @NotNull FluidData clone();
+ FluidData clone();
+
+ /**
+ * Computes the direction of the flow of the liquid at the given location as a vector.
@ -48,7 +49,7 @@ index 0000000000000000000000000000000000000000..913acd58547d97cafc1466f6e2b3b4d2
+ * @param location - the location to check the liquid flow
+ * @return the flow direction vector at the given location
+ */
+ @NotNull Vector computeFlowDirection(@NotNull Location location);
+ Vector computeFlowDirection(Location location);
+
+ /**
+ * Returns the level of liquid this fluid data holds.
@ -69,7 +70,7 @@ index 0000000000000000000000000000000000000000..913acd58547d97cafc1466f6e2b3b4d2
+ * @return the height as a float value
+ */
+ @Range(from = 0, to = 1)
+ float computeHeight(@NotNull Location location);
+ float computeHeight(Location location);
+
+ /**
+ * Returns whether this fluid is a source block