aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0830-Fix-xp-reward-for-baby-zombies.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0830-Fix-xp-reward-for-baby-zombies.patch')
-rw-r--r--patches/server/0830-Fix-xp-reward-for-baby-zombies.patch32
1 files changed, 32 insertions, 0 deletions
diff --git a/patches/server/0830-Fix-xp-reward-for-baby-zombies.patch b/patches/server/0830-Fix-xp-reward-for-baby-zombies.patch
new file mode 100644
index 0000000000..42920471c5
--- /dev/null
+++ b/patches/server/0830-Fix-xp-reward-for-baby-zombies.patch
@@ -0,0 +1,32 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jake Potrebic <[email protected]>
+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 3e1fa4336cc18eaeb048d0a1d592cf74820ff3b2..97b3082dc020043fa38d9e5e4591102f97519ed3 100644
+--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
++++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+@@ -173,11 +173,16 @@ public class Zombie extends Monster {
+
+ @Override
+ public int getExperienceReward() {
++ final int previousReward = this.xpReward; // Paper - store previous value to reset after calculating XP reward
+ if (this.isBaby()) {
+ this.xpReward = (int) ((double) this.xpReward * 2.5D);
+ }
+
+- return super.getExperienceReward();
++ // Paper start - only change the XP reward for the calculations in the super method
++ int reward = super.getExperienceReward();
++ this.xpReward = previousReward;
++ return reward;
++ // Paper end
+ }
+
+ @Override