Paper/Spigot-Server-Patches/0179-Add-option-to-make-parrots-stay-on-shoulders-despite.patch

62 Zeilen
2.9 KiB
Diff

2018-09-09 20:38:27 +02:00
From e62bc03a0b8b6195c0dd66807a67c4132544d034 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 16 May 2017 21:29:08 -0500
Subject: [PATCH] Add option to make parrots stay on shoulders despite movement
Makes parrots not fall off whenever the player changes height, or touches water, or gets hit by a passing leaf.
Instead, switches the behavior so that players have to sneak to make the birds leave.
I suspect Mojang may switch to this behavior before full release.
To be converted into a Paper-API event at some point in the future?
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
2018-09-09 20:38:27 +02:00
index 89234545..0094f6ab 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -353,4 +353,10 @@ public class PaperWorldConfig {
maxCollisionsPerEntity = getInt( "max-entity-collisions", this.spigotConfig.getInt("max-entity-collisions", 8) );
log( "Max Entity Collisions: " + maxCollisionsPerEntity );
}
+
+ public boolean parrotsHangOnBetter;
+ private void parrotsHangOnBetter() {
+ parrotsHangOnBetter = getBoolean("parrots-are-unaffected-by-player-movement", false);
+ log("Parrots are unaffected by player movement: " + parrotsHangOnBetter);
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
2018-09-09 20:38:27 +02:00
index ad9e7f7b..0f00eece 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
2018-09-09 20:38:27 +02:00
@@ -469,7 +469,7 @@ public abstract class EntityHuman extends EntityLiving {
this.j(this.getShoulderEntityLeft());
this.j(this.getShoulderEntityRight());
2017-05-31 10:04:52 +02:00
if (!this.world.isClientSide && (this.fallDistance > 0.5F || this.isInWater() || this.isPassenger()) || this.abilities.isFlying) {
- this.releaseShoulderEntities();
+ if (!this.world.paperConfig.parrotsHangOnBetter) this.releaseShoulderEntities(); // Paper - Hang on!
}
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
2018-09-09 20:38:27 +02:00
index e09f2f5b..8c7428c0 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1757,6 +1757,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
switch (packetplayinentityaction.c()) {
case START_SNEAKING:
this.player.setSneaking(true);
+
+ // Paper start - Hang on!
+ if (this.player.world.paperConfig.parrotsHangOnBetter) {
+ this.player.releaseShoulderEntities();
+ }
+ // Paper end
+
break;
case STOP_SNEAKING:
--
2018-09-09 20:38:27 +02:00
2.18.0.windows.1