aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0174-Add-option-to-make-parrots-stay-on-shoulders-despite.patch
diff options
context:
space:
mode:
Diffstat (limited to 'Spigot-Server-Patches/0174-Add-option-to-make-parrots-stay-on-shoulders-despite.patch')
-rw-r--r--Spigot-Server-Patches/0174-Add-option-to-make-parrots-stay-on-shoulders-despite.patch61
1 files changed, 61 insertions, 0 deletions
diff --git a/Spigot-Server-Patches/0174-Add-option-to-make-parrots-stay-on-shoulders-despite.patch b/Spigot-Server-Patches/0174-Add-option-to-make-parrots-stay-on-shoulders-despite.patch
new file mode 100644
index 0000000000..ea5e65fab6
--- /dev/null
+++ b/Spigot-Server-Patches/0174-Add-option-to-make-parrots-stay-on-shoulders-despite.patch
@@ -0,0 +1,61 @@
+From 9fa77cfb17de18c16aaa9f1bf8a73f2a841c3ef8 Mon Sep 17 00:00:00 2001
+From: Zach Brown <[email protected]>
+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
+index 72eb530d7e..8ff454e259 100644
+--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+@@ -375,4 +375,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
+index 5e5a747e9f..23e7cdfe88 100644
+--- a/src/main/java/net/minecraft/server/EntityHuman.java
++++ b/src/main/java/net/minecraft/server/EntityHuman.java
+@@ -465,7 +465,7 @@ public abstract class EntityHuman extends EntityLiving {
+ this.j(this.getShoulderEntityLeft());
+ this.j(this.getShoulderEntityRight());
+ 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
+index 05cc5afea6..ac64fcfb31 100644
+--- a/src/main/java/net/minecraft/server/PlayerConnection.java
++++ b/src/main/java/net/minecraft/server/PlayerConnection.java
+@@ -1736,6 +1736,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:
+ this.player.setSneaking(false);
+--
+2.21.0
+