2018-09-29 04:37:43 +02:00
|
|
|
From 4f23ede23ade4b6f09398c7b12f6044ad88914d7 Mon Sep 17 00:00:00 2001
|
2018-09-29 03:30:03 +02:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Fri, 28 Sep 2018 20:46:29 -0400
|
|
|
|
Subject: [PATCH] Optimize Light Recalculations
|
|
|
|
|
|
|
|
The server triggers light recalculations even if the new block
|
|
|
|
is the same as the old block. At this time, BlockData Properties
|
|
|
|
do not impact light calculations.
|
|
|
|
|
|
|
|
So the only way light should change, is if the block itself
|
|
|
|
changes from 1 block to another.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
2018-09-29 04:37:43 +02:00
|
|
|
index 53aab97866..e4bda70bb9 100644
|
2018-09-29 03:30:03 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/Chunk.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
2018-09-29 04:37:43 +02:00
|
|
|
@@ -578,7 +578,7 @@ public class Chunk implements IChunkAccess {
|
2018-09-29 03:30:03 +02:00
|
|
|
} else {
|
|
|
|
if (flag1) {
|
|
|
|
this.initLighting();
|
|
|
|
- } else {
|
2018-09-29 04:37:43 +02:00
|
|
|
+ } else if (block != block1) { // Paper - Optimize light recalculations
|
2018-09-29 03:30:03 +02:00
|
|
|
this.runOrQueueLightUpdate(() -> { // Paper - Queue light update
|
|
|
|
int i1 = iblockdata.b(this.world, blockposition);
|
|
|
|
int j1 = iblockdata1.b(this.world, blockposition);
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
2018-09-29 04:37:43 +02:00
|
|
|
index 13f69f1b82..763401835d 100644
|
2018-09-29 03:30:03 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
|
|
|
@@ -444,7 +444,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
|
|
|
} else {
|
|
|
|
IBlockData iblockdata2 = this.getType(blockposition);
|
|
|
|
|
|
|
|
- if (iblockdata2.b(this, blockposition) != iblockdata1.b(this, blockposition) || iblockdata2.e() != iblockdata1.e()) {
|
2018-09-29 04:37:43 +02:00
|
|
|
+ if (iblockdata.getBlock() != iblockdata2.getBlock() && iblockdata2.b(this, blockposition) != iblockdata1.b(this, blockposition) || iblockdata2.e() != iblockdata1.e()) { // Paper - optimize light recalculations
|
2018-09-29 03:30:03 +02:00
|
|
|
this.methodProfiler.a("checkLight");
|
|
|
|
chunk.runOrQueueLightUpdate(() -> this.r(blockposition)); // Paper - Queue light update
|
|
|
|
this.methodProfiler.e();
|
|
|
|
--
|
|
|
|
2.19.0
|
|
|
|
|