Use consistent priorities for light tasks

Should fix high priority chunk loads prioritizing over urgent sync loads

Also fixes build Kenny broke! Bad Kenny.
This commit is contained in:
Aikar 2020-07-17 13:24:12 -04:00
parent 1de3f83083
commit 7db30ebd57
No known key found for this signature in database
GPG key ID: 401ADFC9891FAAFE
2 changed files with 8 additions and 9 deletions

View file

@ -570,7 +570,7 @@ index a6363b73522f9d27534b6e80f4b3789e84316c49..604e7004b659daed2844ba1a76bf0928
boolean flag1 = this.playerChunkMap.b();
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 6e0882e7e396f76b451e11c6cc6959e813de0a1f..8fd3c913ac5315a5c1cce002498bfe2ec08aaf42 100644
index 69b10093552fd3b84d355e216a3eb6bee3d486ef..4550e3449b146d5d416ece620d036cb17547b30e 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -55,6 +55,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@ -1144,7 +1144,7 @@ index 7fd991fd3994a18625c193aeb15ed521d3b6a447..6bb2b3520362d056d4d75c65764e4c8d
}
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 59f00891ee2d1641678d4903a365cb94247bf08f..e55e11d5c97d656db8fed42c1581375077129906 100644
index 382f334f82efefcfbd1781ac09e191cd27a0fb0c..273dce1feae284204a643dd06468e0b903745a1f 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -196,8 +196,8 @@ public abstract class PlayerList {
@ -1169,7 +1169,7 @@ index 59f00891ee2d1641678d4903a365cb94247bf08f..e55e11d5c97d656db8fed42c15813750
@@ -808,6 +809,7 @@ public abstract class PlayerList {
// CraftBukkit end
worldserver.getChunkProvider().addTicket(TicketType.POST_TELEPORT, new ChunkCoordIntPair(location.getBlockX() >> 4, location.getBlockZ() >> 4), 1, entityplayer.getId()); // Paper
worldserver1.getChunkProvider().addTicket(TicketType.POST_TELEPORT, new ChunkCoordIntPair(location.getBlockX() >> 4, location.getBlockZ() >> 4), 1, entityplayer.getId()); // Paper
+ entityplayer1.forceCheckHighPriority(); // Player
while (avoidSuffocation && !worldserver1.getCubes(entityplayer1) && entityplayer1.locY() < 256.0D) {
entityplayer1.setPosition(entityplayer1.locX(), entityplayer1.locY() + 1.0D, entityplayer1.locZ());

View file

@ -1027,7 +1027,7 @@ index a35e7b392c74fadf2760d1fc2021e98d33858cb5..944094e8e770cc8c0205ef2aa6c48fff
lightenginelayer.a(Long.MAX_VALUE, l3, 15, false);
}
diff --git a/src/main/java/net/minecraft/server/LightEngineThreaded.java b/src/main/java/net/minecraft/server/LightEngineThreaded.java
index a9dc8466278f9ec2becbcb643e6e1c973df72b82..968a1f71a44122ef0c4236d4251497f0b813d3b9 100644
index a9dc8466278f9ec2becbcb643e6e1c973df72b82..721f86a5405c9575d8ee3fc661395e65487b6d96 100644
--- a/src/main/java/net/minecraft/server/LightEngineThreaded.java
+++ b/src/main/java/net/minecraft/server/LightEngineThreaded.java
@@ -14,8 +14,98 @@ import org.apache.logging.log4j.Logger;
@ -1154,7 +1154,7 @@ index a9dc8466278f9ec2becbcb643e6e1c973df72b82..968a1f71a44122ef0c4236d4251497f0
this.b();
}
@@ -134,7 +227,14 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
@@ -134,7 +227,13 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();
ichunkaccess.b(false);
@ -1162,15 +1162,14 @@ index a9dc8466278f9ec2becbcb643e6e1c973df72b82..968a1f71a44122ef0c4236d4251497f0
+ // Paper start
+ long pair = chunkcoordintpair.pair();
+ CompletableFuture<IChunkAccess> future = new CompletableFuture<>();
+ IntSupplier prioritySupplier1 = d.getPrioritySupplier(pair);
+ IntSupplier prioritySupplier = flag ? () -> Math.max(1, prioritySupplier1.getAsInt() - 10) : prioritySupplier1;
+ IntSupplier prioritySupplier = d.getPrioritySupplier(pair);
+ this.e.a(ChunkTaskQueueSorter.a(() -> {
+ this.queue.add(pair, prioritySupplier.getAsInt(), LightEngineThreaded.Update.PRE_UPDATE, SystemUtils.a(() -> {
+ // Paper end
ChunkSection[] achunksection = ichunkaccess.getSections();
for (int i = 0; i < 16; ++i) {
@@ -155,52 +255,51 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
@@ -155,52 +254,51 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
this.d.c(chunkcoordintpair);
}, () -> {
return "lightChunk " + chunkcoordintpair + " " + flag;
@ -1307,7 +1306,7 @@ index 35f4d2d9591e625ab0bbeab7b606761e74965eec..698d82dd736529a8cbfad5c6bed70ab9
this.a.a(t0);
this.f();
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index e1cbb3431d3ce9db6698b7d9d296611e4d9a5470..5ee9d3009e04b36d2c61007a1dbe06b2bb1106ff 100644
index 2b04577c153fc4563e59b67afee12411a5de5314..d048ee2313142ba4b0fae7ef2badb9f80614bb62 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -707,6 +707,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {