Config to prevent horses from standing with riders

This commit is contained in:
Encode42
2021-07-28 16:35:09 -04:00
parent 9711fb51c6
commit cdc0e32ca8

View File

@@ -0,0 +1,41 @@
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 16b72398645757ca194cb638f46b4528283e2199..03ae6519a523ee73cce664d85074b5f9525de6d6 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
@@ -394,7 +394,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/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 35ec2183e4f05020e9370f7e24f9dadc43119a1d..5d9f610c649e4f34dfc3b3b151ab5cefd1fc4f03 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -1435,6 +1435,7 @@ public class PurpurWorldConfig {
public double horseMovementSpeedMin = 0.1125D;
public double horseMovementSpeedMax = 0.3375D;
public int horseBreedingTicks = 6000;
+ public boolean horseStandWithRider = true;
private void horseSettings() {
horseRidableInWater = getBoolean("mobs.horse.ridable-in-water", horseRidableInWater);
if (PurpurConfig.version < 10) {
@@ -1451,6 +1452,7 @@ public class PurpurWorldConfig {
horseMovementSpeedMin = getDouble("mobs.horse.attributes.movement_speed.min", horseMovementSpeedMin);
horseMovementSpeedMax = getDouble("mobs.horse.attributes.movement_speed.max", horseMovementSpeedMax);
horseBreedingTicks = getInt("mobs.horse.breeding-delay-ticks", horseBreedingTicks);
+ horseStandWithRider = getBoolean("mobs.horse.stand-with-rider", horseStandWithRider);
}
public boolean huskRidable = false;