Respect x-ray permission in World#refreshChunk (#7214)

Co-authored-by: stonar96 <minecraft.stonar96@gmail.com>
This commit is contained in:
Owen 2022-06-01 22:08:51 -04:00 committed by GitHub
parent 71fe3c64f0
commit b1ac25fdb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 57 additions and 34 deletions

View file

@ -22,7 +22,7 @@ wants it to collect even faster, they can restore that setting back to 1 instead
Not adding it to .getType() though to keep behavior consistent with vanilla for performance reasons.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index d4d8eee914f71d9a33feda82ef54cb0c40b0e60c..28a04d21801a9bb1e4311e6da28eae26283a2e36 100644
index 8c61da70f609cd8cd5939cd12edc118d65fc734a..017e351e14a6a3a4c711df84f81936c296da13e1 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -359,7 +359,7 @@ public final class CraftServer implements Server {
@ -44,7 +44,7 @@ index d4d8eee914f71d9a33feda82ef54cb0c40b0e60c..28a04d21801a9bb1e4311e6da28eae26
this.printSaveWarning = false;
console.autosavePeriod = this.configuration.getInt("ticks-per.autosave");
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 0edb08a391f806e56ed1bd4812eb9c9d2b966bd7..b50a05ada2e759cfdeb2af036337bf5ed5b60b7d 100644
index 6bdf3679ea9461475b139a0622857b1dc56ea5b2..3c3959240c72fe705db5ee79cf8faaaddd361ee9 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -277,8 +277,21 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@ -79,7 +79,7 @@ index 0edb08a391f806e56ed1bd4812eb9c9d2b966bd7..b50a05ada2e759cfdeb2af036337bf5e
}
return true;
@@ -423,9 +436,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -428,9 +441,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot
// Paper start - Optimize this method
ChunkPos chunkPos = new ChunkPos(x, z);
@ -93,7 +93,7 @@ index 0edb08a391f806e56ed1bd4812eb9c9d2b966bd7..b50a05ada2e759cfdeb2af036337bf5e
if (immediate == null) {
immediate = world.getChunkSource().chunkMap.getUnloadingChunk(x, z);
}
@@ -433,7 +449,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -438,7 +454,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
if (!(immediate instanceof ImposterProtoChunk) && !(immediate instanceof net.minecraft.world.level.chunk.LevelChunk)) {
return false; // not full status
}
@ -102,7 +102,7 @@ index 0edb08a391f806e56ed1bd4812eb9c9d2b966bd7..b50a05ada2e759cfdeb2af036337bf5e
world.getChunk(x, z); // make sure we're at ticket level 32 or lower
return true;
}
@@ -459,7 +475,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -464,7 +480,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
// we do this so we do not re-read the chunk data on disk
}
@ -111,7 +111,7 @@ index 0edb08a391f806e56ed1bd4812eb9c9d2b966bd7..b50a05ada2e759cfdeb2af036337bf5e
world.getChunkSource().getChunk(x, z, ChunkStatus.FULL, true);
return true;
// Paper end
@@ -1979,6 +1995,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -1984,6 +2000,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return this.world.getChunkSource().getChunkAtAsynchronously(x, z, gen, urgent).thenComposeAsync((either) -> {
net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk) either.left().orElse(null);