Files
Purpur/patches/server/0269-Config-to-prevent-horses-from-standing-when-hurt.patch
2022-10-15 11:57:23 -05:00

43 lines
2.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: galacticwarrior9 <zareef1@yahoo.com>
Date: Thu, 14 Apr 2022 17:48:07 +0100
Subject: [PATCH] Config to prevent horses from standing when hurt
Horses have a chance to stand when their hurt noise plays (i.e. when taking damage).
This patch adds an option to toggle this behaviour ('stand-when-hurt').
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
index 7466c437b2e996f16a08aaefc5c2b7cba216a14c..205ce2bd91a98a0c67d3c5dd640eb88c052f9425 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
@@ -388,7 +388,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
@Nullable
@Override
protected SoundEvent getHurtSound(DamageSource source) {
- if (this.random.nextInt(3) == 0) {
+ if (this.level.purpurConfig.horseStandWhenHurt && this.random.nextInt(3) == 0) { // Purpur
this.stand();
}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 8a3b8bed4058336625cc3dcbe9449416dc666476..d9f6345190d6efa330a680bc4d46962e47ad50f2 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -1682,6 +1682,7 @@ public class PurpurWorldConfig {
public int horseBreedingTicks = 6000;
public boolean horseTakeDamageFromWater = false;
public boolean horseStandWithRider = true;
+ public boolean horseStandWhenHurt = true;
public boolean horseAlwaysDropExp = false;
private void horseSettings() {
horseRidableInWater = getBoolean("mobs.horse.ridable-in-water", horseRidableInWater);
@@ -1701,6 +1702,7 @@ public class PurpurWorldConfig {
horseBreedingTicks = getInt("mobs.horse.breeding-delay-ticks", horseBreedingTicks);
horseTakeDamageFromWater = getBoolean("mobs.horse.takes-damage-from-water", horseTakeDamageFromWater);
horseStandWithRider = getBoolean("mobs.horse.stand-with-rider", horseStandWithRider);
+ horseStandWhenHurt = getBoolean("mobs.horse.stand-when-hurt", horseStandWhenHurt);
horseAlwaysDropExp = getBoolean("mobs.horse.always-drop-exp", horseAlwaysDropExp);
}