Fix logic for unconditional xp orb merging
Fixes GH-936
This commit is contained in:
@@ -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
|
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
|
--- a/src/main/java/net/minecraft/server/World.java
|
||||||
+++ b/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 {
|
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||||
@@ -29,7 +29,8 @@ index 9aec59d3..26d63369 100644
|
|||||||
if (radius > 0) {
|
if (radius > 0) {
|
||||||
+ // Paper start - Maximum exp value when merging - Whole section has been tweaked, see comments for specifics
|
+ // Paper start - Maximum exp value when merging - Whole section has been tweaked, see comments for specifics
|
||||||
+ final int maxValue = paperConfig.expMergeMaxValue;
|
+ 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<Entity> entities = this.getEntities(entity, entity.getBoundingBox().grow(radius, radius, radius));
|
List<Entity> entities = this.getEntities(entity, entity.getBoundingBox().grow(radius, radius, radius));
|
||||||
for (Entity e : entities) {
|
for (Entity e : entities) {
|
||||||
@@ -39,7 +40,7 @@ index 9aec59d3..26d63369 100644
|
|||||||
+ if (!loopItem.dead && !(maxValue > 0 && loopItem.value >= maxValue)) { // Paper
|
+ if (!loopItem.dead && !(maxValue > 0 && loopItem.value >= maxValue)) { // Paper
|
||||||
xp.value += loopItem.value;
|
xp.value += loopItem.value;
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ if (xp.value > maxValue) {
|
+ if (!mergeUnconditionally && xp.value > maxValue) {
|
||||||
+ loopItem.value = xp.value - maxValue;
|
+ loopItem.value = xp.value - maxValue;
|
||||||
+ xp.value = maxValue;
|
+ xp.value = maxValue;
|
||||||
+ break;
|
+ break;
|
||||||
|
|||||||
Reference in New Issue
Block a user