mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 23:57:43 +01:00
0d3b35c339
This option does not set the absolute speed of the entity as the name implies. It sets a modifier. The default (vanilla) value of `0.5` sets the baby zombie to move at 50% faster than the base speed. A negative value like `-0.4` would set them to move at 40% slower. There should be no functional changes as a result of this change, it's just clarifying the config name.
61 lines
2.9 KiB
Diff
61 lines
2.9 KiB
Diff
From 4e20ea037a039e8799ae11a8767bb7eb482b6865 Mon Sep 17 00:00:00 2001
|
|
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
|
|
index 2d01984f0..42c4a9445 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -326,4 +326,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 4ceac0a2f..c162c6b73 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
|
@@ -451,7 +451,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.isSleeping()) {
|
|
- 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 068827e2e..579c551f9 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
@@ -1756,6 +1756,13 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
|
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.23.0
|
|
|