2018-10-23 01:16:21 +02:00
|
|
|
From 7ac07ac07ac07ac07ac07ac07ac07ac07ac07ac0 Mon Sep 17 00:00:00 2001
|
2018-09-03 16:05:55 +02:00
|
|
|
From: willies952002 <admin@domnian.com>
|
|
|
|
Date: Wed, 29 Aug 2018 00:37:42 -0400
|
|
|
|
Subject: [PATCH] Implement Force-Loaded Chunk API
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
2018-10-23 01:16:21 +02:00
|
|
|
index 7ac07ac07ac0..7ac07ac07ac0 100644
|
2018-09-03 16:05:55 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
|
|
|
@@ -289,6 +289,18 @@ public class CraftChunk implements Chunk {
|
|
|
|
Preconditions.checkArgument(0 <= z && z <= 15, "z out of range (expected 0-15, got %s)", z);
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start - Force-Loaded Chunk API
|
|
|
|
+ @Override
|
|
|
|
+ public boolean isForceLoaded() {
|
2018-10-23 01:16:21 +02:00
|
|
|
+ return getHandle().getWorld().isForceLoaded(this.x, this.z);
|
2018-09-03 16:05:55 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void setForceLoaded(boolean force) {
|
2018-10-23 01:16:21 +02:00
|
|
|
+ getHandle().getWorld().setForceLoaded(this.x, this.z, force);
|
2018-09-03 16:05:55 +02:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
static {
|
|
|
|
Arrays.fill(emptySkyLight, (byte) 0xFF);
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
2018-10-23 01:16:21 +02:00
|
|
|
index 7ac07ac07ac0..7ac07ac07ac0 100644
|
2018-09-03 16:05:55 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
2018-09-27 04:35:42 +02:00
|
|
|
@@ -590,6 +590,12 @@ public class CraftWorld implements World {
|
|
|
|
return getChunkAt(location.getBlockX() >> 4, location.getBlockZ() >> 4);
|
2018-09-03 16:05:55 +02:00
|
|
|
}
|
2018-09-27 04:35:42 +02:00
|
|
|
|
|
|
|
+ // Paper start
|
2018-09-03 16:05:55 +02:00
|
|
|
+ public boolean isChunkForceLoaded(int x, int z) {
|
2018-10-23 01:16:21 +02:00
|
|
|
+ return this.isChunkGenerated(x, z) && this.getHandle().isForceLoaded(x, z);
|
2018-09-03 16:05:55 +02:00
|
|
|
+ }
|
2018-09-27 04:35:42 +02:00
|
|
|
+ // Paper end
|
|
|
|
+
|
2018-09-03 16:05:55 +02:00
|
|
|
public ChunkGenerator getGenerator() {
|
2018-09-27 04:35:42 +02:00
|
|
|
return generator;
|
|
|
|
}
|
2018-09-03 16:05:55 +02:00
|
|
|
--
|
2018-10-23 01:16:21 +02:00
|
|
|
2.19.1
|
2018-09-03 16:05:55 +02:00
|
|
|
|