From a4d5d9de79f87d42735b9749c8b7d06248aca7b5 Mon Sep 17 00:00:00 2001 From: violetc <58360096+s-yh-china@users.noreply.github.com> Date: Tue, 13 Sep 2022 14:02:39 +0800 Subject: [PATCH] Fix a baka bug Missing one () causes lightning to always fall when it rains --- .../0027-Optimize-random-calls-in-chunk-ticking.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/patches/server/0027-Optimize-random-calls-in-chunk-ticking.patch b/patches/server/0027-Optimize-random-calls-in-chunk-ticking.patch index 202b8d02..46f4ee69 100644 --- a/patches/server/0027-Optimize-random-calls-in-chunk-ticking.patch +++ b/patches/server/0027-Optimize-random-calls-in-chunk-ticking.patch @@ -22,7 +22,7 @@ index bcc24c563cc8d35bffb594b11954e916711ce971..b653393ff465f5b0448f62e57697ae8c boolean flag1 = level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && worlddata.getGameTime() % level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index bc185f733d7543bb12c8f1f277197810154f739a..bb360a8a54fa4efe1cc6b672df09d4c0d6816d16 100644 +index bc185f733d7543bb12c8f1f277197810154f739a..ba86d0cf5de70b13ed9fd669db6938686a07bf16 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -760,6 +760,13 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -44,7 +44,7 @@ index bc185f733d7543bb12c8f1f277197810154f739a..bb360a8a54fa4efe1cc6b672df09d4c0 final BlockPos.MutableBlockPos blockposition = this.chunkTickMutablePosition; // Paper - use mutable to reduce allocation rate, final to force compile fail on change - if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - disable thunder -+ if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && top.leavesmc.leaves.LeavesConfig.optimizeChunkTicking ? chunk.shouldDoLightning(this.random) : this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - disable thunder // Leaves - replace random with shouldDoLightning ++ if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && (top.leavesmc.leaves.LeavesConfig.optimizeChunkTicking ? chunk.shouldDoLightning(this.random) : this.random.nextInt(this.spigotConfig.thunderChance) == 0)) { // Spigot // Paper - disable thunder // Leaves - replace random with shouldDoLightning blockposition.set(this.findLightningTargetAround(this.getBlockRandomPos(j, 0, k, 15))); // Paper if (this.isRainingAt(blockposition)) { DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition); @@ -53,7 +53,7 @@ index bc185f733d7543bb12c8f1f277197810154f739a..bb360a8a54fa4efe1cc6b672df09d4c0 gameprofilerfiller.popPush("iceandsnow"); - if (!this.paperConfig().environment.disableIceAndSnow && this.random.nextInt(16) == 0) { // Paper - Disable ice and snow -+ if (!this.paperConfig().environment.disableIceAndSnow && top.leavesmc.leaves.LeavesConfig.optimizeChunkTicking ? (this.currentIceAndSnowTick++ & 15) == 0 : this.random.nextInt(16) == 0) { // Paper - Disable ice and snow // Paper - optimise random ticking // Leaves - optimize further random ticking ++ if (!this.paperConfig().environment.disableIceAndSnow && (top.leavesmc.leaves.LeavesConfig.optimizeChunkTicking ? (this.currentIceAndSnowTick++ & 15) == 0 : this.random.nextInt(16) == 0)) { // Paper - Disable ice and snow // Paper - optimise random ticking // Leaves - optimize further random ticking // Paper start - optimise chunk ticking this.getRandomBlockPosition(j, 0, k, 15, blockposition); int normalY = chunk.getHeight(Heightmap.Types.MOTION_BLOCKING, blockposition.getX() & 15, blockposition.getZ() & 15) + 1;