3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-16 11:30:06 +01:00
Paper/Spigot-Server-Patches/0063-Undead-horse-leashing.patch
2020-06-26 15:54:39 -07:00

53 Zeilen
2.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 18 Mar 2016 14:19:19 -0400
Subject: [PATCH] Undead horse leashing
default false to match vanilla, but option to allow undead horse types to be leashed.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 04430aae52205ee167662004e45c145b9d2e8bed..dd21221534542d0265fa7d2178ab69c236579cf7 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -208,4 +208,9 @@ public class PaperWorldConfig {
private void nonPlayerEntitiesOnScoreboards() {
nonPlayerEntitiesOnScoreboards = getBoolean("allow-non-player-entities-on-scoreboards", false);
}
+
+ public boolean allowLeashingUndeadHorse = false;
+ private void allowLeashingUndeadHorse() {
+ allowLeashingUndeadHorse = getBoolean("allow-leashing-undead-horse", false);
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityHorseAbstract.java b/src/main/java/net/minecraft/server/EntityHorseAbstract.java
index 364697e0155012c300219ad94a3995809e6c2f8f..d45d025fa74a5ff53f0828f51639e19613e30186 100644
--- a/src/main/java/net/minecraft/server/EntityHorseAbstract.java
+++ b/src/main/java/net/minecraft/server/EntityHorseAbstract.java
@@ -106,6 +106,13 @@ public abstract class EntityHorseAbstract extends EntityAnimal implements IInven
this.bx = flag;
}
+ // Paper start
+ @Override
+ public boolean a(EntityHuman entityhuman) {
+ return world.paperConfig.allowLeashingUndeadHorse ? super.a(entityhuman) : super.a(entityhuman) && this.getMonsterType() != EnumMonsterType.UNDEAD; // Paper
+ }
+ // Paper end
+
@Override
protected void t(float f) {
if (f > 6.0F && this.fa()) {
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 9715f10c790c0210435622ab9997ac40f98da185..2f85d9799d67d3fb1d340179d8dbd03771467329 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -1282,7 +1282,7 @@ public abstract class EntityInsentient extends EntityLiving {
}
- public boolean a(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) { // Paper - overriden in EntityHorseAbstract
return !this.isLeashed() && !(this instanceof IMonster);
}