2020-05-06 11:48:49 +02:00
|
|
|
From 0000000000000000000000000000000000000000 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
|
2021-01-11 02:44:06 +01:00
|
|
|
index c611b5a63498f5ad1f50a75ccd5d7299e27df7e3..9d1cddc6038f0fd0286e4a32013ae98ff0b00dd1 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
|
2021-01-11 02:44:06 +01:00
|
|
|
@@ -330,4 +330,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
|
2021-03-03 23:43:45 +01:00
|
|
|
index ed2c39502a123063996c7d36cacf5a7164d75438..62c914893ffd40c0e88a9d11f04fb5c7dea9063a 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
|
2021-03-03 23:43:45 +01:00
|
|
|
@@ -436,7 +436,7 @@ public abstract class EntityHuman extends EntityLiving {
|
2017-05-17 04:34:47 +02:00
|
|
|
this.j(this.getShoulderEntityLeft());
|
|
|
|
this.j(this.getShoulderEntityRight());
|
2019-12-12 00:43:22 +01:00
|
|
|
if (!this.world.isClientSide && (this.fallDistance > 0.5F || this.isInWater()) || this.abilities.isFlying || this.isSleeping()) {
|
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
|
2021-03-03 23:43:45 +01:00
|
|
|
index 9c25c0e60d9ebeac7ff93f41d0624961811de164..b6f68a8d1eb523fa0e33fae717249bbba2c0715b 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
|
2021-03-02 04:07:12 +01:00
|
|
|
@@ -1905,6 +1905,13 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
2018-07-18 02:08:13 +02:00
|
|
|
switch (packetplayinentityaction.c()) {
|
2019-12-12 00:43:22 +01:00
|
|
|
case PRESS_SHIFT_KEY:
|
2019-05-28 01:01:45 +02:00
|
|
|
this.player.setSneaking(true);
|
2017-05-17 04:34:47 +02:00
|
|
|
+
|
|
|
|
+ // Paper start - Hang on!
|
|
|
|
+ if (this.player.world.paperConfig.parrotsHangOnBetter) {
|
|
|
|
+ this.player.releaseShoulderEntities();
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
2019-05-28 01:01:45 +02:00
|
|
|
break;
|
2019-12-12 00:43:22 +01:00
|
|
|
case RELEASE_SHIFT_KEY:
|
2019-05-28 01:01:45 +02:00
|
|
|
this.player.setSneaking(false);
|