Skip to content

Commit

Permalink
Fix a baka bug
Browse files Browse the repository at this point in the history
Missing one () causes lightning to always fall when it rains
  • Loading branch information
s-yh-china committed Sep 13, 2022
1 parent 8989609 commit a4d5d9d
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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);
Expand All @@ -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;
Expand Down

0 comments on commit a4d5d9d

Please sign in to comment.