Files
Purpur/patches/server/0219-Config-to-prevent-horses-from-standing-with-riders.patch
2021-12-02 19:15:58 -05:00

42 lines
2.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Encode42 <me@encode42.dev>
Date: Wed, 28 Jul 2021 15:52:32 -0400
Subject: [PATCH] Config to prevent horses from standing with riders
Horses have a chance to stand (rear) when their ambient noise is played.
This can happen while the horse is moving with a rider, which will cause the horse to suddenly stop for a moment.
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 0be0c81f2b0a58eba75eb8559f78d8a58014d0ae..f7088aaf65ee5725e928845a634852119b403cef 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
@@ -396,7 +396,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
@Nullable
@Override
protected SoundEvent getAmbientSound() {
- if (this.random.nextInt(10) == 0 && !this.isImmobile()) {
+ if (this.random.nextInt(10) == 0 && !this.isImmobile() && !(!this.level.purpurConfig.horseStandWithRider && this.getControllingPassenger() != null)) { // Purpur
this.stand();
}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 97cb7b68186b1379efce1d855adc4d4be1dadfe4..42a9f68ffc4f9a6d55266b935b93de2c68a01e66 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -1484,6 +1484,7 @@ public class PurpurWorldConfig {
public double horseMovementSpeedMax = 0.3375D;
public int horseBreedingTicks = 6000;
public boolean horseTakeDamageFromWater = false;
+ public boolean horseStandWithRider = true;
private void horseSettings() {
horseRidableInWater = getBoolean("mobs.horse.ridable-in-water", horseRidableInWater);
if (PurpurConfig.version < 10) {
@@ -1501,6 +1502,7 @@ public class PurpurWorldConfig {
horseMovementSpeedMax = getDouble("mobs.horse.attributes.movement_speed.max", horseMovementSpeedMax);
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);
}
public boolean huskRidable = false;