2018-09-22 09:16:43 +02:00
|
|
|
From 497ace0dc2f99a078b58dff5a1ebdb48db924d65 Mon Sep 17 00:00:00 2001
|
2018-08-23 03:13:03 +02:00
|
|
|
From: cswhite2000 <18whitechristop@gmail.com>
|
|
|
|
Date: Tue, 21 Aug 2018 19:44:10 -0700
|
|
|
|
Subject: [PATCH] isChunkGenerated API
|
|
|
|
|
|
|
|
Resolves #1329
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
2018-09-22 09:16:43 +02:00
|
|
|
index 60f249a03..fc621911e 100644
|
2018-08-23 03:13:03 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
2018-08-26 20:11:49 +02:00
|
|
|
@@ -34,6 +34,9 @@ public class ChunkProviderServer implements IChunkProvider {
|
|
|
|
private long lastQueuedSaves = 0L; // Paper
|
|
|
|
private long lastProcessedSaves = 0L; // Paper
|
|
|
|
private long lastSaveStatPrinted = System.currentTimeMillis();
|
2018-08-23 03:13:03 +02:00
|
|
|
+ public boolean isChunkGenerated(int x, int z) {
|
2018-08-26 20:11:49 +02:00
|
|
|
+ return this.chunks.containsKey(ChunkCoordIntPair.asLong(x, z)) || ((ChunkRegionLoader) this.chunkLoader).chunkExists(x, z);
|
2018-08-23 03:13:03 +02:00
|
|
|
+ }
|
2018-08-26 20:11:49 +02:00
|
|
|
// Paper end
|
|
|
|
public final Long2ObjectMap<Chunk> chunks = Long2ObjectMaps.synchronize(new ChunkMap(8192));
|
|
|
|
private Chunk lastChunk;
|
2018-08-23 03:13:03 +02:00
|
|
|
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 e6c2849a7..8572de4d5 100644
|
2018-08-23 03:13:03 +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
|
|
|
@@ -597,6 +597,12 @@ public class CraftWorld implements World {
|
2018-08-23 03:13:03 +02:00
|
|
|
return getChunkAt(location.getBlockX() >> 4, location.getBlockZ() >> 4);
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start
|
|
|
|
+ public boolean isChunkGenerated(int x, int z) {
|
|
|
|
+ return this.getHandle().getChunkProviderServer().isChunkGenerated(x, z);
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
public ChunkGenerator getGenerator() {
|
|
|
|
return generator;
|
|
|
|
}
|
|
|
|
--
|
2018-09-21 22:56:08 +02:00
|
|
|
2.19.0
|
2018-08-23 03:13:03 +02:00
|
|
|
|