aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0693-Fix-xp-reward-for-baby-zombies.patch
blob: f3c6e8841b9bd73ca5df01eafc950e658501a812 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
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 a41a2ffe3b0af5c244a513c839829da3f86e5ed3..5c40e994007dbf46ebc12c1e6a6ca90379471b74 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -175,11 +175,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 - store previous value to reset after calculating XP reward
+        int reward = super.getExperienceReward();
+        this.xpReward = previousReward;
+        return reward;
+        // Paper end - store previous value to reset after calculating XP reward
     }
 
     @Override