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:
@@ -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.
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * 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.
|
||||
+ * <p>
|
||||
+ * 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
|
||||
|
||||
Reference in New Issue
Block a user