From dfab59dfc77ffcfb1d04e7a278365996b10c7667 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> Date: Mon, 13 Nov 2017 20:30:45 -0500 Subject: [PATCH] Fix logic for unconditional xp orb merging Fixes GH-936 --- .../Option-for-maximum-exp-value-when-merging-orbs.patch | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Spigot-Server-Patches/Option-for-maximum-exp-value-when-merging-orbs.patch b/Spigot-Server-Patches/Option-for-maximum-exp-value-when-merging-orbs.patch index eab6656ee6..664f06424f 100644 --- a/Spigot-Server-Patches/Option-for-maximum-exp-value-when-merging-orbs.patch +++ b/Spigot-Server-Patches/Option-for-maximum-exp-value-when-merging-orbs.patch @@ -20,7 +20,7 @@ index 14f652d4..47d35228 100644 + } } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 9aec59d3..26d63369 100644 +index 9aec59d3..f9c5da59 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -29,7 +29,8 @@ index 9aec59d3..26d63369 100644 if (radius > 0) { + // Paper start - Maximum exp value when merging - Whole section has been tweaked, see comments for specifics + final int maxValue = paperConfig.expMergeMaxValue; -+ if (maxValue <= 0 || xp.value < maxValue) { // Paper - Skip iteration if unnecessary ++ final boolean mergeUnconditionally = maxValue <= 0; ++ if (mergeUnconditionally || xp.value < maxValue) { // Paper - Skip iteration if unnecessary + List entities = this.getEntities(entity, entity.getBoundingBox().grow(radius, radius, radius)); for (Entity e : entities) { @@ -39,7 +40,7 @@ index 9aec59d3..26d63369 100644 + if (!loopItem.dead && !(maxValue > 0 && loopItem.value >= maxValue)) { // Paper xp.value += loopItem.value; + // Paper start -+ if (xp.value > maxValue) { ++ if (!mergeUnconditionally && xp.value > maxValue) { + loopItem.value = xp.value - maxValue; + xp.value = maxValue; + break;