Add method to get ungenerated chunk from long key (#9254)

Also added a missing deprecation for a location block key method
This commit is contained in:
Jake Potrebic 2023-06-17 11:43:08 -07:00
commit aa6d576fe0
3 changed files with 29 additions and 11 deletions

View file

@ -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
*