Files
Purpur/patches/server/0013-Zombie-horse-naturally-spawn.patch
William Blake Galbreath 2ccfff0b5c Updated Upstream (Paper)
Upstream has released updates that appears to apply and compile correctly

Paper Changes:
d63075df Pass fireworks through vanished players (#3021)
4d991f19 [CI-SKIP] Rebuild patches
26070a0e Indicate ticking status in entity list command (#2856)
2ff7b480 Optimise Chunk#getFluid (#2860)
c23ebb78 Optimise ticklistserver (#2957)
2020-03-18 23:48:24 -05:00

59 lines
3.4 KiB
Diff

From 4a16187dfc2604023cadda1a714fb8b65f5aa731 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sun, 7 Jul 2019 19:52:16 -0500
Subject: [PATCH] Zombie horse naturally spawn
---
.../java/net/minecraft/server/WorldServer.java | 18 ++++++++++++------
.../net/pl3x/purpur/PurpurWorldConfig.java | 2 ++
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 08d3806a31..8eae813adc 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -923,12 +923,18 @@ public class WorldServer extends World {
boolean flag1 = this.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.b() * paperConfig.skeleHorseSpawnChance; // Paper
if (flag1) {
- EntityHorseSkeleton entityhorseskeleton = (EntityHorseSkeleton) EntityTypes.SKELETON_HORSE.a((World) this);
-
- entityhorseskeleton.r(true);
- entityhorseskeleton.setAgeRaw(0);
- entityhorseskeleton.setPosition((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
- this.addEntity(entityhorseskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit
+ // Purpur start
+ EntityHorseAbstract horse;
+ if (purpurConfig.zombieHorseSpawnChance > 0D && random.nextDouble() <= purpurConfig.zombieHorseSpawnChance) {
+ horse = EntityTypes.ZOMBIE_HORSE.create(this);
+ } else {
+ horse = EntityTypes.SKELETON_HORSE.create(this);
+ ((EntityHorseSkeleton) horse).setTrap(true);
+ }
+ horse.setAgeRaw(0);
+ horse.setPosition(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ addEntity(horse, CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit
+ // Purpur end
}
this.strikeLightning(new EntityLightning(this, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, flag1), org.bukkit.event.weather.LightningStrikeEvent.Cause.WEATHER); // CraftBukkit
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index ce17384c1d..300622e50d 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -643,9 +643,11 @@ public class PurpurWorldConfig {
public boolean zombieHorseCanSwim = false;
public boolean zombieHorseRidableInWater = false;
+ public double zombieHorseSpawnChance = 0.0D;
private void zombieHorseSettings() {
zombieHorseCanSwim = getBoolean("mobs.zombie_horse.can-swim", zombieHorseCanSwim);
zombieHorseRidableInWater = getBoolean("mobs.zombie_horse.ridable-in-water", zombieHorseRidableInWater);
+ zombieHorseSpawnChance = getDouble("mobs.zombie_horse.spawn-chance", zombieHorseSpawnChance);
}
public boolean zombiePigmanRidable = false;
--
2.24.0