From ac880e00b489381b8085777c40c7c49f103c0140 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Mon, 13 Nov 2017 20:30:45 -0500 Subject: [PATCH] Fix logic for unconditional xp orb merging Fixes GH-936 --- ...on-for-maximum-exp-value-when-merging-orbs.patch | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Spigot-Server-Patches/0249-Option-for-maximum-exp-value-when-merging-orbs.patch b/Spigot-Server-Patches/0249-Option-for-maximum-exp-value-when-merging-orbs.patch index 5e7a9f861..c9b65a8e4 100644 --- a/Spigot-Server-Patches/0249-Option-for-maximum-exp-value-when-merging-orbs.patch +++ b/Spigot-Server-Patches/0249-Option-for-maximum-exp-value-when-merging-orbs.patch @@ -1,4 +1,4 @@ -From 087039842d17fe274692739ca184f79170dc56e8 Mon Sep 17 00:00:00 2001 +From 9a01c82ac164d387248cbb3d008629db0d87f176 Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Fri, 10 Nov 2017 23:03:12 -0500 Subject: [PATCH] Option for maximum exp value when merging orbs @@ -20,16 +20,17 @@ 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 -@@ -1158,16 +1158,29 @@ public abstract class World implements IBlockAccess { +@@ -1158,16 +1158,30 @@ public abstract class World implements IBlockAccess { EntityExperienceOrb xp = (EntityExperienceOrb) entity; double radius = spigotConfig.expMerge; 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; @@ -55,5 +56,5 @@ index 9aec59d3..26d63369 100644 } // Spigot end -- -2.14.2 +2.14.3