mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-16 14:33:09 +01:00
Fix not running level updates for light if no pre/post task
This commit is contained in:
parent
ce5e21f683
commit
7c419073e4
1 changed files with 14 additions and 9 deletions
|
@ -1274,6 +1274,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start - replace impl
|
+ // Paper start - replace impl
|
||||||
|
+ private final java.util.List<Runnable> pre = new java.util.ArrayList<>();
|
||||||
|
+ private final java.util.List<Runnable> post = new java.util.ArrayList<>();
|
||||||
private void b() {
|
private void b() {
|
||||||
- int i = Math.min(this.c.size(), this.f);
|
- int i = Math.min(this.c.size(), this.f);
|
||||||
- ObjectListIterator<Pair<LightEngineThreaded.Update, Runnable>> objectlistiterator = this.c.iterator();
|
- ObjectListIterator<Pair<LightEngineThreaded.Update, Runnable>> objectlistiterator = this.c.iterator();
|
||||||
|
@ -1286,7 +1288,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
- if (pair.getFirst() == LightEngineThreaded.Update.PRE_UPDATE) {
|
- if (pair.getFirst() == LightEngineThreaded.Update.PRE_UPDATE) {
|
||||||
- ((Runnable) pair.getSecond()).run();
|
- ((Runnable) pair.getSecond()).run();
|
||||||
- }
|
- }
|
||||||
- }
|
+ int i = Math.min(queue.size(), 4);
|
||||||
|
+ boolean ran = false;
|
||||||
|
+ while (i-- > 0 && queue.poll(pre, post)) {
|
||||||
|
+ pre.forEach(Runnable::run);
|
||||||
|
+ pre.clear();
|
||||||
|
+ super.a(Integer.MAX_VALUE, true, true);
|
||||||
|
+ post.forEach(Runnable::run);
|
||||||
|
+ post.clear();
|
||||||
|
+ ran = true;
|
||||||
|
}
|
||||||
-
|
-
|
||||||
- objectlistiterator.back(j);
|
- objectlistiterator.back(j);
|
||||||
- super.a(Integer.MAX_VALUE, true, true);
|
- super.a(Integer.MAX_VALUE, true, true);
|
||||||
|
@ -1298,15 +1309,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
- }
|
- }
|
||||||
-
|
-
|
||||||
- objectlistiterator.remove();
|
- objectlistiterator.remove();
|
||||||
+ java.util.List<Runnable> pre = new java.util.ArrayList<>();
|
+ if (!ran) {
|
||||||
+ java.util.List<Runnable> post = new java.util.ArrayList<>();
|
+ // might have level updates to go still
|
||||||
+ int i = Math.min(queue.size(), 4);
|
|
||||||
+ while (i-- > 0 && queue.poll(pre, post)) {
|
|
||||||
+ pre.forEach(Runnable::run);
|
|
||||||
+ pre.clear();
|
|
||||||
+ super.a(Integer.MAX_VALUE, true, true);
|
+ super.a(Integer.MAX_VALUE, true, true);
|
||||||
+ post.forEach(Runnable::run);
|
|
||||||
+ post.clear();
|
|
||||||
}
|
}
|
||||||
-
|
-
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
|
|
Loading…
Reference in a new issue