testserver/Spigot-Server-Patches/0079-Configurable-spawn-cha...

40 lines
2.1 KiB
Diff

From e1625b6c8dfcb3cb82f0e3a14397ce35eb32d94d 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 803e680894..be380ac75e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -229,4 +229,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/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index ed6f3afcfe..aaeb888a8c 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -480,7 +480,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
blockposition = this.a(new BlockPosition(j + (l & 15), 0, k + (l >> 8 & 15)));
if (this.isRainingAt(blockposition)) {
DifficultyDamageScaler difficultydamagescaler = this.getDamageScaler(blockposition);
- boolean flag2 = this.getGameRules().getBoolean("doMobSpawning") && this.random.nextDouble() < (double) difficultydamagescaler.b() * 0.01D;
+ boolean flag2 = this.getGameRules().getBoolean("doMobSpawning") && this.random.nextDouble() < (double) difficultydamagescaler.b() * paperConfig.skeleHorseSpawnChance; // Paper
if (flag2) {
EntityHorseSkeleton entityhorseskeleton = new EntityHorseSkeleton(this);
--
2.21.0