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 fd1bd5223a
commit 7438edc9a1
25 changed files with 509 additions and 195 deletions

View File

@@ -1,14 +1,14 @@
From 7fcd3fcb82c1622968faa0445f9408f78bae56d7 Mon Sep 17 00:00:00 2001
From ed1936953435055091fc55bb268342ed8de59552 Mon Sep 17 00:00:00 2001
From: willies952002 <admin@domnian.com>
Date: Wed, 29 Aug 2018 00:37:30 -0400
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
@@ -151,4 +151,20 @@ public interface Chunk {
@@ -168,4 +168,20 @@ public interface Chunk {
* @return true if slimes are able to spawn in this chunk
*/
boolean isSlimeChunk();
@@ -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
@@ -201,6 +201,16 @@ public interface World extends PluginMessageRecipient, Metadatable {
* @return true if the chunk has been generated, otherwise false
@@ -202,6 +202,16 @@ public interface World extends PluginMessageRecipient, Metadatable {
*/
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,9 +46,10 @@ 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
--
2.19.0