2020-05-06 09:48:49 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2017-05-17 02:34:47 +00:00
|
|
|
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
|
2020-05-06 09:48:49 +00:00
|
|
|
index 751551f173338217f6682532a9a5e1a269415177..eae1690cc6db99b2f3af70a121f83b455b0fb20d 100644
|
2017-05-17 02:34:47 +00:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2020-01-18 17:28:32 +00:00
|
|
|
@@ -328,4 +328,10 @@ public class PaperWorldConfig {
|
2017-05-17 02:34:47 +00:00
|
|
|
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
|
2020-05-06 09:48:49 +00:00
|
|
|
index 0e8ba05455161883c86df6606104fab3529c3c0c..ad79e4521cee699de86a94885b27356339bcb866 100644
|
2017-05-17 02:34:47 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
2019-12-11 23:43:22 +00:00
|
|
|
@@ -463,7 +463,7 @@ public abstract class EntityHuman extends EntityLiving {
|
2017-05-17 02:34:47 +00:00
|
|
|
this.j(this.getShoulderEntityLeft());
|
|
|
|
this.j(this.getShoulderEntityRight());
|
2019-12-11 23:43:22 +00:00
|
|
|
if (!this.world.isClientSide && (this.fallDistance > 0.5F || this.isInWater()) || this.abilities.isFlying || this.isSleeping()) {
|
2017-05-17 02:34:47 +00:00
|
|
|
- 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
|
2020-06-25 01:10:30 +00:00
|
|
|
index d6f5f176d4b5a39ddea4a9dc31a2322cc7d9d2d0..26f894c752d623ed082f97fdbffe5a6680a941b7 100644
|
2017-05-17 02:34:47 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
2020-02-09 00:32:48 +00:00
|
|
|
@@ -1773,6 +1773,13 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
2018-07-18 00:08:13 +00:00
|
|
|
switch (packetplayinentityaction.c()) {
|
2019-12-11 23:43:22 +00:00
|
|
|
case PRESS_SHIFT_KEY:
|
2019-05-27 23:01:45 +00:00
|
|
|
this.player.setSneaking(true);
|
2017-05-17 02:34:47 +00:00
|
|
|
+
|
|
|
|
+ // Paper start - Hang on!
|
|
|
|
+ if (this.player.world.paperConfig.parrotsHangOnBetter) {
|
|
|
|
+ this.player.releaseShoulderEntities();
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
2019-05-27 23:01:45 +00:00
|
|
|
break;
|
2019-12-11 23:43:22 +00:00
|
|
|
case RELEASE_SHIFT_KEY:
|
2019-05-27 23:01:45 +00:00
|
|
|
this.player.setSneaking(false);
|