aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0072-Configurable-spawn-chances-for-skeleton-horses.patch
blob: 6fd7e8e73464ca3db9ddeeea6ca5826e78ca04bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 22 Mar 2016 12:04:28 -0500
Subject: [PATCH] Configurable spawn chances for skeleton horses


diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 71c672eafdce3547eaeb8e31fddcb142ad213094..aa8cd5965632626e4cbd4952acf9b349f79b2b1c 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -276,4 +276,12 @@ public class PaperWorldConfig {
         log("Non Player Arrow Despawn Rate: " + nonPlayerArrowDespawnRate);
         log("Creative Arrow Despawn Rate: " + creativeArrowDespawnRate);
     }
+
+    public double skeleHorseSpawnChance;
+    private void skeleHorseSpawnChance() {
+        skeleHorseSpawnChance = getDouble("skeleton-horse-thunder-spawn-chance", 0.01D);
+        if (skeleHorseSpawnChance < 0) {
+            skeleHorseSpawnChance = 0.01D; // Vanilla value
+        }
+    }
 }
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 0507e0fdbc2aae621a8078a939ad10b5dab33f64..04816aea9c3a9e999851694fc8485ead586520f8 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -565,7 +565,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
             blockposition = this.findLightningTargetAround(this.getBlockRandomPos(j, 0, k, 15));
             if (this.isRainingAt(blockposition)) {
                 DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition);
-                boolean flag1 = this.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.getEffectiveDifficulty() * 0.01D && !this.getBlockState(blockposition.below()).is(Blocks.LIGHTNING_ROD);
+                boolean flag1 = this.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.getEffectiveDifficulty() * paperConfig.skeleHorseSpawnChance && !this.getBlockState(blockposition.below()).is(Blocks.LIGHTNING_ROD); // Paper
 
                 if (flag1) {
                     SkeletonHorse entityhorseskeleton = (SkeletonHorse) EntityType.SKELETON_HORSE.create(this);