From 124c78b9268b03111e98ee7f38f9ee751a70101d Mon Sep 17 00:00:00 2001 From: tterrag Date: Thu, 7 Nov 2019 16:56:54 -0500 Subject: [PATCH] Fix #6305 lighting optimization using the wrong method --- .../world/lighting/BlockLightEngine.java.patch | 10 +--------- .../world/lighting/LevelBasedGraph.java.patch | 2 +- .../world/lighting/SectionLightStorage.java.patch | 2 +- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/patches/minecraft/net/minecraft/world/lighting/BlockLightEngine.java.patch b/patches/minecraft/net/minecraft/world/lighting/BlockLightEngine.java.patch index cd91bca13..d3d59883b 100644 --- a/patches/minecraft/net/minecraft/world/lighting/BlockLightEngine.java.patch +++ b/patches/minecraft/net/minecraft/world/lighting/BlockLightEngine.java.patch @@ -1,14 +1,6 @@ --- a/net/minecraft/world/lighting/BlockLightEngine.java +++ b/net/minecraft/world/lighting/BlockLightEngine.java -@@ -4,6 +4,7 @@ - import net.minecraft.block.BlockState; - import net.minecraft.util.Direction; - import net.minecraft.util.math.BlockPos; -+import net.minecraft.util.math.ChunkPos; - import net.minecraft.util.math.SectionPos; - import net.minecraft.util.math.shapes.VoxelShape; - import net.minecraft.util.math.shapes.VoxelShapes; -@@ -117,4 +118,11 @@ +@@ -117,4 +117,11 @@ this.field_215627_c.func_215532_c(); this.func_215469_a(Long.MAX_VALUE, p_215623_1_.func_218275_a(), 15 - p_215623_2_, true); } diff --git a/patches/minecraft/net/minecraft/world/lighting/LevelBasedGraph.java.patch b/patches/minecraft/net/minecraft/world/lighting/LevelBasedGraph.java.patch index 73c11d84c..5bfff89fb 100644 --- a/patches/minecraft/net/minecraft/world/lighting/LevelBasedGraph.java.patch +++ b/patches/minecraft/net/minecraft/world/lighting/LevelBasedGraph.java.patch @@ -11,7 +11,7 @@ + return field_215488_c.size(); + } + -+ public void bulkCancel(java.util.function.LongPredicate pred) { ++ public final void bulkCancel(java.util.function.LongPredicate pred) { + ((Long2ByteOpenHashMap)field_215488_c).keySet().forEach((long l) -> { + if (pred.test(l)) { + func_215479_e(l); diff --git a/patches/minecraft/net/minecraft/world/lighting/SectionLightStorage.java.patch b/patches/minecraft/net/minecraft/world/lighting/SectionLightStorage.java.patch index b01599581..caef39b99 100644 --- a/patches/minecraft/net/minecraft/world/lighting/SectionLightStorage.java.patch +++ b/patches/minecraft/net/minecraft/world/lighting/SectionLightStorage.java.patch @@ -6,7 +6,7 @@ + // FORGE: Optimize loop when lighting update count is lower than section size + if (p_215528_1_.queuedUpdateSize() < 16 * 16 * 16) { -+ p_215528_1_.bulkCancel(l -> SectionPos.func_218169_f(l) == p_215528_2_); ++ p_215528_1_.bulkCancel(l -> SectionPos.func_218162_e(l) == p_215528_2_); + return; + } for(int l = 0; l < 16; ++l) {