2018-09-22 09:16:43 +02:00
|
|
|
From dbf563359289ee3bddce540d2ee7ef2b209711b5 Mon Sep 17 00:00:00 2001
|
2018-07-21 22:55:43 +02:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Sat, 21 Jul 2018 16:55:04 -0400
|
|
|
|
Subject: [PATCH] Add async chunk load API
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
2018-09-22 09:16:43 +02:00
|
|
|
index 74f09ac45..0c83a070f 100644
|
2018-07-21 22:55:43 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
2018-09-22 09:16:43 +02:00
|
|
|
@@ -157,6 +157,18 @@ public class CraftWorld implements World {
|
2018-07-21 22:55:43 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start - Async chunk load API
|
2018-09-21 22:56:08 +02:00
|
|
|
+ @Override
|
|
|
|
+ public java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(final int x, final int z, final boolean gen) {
|
2018-07-21 22:55:43 +02:00
|
|
|
+ final ChunkProviderServer cps = this.world.getChunkProviderServer();
|
2018-09-21 22:56:08 +02:00
|
|
|
+ java.util.concurrent.CompletableFuture<Chunk> future = new java.util.concurrent.CompletableFuture<>();
|
|
|
|
+ net.minecraft.server.Chunk chunk = cps.getChunkAt(x, z, true, gen);
|
|
|
|
+ // TODO: Add back async variant
|
|
|
|
+ future.complete(chunk != null ? chunk.bukkitChunk : null);
|
|
|
|
+ return future;
|
2018-07-21 22:55:43 +02:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
public Chunk getChunkAt(int x, int z) {
|
2018-08-26 20:11:49 +02:00
|
|
|
return this.world.getChunkProviderServer().getChunkAt(x, z, true, true).bukkitChunk;
|
2018-07-21 22:55:43 +02:00
|
|
|
}
|
|
|
|
--
|
2018-09-21 22:56:08 +02:00
|
|
|
2.19.0
|
2018-07-21 22:55:43 +02:00
|
|
|
|