diff --git a/Spigot-API-Patches/0138-Allow-Blocks-to-be-accessed-via-a-long-key.patch b/Spigot-API-Patches/0138-Allow-Blocks-to-be-accessed-via-a-long-key.patch index c4a1f16e0..914182a79 100644 --- a/Spigot-API-Patches/0138-Allow-Blocks-to-be-accessed-via-a-long-key.patch +++ b/Spigot-API-Patches/0138-Allow-Blocks-to-be-accessed-via-a-long-key.patch @@ -1,4 +1,4 @@ -From 777336e47986d99c007847d7ae72f3db8279da5b Mon Sep 17 00:00:00 2001 +From 821698c0c68f13b975a259c2e85d63963e948d8e Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Tue, 14 Aug 2018 21:42:10 -0700 Subject: [PATCH] Allow Blocks to be accessed via a long key @@ -91,10 +91,10 @@ index 1b0744ed..fa736b07 100644 * Gets the y coordinate of the lowest block at this position such that the * block and all blocks above it are transparent for lighting purposes. diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index 708288e9..c20f903a 100644 +index 708288e9..7c1dd5f6 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java -@@ -153,6 +153,76 @@ public interface Block extends Metadatable { +@@ -153,6 +153,72 @@ public interface Block extends Metadatable { */ int getZ(); @@ -115,20 +115,16 @@ index 708288e9..c20f903a 100644 + * The return value can be computed as follows: + *
+ * {@code long value = ((long)x & 0x7FFFFFF) | (((long)z & 0x7FFFFFF) << 27) | ((long)y << 54);} -+ *
+ *

+ * + *

+ * And may be unpacked as follows: + *
+ * {@code int x = (int) ((packed << 37) >> 37);} -+ *
+ *
+ * {@code int y = (int) (packed >>> 54);} -+ *
+ *
+ * {@code int z = (int) ((packed << 10) >> 37);} -+ *
+ *

+ * + * @return This block's x, y, and z coordinates packed into a long value diff --git a/Spigot-API-Patches/0182-Add-Heightmap-API.patch b/Spigot-API-Patches/0182-Add-Heightmap-API.patch index 6fff85ab5..afab0ff3b 100644 --- a/Spigot-API-Patches/0182-Add-Heightmap-API.patch +++ b/Spigot-API-Patches/0182-Add-Heightmap-API.patch @@ -1,4 +1,4 @@ -From 97898e8cdfaafac936acd015cabc188fc8584d97 Mon Sep 17 00:00:00 2001 +From e5544cfd3617bee968c66c49cf81e059cbea7c97 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Sat, 1 Dec 2018 19:00:36 -0800 Subject: [PATCH] Add Heightmap API @@ -84,23 +84,27 @@ index 8352b77c..f1263600 100644 * 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 107f4173..dc9e8a76 100644 +index 107f4173..775aca85 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java -@@ -153,6 +153,68 @@ public interface World extends PluginMessageRecipient, Metadatable { +@@ -153,6 +153,79 @@ public interface World extends PluginMessageRecipient, Metadatable { @NotNull public Block getHighestBlockAt(@NotNull Location location); + // Paper start - Add heightmap API + /** + * Returns the highest block's y-coordinate at the specified block coordinates that match the specified heightmap's conditions. ++ *

++ * implNote: Implementations are recommended to use an iterative search as a fallback before resorting to ++ * throwing an {@code UnsupportedOperationException}. ++ *

++ * + * @param x The block's x-coordinate. + * @param z The block's z-coordinate. + * @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType} + * @return The highest block's y-coordinate at (x, z) that matches the specified heightmap's conditions. + * @throws UnsupportedOperationException If the heightmap type is not supported. -+ * @implNote Implementations are recommended to use an iterative search as a fallback before resorting to -+ * throwing an {@code UnsupportedOperationException}. ++ * + * @see com.destroystokyo.paper.HeightmapType + */ + public int getHighestBlockYAt(int x, int z, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException; @@ -108,12 +112,15 @@ index 107f4173..dc9e8a76 100644 + /** + * Returns the highest block's y-coordinate at the specified block coordinates that match the specified heightmap's conditions. + * Note that the y-coordinate of the specified location is ignored. ++ *

++ * implNote: Implementations are recommended to use an iterative search as a fallback before resorting to ++ * throwing an {@code UnsupportedOperationException}. ++ *

++ * + * @param location The specified block coordinates. + * @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType} + * @return The highest block's y-coordinate at {@code location} that matches the specified heightmap's conditions. + * @throws UnsupportedOperationException If the heightmap type is not supported. -+ * @implNote Implementations are recommended to use an iterative search as a fallback before resorting to -+ * throwing an {@code UnsupportedOperationException}. + * @see com.destroystokyo.paper.HeightmapType + */ + default int getHighestBlockYAt(@NotNull Location location, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException { @@ -122,13 +129,15 @@ index 107f4173..dc9e8a76 100644 + + /** + * Returns the highest {@link Block} at the specified block coordinates that match the specified heightmap's conditions. ++ *

++ * implNote: Implementations are recommended to use an iterative search as a fallback before resorting to ++ * throwing an {@code UnsupportedOperationException}. ++ *

+ * @param x The block's x-coordinate. + * @param z The block's z-coordinate. + * @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType} + * @return The highest {@link Block} at (x, z) that matches the specified heightmap's conditions. + * @throws UnsupportedOperationException If the heightmap type is not supported. -+ * @implNote Implementations are recommended to use an iterative search as a fallback before resorting to -+ * throwing an {@code UnsupportedOperationException}. + * @see com.destroystokyo.paper.HeightmapType + */ + @NotNull @@ -139,12 +148,14 @@ index 107f4173..dc9e8a76 100644 + /** + * Returns the highest {@link Block} at the specified block coordinates that match the specified heightmap's conditions. + * Note that the y-coordinate of the specified location is ignored. ++ *

++ * implNote: Implementations are recommended to use an iterative search as a fallback before resorting to ++ * throwing an {@code UnsupportedOperationException}. ++ *

+ * @param location The specified block coordinates. + * @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType} + * @return The highest {@link Block} at {@code location} that matches the specified heightmap's conditions. + * @throws UnsupportedOperationException If the heightmap type is not supported. -+ * @implNote Implementations are recommended to use an iterative search as a fallback before resorting to -+ * throwing an {@code UnsupportedOperationException}. + * @see com.destroystokyo.paper.HeightmapType + */ + @NotNull