testserver/patches/server/0797-Fix-xp-reward-for-baby...

33 lines
1.3 KiB
Diff
Raw Normal View History

2022-01-16 19:15:16 +00:00
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
2022-11-03 21:03:31 +00:00
index c5b6236c58485351fb2866197b55d2c8809105c7..dc9402e343d3bc0b0d38e3a7834521a976f89c39 100644
2022-01-16 19:15:16 +00:00
--- 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 {
2022-01-16 19:15:16 +00:00
@Override
public int getExperienceReward() {
2022-01-16 19:15:16 +00:00
+ final int previousReward = this.xpReward; // Paper - store previous value to reset after calculating XP reward
if (this.isBaby()) {
2022-03-01 05:43:03 +00:00
this.xpReward = (int) ((double) this.xpReward * 2.5D);
2022-01-16 19:15:16 +00:00
}
- return super.getExperienceReward();
2022-01-16 19:15:16 +00:00
+ // Paper start - only change the XP reward for the calculations in the super method
+ int reward = super.getExperienceReward();
2022-01-16 19:15:16 +00:00
+ this.xpReward = previousReward;
+ return reward;
+ // Paper end
}
@Override