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 committed by GitHub
parent c1ea5502d4
commit 3a0373901e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 50 additions and 32 deletions

View file

@ -34,14 +34,14 @@ index 16a604b6315daff228c827fe02b1234cca3e884d..20978b269a7757a561d6b872cc77898b
/**
* Sets the position of this Location and returns itself
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 18376c635c689b7aaf1a567bee3d1faaaa28a9f0..4c3150a959593c461f6cf92e9fd8a5f22ff94e8a 100644
index e83de41cbaf0e5a68ce0d5ad2b5ec10877ec4055..c63a660f2deade66fffad9036ce7c7c693bf0207 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -227,6 +227,17 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
public default Chunk getChunkAt(long chunkKey) {
return getChunkAt((int) chunkKey, (int) (chunkKey >> 32));
@@ -245,6 +245,19 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
}
+
// 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 18376c635c689b7aaf1a567bee3d1faaaa28a9f0..4c3150a959593c461f6cf92e9fd8a5f2
+ * @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
*