diff --git a/patches/api/Allow-Blocks-to-be-accessed-via-a-long-key.patch b/patches/api/Allow-Blocks-to-be-accessed-via-a-long-key.patch index 44f5d84ed2..f054ae628f 100644 --- a/patches/api/Allow-Blocks-to-be-accessed-via-a-long-key.patch +++ b/patches/api/Allow-Blocks-to-be-accessed-via-a-long-key.patch @@ -83,6 +83,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @see Block#getBlockKey(int, int, int) + */ + @NotNull ++ @Deprecated + public default Location getLocationAtKey(long key) { + int x = Block.getBlockKeyX(key); + int y = Block.getBlockKeyY(key); diff --git a/patches/api/Provide-Chunk-Coordinates-as-a-Long-API.patch b/patches/api/Provide-Chunk-Coordinates-as-a-Long-API.patch index 120173a7fb..328068e090 100644 --- a/patches/api/Provide-Chunk-Coordinates-as-a-Long-API.patch +++ b/patches/api/Provide-Chunk-Coordinates-as-a-Long-API.patch @@ -51,10 +51,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @NotNull public Chunk getChunkAt(@NotNull Block block); -+ // Paper start ++ // Paper start - chunk long key API + /** + * Gets the chunk at the specified chunk key, which is the X and Z packed into a long. -+ * ++ *
+ * See {@link Chunk#getChunkKey()} for easy access to the key, or you may calculate it as: + * long chunkKey = (long) chunkX & 0xffffffffL | ((long) chunkZ & 0xffffffffL) >> 32; + * @@ -62,10 +62,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @return The chunk at the specified key + */ + @NotNull -+ public default Chunk getChunkAt(long chunkKey) { -+ return getChunkAt((int) chunkKey, (int) (chunkKey >> 32)); ++ default Chunk getChunkAt(long chunkKey) { ++ return getChunkAt(chunkKey, true); + } -+ // Paper end ++ ++ /** ++ * Gets the chunk at the specified chunk key, which is the X and Z packed into a long. ++ *
++ * See {@link Chunk#getChunkKey()} for easy access to the key, or you may calculate it as: ++ * long chunkKey = (long) chunkX & 0xffffffffL | ((long) chunkZ & 0xffffffffL) >> 32; ++ * ++ * @param chunkKey The Chunk Key to look up the chunk by ++ * @param generate Whether the chunk should be fully generated or not ++ * @return The chunk at the specified key ++ */ ++ @NotNull ++ default Chunk getChunkAt(long chunkKey, boolean generate) { ++ return getChunkAt((int) chunkKey, (int) (chunkKey >> 32), generate); ++ } ++ // Paper end - chunk long key API + /** * Checks if the specified {@link Chunk} is loaded diff --git a/patches/api/isChunkGenerated-API.patch b/patches/api/isChunkGenerated-API.patch index 1ceadf72f0..1782cb7fc1 100644 --- a/patches/api/isChunkGenerated-API.patch +++ b/patches/api/isChunkGenerated-API.patch @@ -38,10 +38,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - public default Chunk getChunkAt(long chunkKey) { - return getChunkAt((int) chunkKey, (int) (chunkKey >> 32)); } -+ + // Paper end - chunk long key API + ++ // Paper start - isChunkGenerated API + /** + * Checks if a {@link Chunk} has been generated at the specified chunk key, + * which is the X and Z packed into a long. @@ -49,9 +49,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param chunkKey The Chunk Key to look up the chunk by + * @return true if the chunk has been generated, otherwise false + */ -+ public default boolean isChunkGenerated(long chunkKey) { ++ default boolean isChunkGenerated(long chunkKey) { + return isChunkGenerated((int) chunkKey, (int) (chunkKey >> 32)); + } - // Paper end - ++ // Paper end - isChunkGenerated API ++ /** + * Checks if the specified {@link Chunk} is loaded + *