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? == AT == public net.minecraft.world.entity.player.Player removeEntitiesOnShoulder()V
This commit is contained in:
@@ -80,7 +80,15 @@
|
||||
super.rideTick();
|
||||
this.oBob = this.bob;
|
||||
this.bob = 0.0F;
|
||||
@@ -719,7 +746,14 @@
|
||||
@@ -593,6 +620,7 @@
|
||||
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) {
|
||||
+ if (!this.level().paperConfig().entities.behavior.parrotsAreUnaffectedByPlayerMovement) // Paper - Add option to make parrots stay
|
||||
this.removeEntitiesOnShoulder();
|
||||
}
|
||||
|
||||
@@ -719,7 +747,14 @@
|
||||
|
||||
@Nullable
|
||||
public ItemEntity drop(ItemStack stack, boolean throwRandomly, boolean retainOwnership) {
|
||||
@@ -96,7 +104,7 @@
|
||||
this.swing(InteractionHand.MAIN_HAND);
|
||||
}
|
||||
|
||||
@@ -809,7 +843,7 @@
|
||||
@@ -809,7 +844,7 @@
|
||||
}
|
||||
|
||||
if (nbt.contains("LastDeathLocation", 10)) {
|
||||
@@ -105,7 +113,7 @@
|
||||
Logger logger = Player.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -817,7 +851,7 @@
|
||||
@@ -817,7 +852,7 @@
|
||||
}
|
||||
|
||||
if (nbt.contains("current_explosion_impact_pos", 9)) {
|
||||
@@ -114,7 +122,7 @@
|
||||
Logger logger1 = Player.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger1);
|
||||
@@ -854,7 +888,7 @@
|
||||
@@ -854,7 +889,7 @@
|
||||
}
|
||||
|
||||
this.getLastDeathLocation().flatMap((globalpos) -> {
|
||||
@@ -123,7 +131,7 @@
|
||||
Logger logger = Player.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -886,10 +920,10 @@
|
||||
@@ -886,10 +921,10 @@
|
||||
if (this.isDeadOrDying()) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -136,7 +144,7 @@
|
||||
}
|
||||
|
||||
if (world.getDifficulty() == Difficulty.EASY) {
|
||||
@@ -901,7 +935,13 @@
|
||||
@@ -901,7 +936,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +159,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -923,10 +963,29 @@
|
||||
@@ -923,10 +964,29 @@
|
||||
}
|
||||
|
||||
public boolean canHarmPlayer(Player player) {
|
||||
@@ -184,7 +192,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -966,32 +1025,38 @@
|
||||
@@ -966,32 +1026,38 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,7 +245,7 @@
|
||||
}
|
||||
|
||||
public boolean isTextFilteringEnabled() {
|
||||
@@ -1144,10 +1209,15 @@
|
||||
@@ -1144,10 +1210,15 @@
|
||||
|
||||
f *= 0.2F + f2 * f2 * 0.8F;
|
||||
f1 *= f2;
|
||||
@@ -254,7 +262,7 @@
|
||||
if (iprojectile.deflect(ProjectileDeflection.AIM_DEFLECT, this, this, true)) {
|
||||
this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_NODAMAGE, this.getSoundSource());
|
||||
return;
|
||||
@@ -1223,8 +1293,13 @@
|
||||
@@ -1223,8 +1294,13 @@
|
||||
if (entityliving2 != this && entityliving2 != target && !this.isAlliedTo((Entity) entityliving2) && (!(entityliving2 instanceof ArmorStand) || !((ArmorStand) entityliving2).isMarker()) && this.distanceToSqr((Entity) entityliving2) < 9.0D) {
|
||||
float f7 = this.getEnchantedDamage(entityliving2, f6, damagesource) * f2;
|
||||
|
||||
@@ -269,7 +277,7 @@
|
||||
Level world = this.level();
|
||||
|
||||
if (world instanceof ServerLevel) {
|
||||
@@ -1240,9 +1315,26 @@
|
||||
@@ -1240,9 +1316,26 @@
|
||||
}
|
||||
|
||||
if (target instanceof ServerPlayer && target.hurtMarked) {
|
||||
@@ -296,7 +304,7 @@
|
||||
}
|
||||
|
||||
if (flag2) {
|
||||
@@ -1308,9 +1400,14 @@
|
||||
@@ -1308,9 +1401,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -312,7 +320,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1351,7 +1448,14 @@
|
||||
@@ -1351,7 +1449,14 @@
|
||||
|
||||
@Override
|
||||
public void remove(Entity.RemovalReason reason) {
|
||||
@@ -328,7 +336,7 @@
|
||||
this.inventoryMenu.removed(this);
|
||||
if (this.containerMenu != null && this.hasContainerOpen()) {
|
||||
this.doCloseContainer();
|
||||
@@ -1391,7 +1495,13 @@
|
||||
@@ -1391,7 +1496,13 @@
|
||||
}
|
||||
|
||||
public Either<Player.BedSleepingProblem, Unit> startSleepInBed(BlockPos pos) {
|
||||
@@ -343,7 +351,7 @@
|
||||
this.sleepCounter = 0;
|
||||
return Either.right(Unit.INSTANCE);
|
||||
}
|
||||
@@ -1545,12 +1655,24 @@
|
||||
@@ -1545,12 +1656,24 @@
|
||||
}
|
||||
|
||||
public void startFallFlying() {
|
||||
@@ -369,7 +377,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1665,10 +1787,21 @@
|
||||
@@ -1665,10 +1788,21 @@
|
||||
return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2);
|
||||
}
|
||||
|
||||
@@ -392,7 +400,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1748,13 +1881,20 @@
|
||||
@@ -1748,13 +1882,20 @@
|
||||
|
||||
@Override
|
||||
public void setItemSlot(EquipmentSlot slot, ItemStack stack) {
|
||||
@@ -420,7 +428,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1798,26 +1938,31 @@
|
||||
@@ -1798,26 +1939,31 @@
|
||||
|
||||
public void removeEntitiesOnShoulder() {
|
||||
if (this.timeEntitySatOnShoulder + 20L < this.level().getGameTime()) {
|
||||
|
||||
Reference in New Issue
Block a user