2018-09-22 09:16:43 +02:00
|
|
|
From 5de827636c18a5bfbb11aa66625ab30da6e72a43 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/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
2018-09-22 09:16:43 +02:00
|
|
|
index 650e605b5..2ff8536d5 100644
|
2018-09-03 16:05:55 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
2018-09-18 03:50:02 +02:00
|
|
|
@@ -3023,6 +3023,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
2018-09-03 16:05:55 +02:00
|
|
|
return forcedchunk != null && forcedchunk.a().contains(ChunkCoordIntPair.a(i, j));
|
|
|
|
}
|
|
|
|
|
|
|
|
+ public boolean setForcedChunk(int i, int j, boolean flag) { return b(i, j, flag); } // Paper - OBFHELPER
|
|
|
|
public boolean b(int i, int j, boolean flag) {
|
|
|
|
String s = "chunks";
|
|
|
|
ForcedChunk forcedchunk = (ForcedChunk) this.a(this.worldProvider.getDimensionManager(), ForcedChunk::new, "chunks");
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
2018-09-22 09:16:43 +02:00
|
|
|
index 12c6d850d..55394e0c1 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() {
|
|
|
|
+ return getHandle().getWorld().isForcedChunk(this.x, this.z);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void setForceLoaded(boolean force) {
|
|
|
|
+ getHandle().getWorld().setForcedChunk(this.x, this.z, force);
|
|
|
|
+ }
|
|
|
|
+ // 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-09-22 09:16:43 +02:00
|
|
|
index 8572de4d5..580e248f8 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-22 09:16:43 +02:00
|
|
|
@@ -601,6 +601,10 @@ public class CraftWorld implements World {
|
2018-09-03 16:05:55 +02:00
|
|
|
public boolean isChunkGenerated(int x, int z) {
|
|
|
|
return this.getHandle().getChunkProviderServer().isChunkGenerated(x, z);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public boolean isChunkForceLoaded(int x, int z) {
|
|
|
|
+ return this.isChunkGenerated(x, z) && this.getHandle().isForcedChunk(x, z);
|
|
|
|
+ }
|
|
|
|
// Paper end
|
|
|
|
|
|
|
|
public ChunkGenerator getGenerator() {
|
|
|
|
--
|
2018-09-15 18:10:26 +02:00
|
|
|
2.19.0
|
2018-09-03 16:05:55 +02:00
|
|
|
|