Schedule several things for removal in 1.21 (#9041)

This commit is contained in:
Jake Potrebic 2023-06-07 06:47:32 -07:00 committed by GitHub
parent d8e07590e3
commit 14cfd64d2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 145 additions and 137 deletions

View file

@ -7,26 +7,26 @@ Changed to use upstream's heightmap API - Machine_Maker
diff --git a/src/main/java/com/destroystokyo/paper/HeightmapType.java b/src/main/java/com/destroystokyo/paper/HeightmapType.java
new file mode 100644
index 0000000000000000000000000000000000000000..709e44ea1b14ab6917501c928e689cc6cbdf4bb4
index 0000000000000000000000000000000000000000..1c832d69bb3717dcfccf21e45f6f060a64eb4f11
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/HeightmapType.java
@@ -0,0 +1,39 @@
+package com.destroystokyo.paper;
+
+import org.bukkit.*;
+import org.jetbrains.annotations.ApiStatus;
+
+/**
+ * Enumeration of different heightmap types maintained by the server. Generally using these maps is much faster
+ * than using an iterative search for a block in a given x, z coordinate.
+ *
+ * @deprecated Upstream has added their own API for using the game heightmaps. See {@link org.bukkit.HeightMap} and the
+ * non-deprecated getHighestBlock methods on World such as {@link org.bukkit.World#getHighestBlockAt(Location, HeightMap)}.
+ * non-deprecated getHighestBlock methods on World such as {@link org.bukkit.World#getHighestBlockAt(org.bukkit.Location, org.bukkit.HeightMap)}.
+ */
+@Deprecated
+@Deprecated(forRemoval = true) @ApiStatus.ScheduledForRemoval(inVersion = "1.21")
+public enum HeightmapType {
+
+ /**
+ * The highest block used for lighting in the world. Also the block returned by {@link World#getHighestBlockYAt(int, int)}}
+ * The highest block used for lighting in the world. Also the block returned by {@link org.bukkit.World#getHighestBlockYAt(int, int)}}
+ */
+ LIGHT_BLOCKING,
+
@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..709e44ea1b14ab6917501c928e689cc6
+ SOLID_OR_LIQUID_NO_LEAVES;
+}
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
index 2b9a117804a8ca54b47e51e23359bd6e01087641..6bbf8468bc47e82b0aeb164e49cdb73d93bae87b 100644
index 2b9a117804a8ca54b47e51e23359bd6e01087641..1a60a18e15780128a1914826daa952ffacb92e9e 100644
--- a/src/main/java/org/bukkit/Location.java
+++ b/src/main/java/org/bukkit/Location.java
@@ -640,6 +640,47 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm
@ -79,7 +79,7 @@ index 2b9a117804a8ca54b47e51e23359bd6e01087641..6bbf8468bc47e82b0aeb164e49cdb73d
+ * @deprecated Use {@link org.bukkit.Location#toHighestLocation(HeightMap)}
+ */
+ @NotNull
+ @Deprecated
+ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21")
+ public Location toHighestLocation(@NotNull final com.destroystokyo.paper.HeightmapType heightmap) {
+ final Location ret = this.clone();
+ ret.setY(this.getWorld().getHighestBlockYAt(this, heightmap));
@ -103,7 +103,7 @@ index 2b9a117804a8ca54b47e51e23359bd6e01087641..6bbf8468bc47e82b0aeb164e49cdb73d
* Creates explosion at this location with given power
*
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 948a989aeea4165f0714db69c70ca8dcb488d44d..530d656aa5573c9783d07de23379657fe0c7cae5 100644
index 948a989aeea4165f0714db69c70ca8dcb488d44d..1ae0e12125421fd0c36fcfb82ccbb994578415d9 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -149,6 +149,87 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@ -127,7 +127,7 @@ index 948a989aeea4165f0714db69c70ca8dcb488d44d..530d656aa5573c9783d07de23379657f
+ *
+ * @see com.destroystokyo.paper.HeightmapType
+ */
+ @Deprecated
+ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21")
+ public int getHighestBlockYAt(int x, int z, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException;
+
+ /**
@ -145,7 +145,7 @@ index 948a989aeea4165f0714db69c70ca8dcb488d44d..530d656aa5573c9783d07de23379657f
+ * @deprecated Upstream has added support for this, use {@link World#getHighestBlockYAt(Location, HeightMap)}
+ * @see com.destroystokyo.paper.HeightmapType
+ */
+ @Deprecated
+ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21")
+ default int getHighestBlockYAt(@NotNull Location location, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException {
+ return this.getHighestBlockYAt(location.getBlockX(), location.getBlockZ(), heightmap);
+ }
@ -164,7 +164,7 @@ index 948a989aeea4165f0714db69c70ca8dcb488d44d..530d656aa5573c9783d07de23379657f
+ * @deprecated Upstream has added support for this, use {@link World#getHighestBlockAt(int, int, HeightMap)}
+ * @see com.destroystokyo.paper.HeightmapType
+ */
+ @Deprecated
+ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21")
+ @NotNull
+ default Block getHighestBlockAt(int x, int z, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException {
+ return this.getBlockAt(x, this.getHighestBlockYAt(x, z, heightmap), z);
@ -184,7 +184,7 @@ index 948a989aeea4165f0714db69c70ca8dcb488d44d..530d656aa5573c9783d07de23379657f
+ * @deprecated Upstream has added support for this, use {@link World#getHighestBlockAt(Location, HeightMap)}
+ * @see com.destroystokyo.paper.HeightmapType
+ */
+ @Deprecated
+ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21")
+ @NotNull
+ default Block getHighestBlockAt(@NotNull Location location, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException {
+ return this.getHighestBlockAt(location.getBlockX(), location.getBlockZ(), heightmap);