mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-16 14:33:09 +01:00
Fix bug in last commit
This commit is contained in:
parent
d12c81860a
commit
d7c0d502eb
1 changed files with 13 additions and 6 deletions
|
@ -159,7 +159,7 @@ index d6ea4ae532..5086fe4027 100644
|
|||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PaperLightingQueue.java b/src/main/java/net/minecraft/server/PaperLightingQueue.java
|
||||
new file mode 100644
|
||||
index 0000000000..f3d6eb7694
|
||||
index 0000000000..84e313bf8c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/minecraft/server/PaperLightingQueue.java
|
||||
@@ -0,0 +0,0 @@
|
||||
|
@ -177,6 +177,10 @@ index 0000000000..f3d6eb7694
|
|||
+ final long startTime = System.nanoTime();
|
||||
+ final long maxTickTime = MAX_TIME - (startTime - curTime);
|
||||
+
|
||||
+ if (maxTickTime <= 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ START:
|
||||
+ for (World world : MinecraftServer.getServer().getWorlds()) {
|
||||
+ if (!world.paperConfig.queueLightUpdates) {
|
||||
|
@ -212,13 +216,16 @@ index 0000000000..f3d6eb7694
|
|||
+ if (this.isEmpty()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (isOutOfTime(maxTickTime, startTime)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ try (Timing ignored = chunk.world.timings.lightingQueueTimer.startTiming()) {
|
||||
+ Runnable lightUpdate;
|
||||
+ while ((lightUpdate = this.poll()) != null) {
|
||||
+ if (startTime > 0 && isOutOfTime(maxTickTime, System.nanoTime() - startTime)) {
|
||||
+ lightUpdate.run();
|
||||
+ if (isOutOfTime(maxTickTime, startTime)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ lightUpdate.run();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
@ -234,7 +241,7 @@ index 0000000000..f3d6eb7694
|
|||
+ }
|
||||
+ processQueue(0, 0); // No timeout
|
||||
+
|
||||
+ final int radius = 1; // TODO: bitflip, why should this ever be 2?
|
||||
+ final int radius = 1;
|
||||
+ for (int x = chunk.locX - radius; x <= chunk.locX + radius; ++x) {
|
||||
+ for (int z = chunk.locZ - radius; z <= chunk.locZ + radius; ++z) {
|
||||
+ if (x == chunk.locX && z == chunk.locZ) {
|
||||
|
@ -250,8 +257,8 @@ index 0000000000..f3d6eb7694
|
|||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static boolean isOutOfTime(long maxTickTime, long l) {
|
||||
+ return l > maxTickTime;
|
||||
+ private static boolean isOutOfTime(long maxTickTime, long startTime) {
|
||||
+ return startTime > 0 && System.nanoTime() - startTime > maxTickTime;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
|
|
Loading…
Reference in a new issue