2018-07-25 10:58:03 +02:00
|
|
|
From 9578efb4818e086eadd5b51ea7d33f5d2fb0afbf Mon Sep 17 00:00:00 2001
|
2017-05-17 04:34:47 +02: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
|
2018-07-25 10:58:03 +02:00
|
|
|
index 4991138dfe..87c599338a 100644
|
2017-05-17 04:34:47 +02:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2018-07-24 02:24:44 +02:00
|
|
|
@@ -350,4 +350,10 @@ public class PaperWorldConfig {
|
2017-05-17 04:34:47 +02: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
|
2018-07-25 10:58:03 +02:00
|
|
|
index 06b663c4db..42c6249535 100644
|
2017-05-17 04:34:47 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
2018-07-18 02:08:13 +02:00
|
|
|
@@ -460,7 +460,7 @@ public abstract class EntityHuman extends EntityLiving {
|
2017-05-17 04:34:47 +02:00
|
|
|
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) {
|
2017-05-17 04:34:47 +02: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
|
2018-07-25 10:58:03 +02:00
|
|
|
index 08ef17dfe1..d4701d8d56 100644
|
2017-05-17 04:34:47 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
2018-07-25 10:58:03 +02:00
|
|
|
@@ -1747,6 +1747,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
2018-07-18 02:08:13 +02:00
|
|
|
switch (packetplayinentityaction.c()) {
|
2017-05-17 04:34:47 +02:00
|
|
|
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-07-18 02:08:13 +02:00
|
|
|
2.18.0
|
2017-05-17 04:34:47 +02:00
|
|
|
|