0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/spigot.git synced 2024-11-21 22:06:13 +00:00
spigot/CraftBukkit-Patches/0074-Configurable-Thunder-Chance.patch
2024-10-23 02:15:00 +11:00

38 lines
1.7 KiB
Diff

From 3801ad59cdd6b2d118545068e5855ab0231eaa51 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Sun, 24 Oct 2021 20:29:25 +1100
Subject: [PATCH] Configurable Thunder Chance
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
index b62703d5a3..8363aafc0e 100644
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
@@ -511,7 +511,7 @@ public class WorldServer extends World implements ServerEntityGetter, GeneratorA
GameProfilerFiller gameprofilerfiller = Profiler.get();
gameprofilerfiller.push("thunder");
- if (flag && this.isThundering() && this.random.nextInt(100000) == 0) {
+ if (flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot
BlockPosition blockposition = this.findLightningTargetAround(this.getBlockRandomPos(j, 0, k, 15));
if (this.isRainingAt(blockposition)) {
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index 68cf01386e..b6ac09ee9f 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -382,4 +382,10 @@ public class SpigotWorldConfig
entityMaxTickTime = getInt("max-tick-time.entity", 50);
log("Tile Max Tick Time: " + tileMaxTickTime + "ms Entity max Tick Time: " + entityMaxTickTime + "ms");
}
+
+ public int thunderChance;
+ private void thunderChance()
+ {
+ thunderChance = getInt("thunder-chance", 100000);
+ }
}
--
2.47.0