Fix skeleton horse spawn chance ignoring difficulty modifier if custom set

Also reduce diff
This commit is contained in:
Aikar
2016-05-30 12:50:57 -04:00
parent 44857e00e2
commit a9ec7b3a75
6 changed files with 10 additions and 18 deletions

View File

@@ -16,6 +16,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public double skeleHorseSpawnChance;
+ private void skeleHorseSpawnChance() {
+ skeleHorseSpawnChance = getDouble("skeleton-horse-thunder-spawn-chance", -1.0D); // -1.0D represents a "vanilla" state
+ if (skeleHorseSpawnChance < 0) {
+ skeleHorseSpawnChance = 0.05D; // Vanilla
+ }
+ }
}
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
@@ -27,10 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
DifficultyDamageScaler difficultydamagescaler = this.D(blockposition);
- if (this.random.nextDouble() < (double) difficultydamagescaler.b() * 0.05D) {
+ // Paper start - Configurable skeleton horse spawn chance
+ double chance = this.paperConfig.skeleHorseSpawnChance == -1.0D ? (double) difficultydamagescaler.b() * 0.05D : this.paperConfig.skeleHorseSpawnChance;
+ if (this.random.nextDouble() < chance) {
+ // Paper end
+ if (this.random.nextDouble() < difficultydamagescaler.b() * paperConfig.skeleHorseSpawnChance) { // Paper - Configurable skeleton horse spawn chance
EntityHorse entityhorse = new EntityHorse(this);
entityhorse.setType(EnumHorseType.SKELETON);