diff options
author | Jake Potrebic <[email protected]> | 2022-03-30 13:28:38 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2022-03-30 13:28:38 -0700 |
commit | 7f47b9b7f84f9bee31b3e046a8dcbd28ec012fe0 (patch) | |
tree | 08dd0cadd782982719e33315c2ae5687b2ce21fb /patches/server/0130-Add-option-to-make-parrots-stay-on-shoulders-despite.patch | |
parent | d3c102373f90cffa1be2a19ce671d99d563ff9ca (diff) | |
download | Paper-7f47b9b7f84f9bee31b3e046a8dcbd28ec012fe0.tar.gz Paper-7f47b9b7f84f9bee31b3e046a8dcbd28ec012fe0.zip |
Remove KeyedObject interface (#7680)
Diffstat (limited to 'patches/server/0130-Add-option-to-make-parrots-stay-on-shoulders-despite.patch')
-rw-r--r-- | patches/server/0130-Add-option-to-make-parrots-stay-on-shoulders-despite.patch | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/patches/server/0130-Add-option-to-make-parrots-stay-on-shoulders-despite.patch b/patches/server/0130-Add-option-to-make-parrots-stay-on-shoulders-despite.patch new file mode 100644 index 0000000000..536d61716f --- /dev/null +++ b/patches/server/0130-Add-option-to-make-parrots-stay-on-shoulders-despite.patch @@ -0,0 +1,58 @@ +From 0000000000000000000000000000000000000000 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 72501b05d1d5d9304e4ac31bbf694f5ca1637c0f..f459b23282e5353f0f57bd228af7e8d53050eda9 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -371,4 +371,10 @@ public class PaperWorldConfig { + maxCollisionsPerEntity = getInt( "max-entity-collisions", this.spigotConfig.getInt("max-entity-collisions", this.maxCollisionsPerEntity, false) ); + 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/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index 3f8dcf091ac81c431bbe572d9c2bd65ea003b86a..0abdb8524dcd9d7bb62c200cd96e2d156bddfd0e 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -2070,6 +2070,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + switch (packet.getAction()) { + case PRESS_SHIFT_KEY: + this.player.setShiftKeyDown(true); ++ ++ // Paper start - Hang on! ++ if (this.player.level.paperConfig.parrotsHangOnBetter) { ++ this.player.removeEntitiesOnShoulder(); ++ } ++ // Paper end ++ + break; + case RELEASE_SHIFT_KEY: + this.player.setShiftKeyDown(false); +diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java +index df753a2d39332464f16207615175bc95d35f61e8..fe715c81ea755f83fae0020e66f5e61304c51867 100644 +--- a/src/main/java/net/minecraft/world/entity/player/Player.java ++++ b/src/main/java/net/minecraft/world/entity/player/Player.java +@@ -578,7 +578,7 @@ public abstract class Player extends LivingEntity { + this.playShoulderEntityAmbientSound(this.getShoulderEntityLeft()); + this.playShoulderEntityAmbientSound(this.getShoulderEntityRight()); + if (!this.level.isClientSide && (this.fallDistance > 0.5F || this.isInWater()) || this.abilities.flying || this.isSleeping() || this.isInPowderSnow) { +- this.removeEntitiesOnShoulder(); ++ if (!this.level.paperConfig.parrotsHangOnBetter) this.removeEntitiesOnShoulder(); // Paper - Hang on! + } + + } |