From c8208e94828fbd3394894ff3d75da0b42346d27f Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Sun, 16 Jan 2022 11:15:16 -0800 Subject: [PATCH] Fix xp reward for baby zombies (#7353) --- .../Fix-xp-reward-for-baby-zombies.patch | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 patches/server/Fix-xp-reward-for-baby-zombies.patch diff --git a/patches/server/Fix-xp-reward-for-baby-zombies.patch b/patches/server/Fix-xp-reward-for-baby-zombies.patch new file mode 100644 index 0000000000..0f4be6fe53 --- /dev/null +++ b/patches/server/Fix-xp-reward-for-baby-zombies.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sun, 16 Jan 2022 10:34:02 -0800 +Subject: [PATCH] Fix xp reward for baby zombies + +The field that tracks the xpReward was not +getting reset if the death was cancelled +so this resets it after each call to +Zombie#getExperienceReward + +diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java ++++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java +@@ -0,0 +0,0 @@ public class Zombie extends Monster { + + @Override + protected int getExperienceReward(Player player) { ++ final int previousReward = this.xpReward; // Paper - store previous value to reset after calculating XP reward + if (this.isBaby()) { + this.xpReward = (int) ((float) this.xpReward * 2.5F); + } + +- return super.getExperienceReward(player); ++ // Paper start - only change the XP reward for the calculations in the super method ++ int reward = super.getExperienceReward(player); ++ this.xpReward = previousReward; ++ return reward; ++ // Paper end + } + + @Override