Rework Async Chunks API in prep for merge, add utility

This adds a new Future based, Consumer<Chunk> based, and ability
to control whether or not to generate to the Async Chunk API.

Until Async Chunks merges, these API's are still synchronous, but
this commit will allow plugins to start using the API's in use
with the Async Chunks beta.
This commit is contained in:
Aikar
2018-09-21 16:56:08 -04:00
parent f2055183fc
commit 4ce0958029
25 changed files with 465 additions and 151 deletions

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Add Force-Loaded Chunk API
diff --git a/src/main/java/org/bukkit/Chunk.java b/src/main/java/org/bukkit/Chunk.java
index dc847340..51bc051f 100644
index 8a8043351..4b9e0ca46 100644
--- a/src/main/java/org/bukkit/Chunk.java
+++ b/src/main/java/org/bukkit/Chunk.java
@@ -0,0 +0,0 @@ public interface Chunk {
@@ -30,14 +30,13 @@ index dc847340..51bc051f 100644
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 53764fae..00b02e36 100644
index 9c06fc163..5379a649e 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable {
* @return true if the chunk has been generated, otherwise false
*/
public boolean isChunkGenerated(int x, int z);
+
+ /**
+ * Checks if a chunk is force-loaded.
+ * Note: This will only return true if the chunk is also generated
@@ -47,7 +46,8 @@ index 53764fae..00b02e36 100644
+ * @return true if the chunk is force-loaded. otherwise false
+ */
+ public boolean isChunkForceLoaded(int x, int z);
// Paper end
+
/**
* This is the Legacy API before Java 8 was supported. Java 8 Consumer is provided,
* as well as future support
--