3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-14 20:10:05 +01:00
Paper/patches/server/0647-Fix-xp-reward-for-baby-zombies.patch

33 Zeilen
1.4 KiB
Diff

2022-01-16 20:15:16 +01: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
2024-10-25 13:34:01 +02:00
index a835ec6e063dd247a008da84446f8647f38d89d4..94b3ba2688676e92d9d093b63d92cab39d5d2f02 100644
2022-01-16 20:15:16 +01:00
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
2024-10-23 22:52:43 +02:00
@@ -174,11 +174,16 @@ public class Zombie extends Monster {
2022-01-16 20:15:16 +01:00
@Override
2024-10-23 22:52:43 +02:00
protected int getBaseExperienceReward(ServerLevel world) {
2022-01-16 20:15:16 +01:00
+ final int previousReward = this.xpReward; // Paper - store previous value to reset after calculating XP reward
if (this.isBaby()) {
2022-03-01 06:43:03 +01:00
this.xpReward = (int) ((double) this.xpReward * 2.5D);
2022-01-16 20:15:16 +01:00
}
2024-10-23 22:52:43 +02:00
- return super.getBaseExperienceReward(world);
+ // Paper start - store previous value to reset after calculating XP reward
2024-10-23 22:52:43 +02:00
+ int reward = super.getBaseExperienceReward(world);
2022-01-16 20:15:16 +01:00
+ this.xpReward = previousReward;
+ return reward;
+ // Paper end - store previous value to reset after calculating XP reward
2022-01-16 20:15:16 +01:00
}
@Override