PaperMC/Spigot-Server-Patches/0347-Implement-Force-Loaded-Chunk-API.patch
Aikar 2a2d9fb508
Improvements to Logging Warnings/Dupe Entities - Resolves #1544
1) Removed "Regen" mode of Dupe UUID resolver, forced safe.
Some servers who updated before we had safe mode added still had this value.

There's really no reason to keep this mode, as we've seen that vanilla
triggers this often and 99.9999999% of cases will be an actual duplicate
that needs to be deleted.

2) Made Vanilla Debug messages about dupe UUIDs and dupe uuid resolve messages
only show up if the debug.entities flag is on. This will stop server owners
from panicing from seeing these logs, and stop opening bug reports on this,
only for us to tell you "don't worry about it".

3) Avoid adding entities to world that are already added to world.

This can be triggered by anything that causes an entity to be added
to the world during the chunk load process, such as chunk conversions.

Issue #1544 was a case of this.

4) Removed debug warning about ExpiringMap.

Nothing more I know to do about this anyways. We recover from it,
stop warning to reduce noise of issues to us.
2018-10-07 15:10:23 -04:00

61 lines
2.5 KiB
Diff

From 26e5f4a9dead4dec758399f9f3ad765c6cbc4a96 Mon Sep 17 00:00:00 2001
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
index 2016051ef5..bcbc78bd8f 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -3024,6 +3024,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
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
index 12c6d850d2..55394e0c15 100644
--- 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
index 8565de51f4..08fd8850c6 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -590,6 +590,12 @@ public class CraftWorld implements World {
return getChunkAt(location.getBlockX() >> 4, location.getBlockZ() >> 4);
}
+ // Paper start
+ public boolean isChunkForceLoaded(int x, int z) {
+ return this.isChunkGenerated(x, z) && this.getHandle().isForcedChunk(x, z);
+ }
+ // Paper end
+
public ChunkGenerator getGenerator() {
return generator;
}
--
2.19.0