aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0850-Fix-xp-reward-for-baby-zombies.patch
diff options
context:
space:
mode:
authorJake Potrebic <[email protected]>2022-03-04 00:09:43 -0800
committerGitHub <[email protected]>2022-03-04 09:09:43 +0100
commit15b6b3db2cf24c98afbfb0849e694875d18fc021 (patch)
tree03e884d0c7fe2ce292825b5b51ec4c9a6ce2e8cc /patches/server/0850-Fix-xp-reward-for-baby-zombies.patch
parent753bf2c1034c5f35cc0839001d12363a44f936fc (diff)
downloadPaper-15b6b3db2cf24c98afbfb0849e694875d18fc021.tar.gz
Paper-15b6b3db2cf24c98afbfb0849e694875d18fc021.zip
Add StructuresLocateEvent as replacement for StructureLocateEvent (#7524)
Diffstat (limited to 'patches/server/0850-Fix-xp-reward-for-baby-zombies.patch')
-rw-r--r--patches/server/0850-Fix-xp-reward-for-baby-zombies.patch32
1 files changed, 32 insertions, 0 deletions
diff --git a/patches/server/0850-Fix-xp-reward-for-baby-zombies.patch b/patches/server/0850-Fix-xp-reward-for-baby-zombies.patch
new file mode 100644
index 0000000000..0c5733a372
--- /dev/null
+++ b/patches/server/0850-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 da378373db05f7cf5e655bc76cb58945347d1f32..1954e1b179539be725c291cdda16fb17c8bcea47 100644
+--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
++++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+@@ -172,11 +172,16 @@ 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) ((double) this.xpReward * 2.5D);
+ }
+
+- 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