Fix logic bug in negative XP bug fix - Closes #1169
This commit is contained in:
parent
22b2bf6270
commit
b3eb265ab5
|
@ -1,4 +1,4 @@
|
|||
From 076f4e8c2a78146df199092bb435153a87ceb89c Mon Sep 17 00:00:00 2001
|
||||
From 4b3b0f43a19eeb8aac309d2941de636c6dc6a62e Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Fri, 10 Nov 2017 23:03:12 -0500
|
||||
Subject: [PATCH] Option for maximum exp value when merging orbs
|
||||
|
@ -20,10 +20,10 @@ index 4d30cdbc8b..535a8d3ed1 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 3561507de1..b6b4d52718 100644
|
||||
index 3561507de1..b2f04595a6 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -1143,16 +1143,31 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -1143,16 +1143,32 @@ public abstract class World implements IBlockAccess {
|
||||
EntityExperienceOrb xp = (EntityExperienceOrb) entity;
|
||||
double radius = spigotConfig.expMerge;
|
||||
if (radius > 0) {
|
||||
|
@ -42,8 +42,9 @@ index 3561507de1..b6b4d52718 100644
|
|||
+ // Paper start
|
||||
+ if (!loopItem.dead && !(maxValue > 0 && loopItem.value >= maxValue)) {
|
||||
+ long newTotal = (long)xp.value + (long)loopItem.value;
|
||||
+ if (newTotal > (long)maxValue) {
|
||||
+ loopItem.value = xp.value - maxValue;
|
||||
+ if ((int) newTotal < 0) continue; // Overflow
|
||||
+ if (maxValue > 0 && newTotal > (long)maxValue) {
|
||||
+ loopItem.value = (int) (newTotal - maxValue);
|
||||
+ xp.value = maxValue;
|
||||
+ } else {
|
||||
+ xp.value += loopItem.value;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From 2c072e94e1c963916f63e2ff8fb41b0f933b1ccb Mon Sep 17 00:00:00 2001
|
||||
From edffea3a12ee74d888e9404c93cec44d01401149 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 19 Dec 2017 22:57:26 -0500
|
||||
Subject: [PATCH] ExperienceOrbMergeEvent
|
||||
|
@ -8,7 +8,7 @@ Plugins can cancel this if they want to ensure experience orbs do not lose impor
|
|||
metadata such as spawn reason, or conditionally move data from source to target.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index c0e79796bd..986670f689 100644
|
||||
index 60bfe2608d..e361883099 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -1154,7 +1154,7 @@ public abstract class World implements IBlockAccess {
|
||||
|
@ -18,8 +18,8 @@ index c0e79796bd..986670f689 100644
|
|||
- if (!loopItem.dead && !(maxValue > 0 && loopItem.value >= maxValue)) {
|
||||
+ if (!loopItem.dead && !(maxValue > 0 && loopItem.value >= maxValue) && new com.destroystokyo.paper.event.entity.ExperienceOrbMergeEvent((org.bukkit.entity.ExperienceOrb) entity.getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) loopItem.getBukkitEntity()).callEvent()) {
|
||||
long newTotal = (long)xp.value + (long)loopItem.value;
|
||||
if (newTotal > (long)maxValue) {
|
||||
loopItem.value = xp.value - maxValue;
|
||||
if ((int) newTotal < 0) continue; // Overflow
|
||||
if (maxValue > 0 && newTotal > (long)maxValue) {
|
||||
--
|
||||
2.18.0
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From bc6e2c6add8004c4e8a231cedcf175565100c441 Mon Sep 17 00:00:00 2001
|
||||
From 996ef85fa987a376159ace734b15c5e476a91470 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 4 Jul 2018 03:39:51 -0400
|
||||
Subject: [PATCH] Avoid Chunk Lookups for Entity/TileEntity Current Chunk
|
||||
|
@ -22,10 +22,10 @@ index d24d45fdd3..4757081090 100644
|
|||
this.a(entity, entity.ac);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 986670f689..a01488e985 100644
|
||||
index e361883099..5de8da65c0 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -1512,12 +1512,15 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -1513,12 +1513,15 @@ public abstract class World implements IBlockAccess {
|
||||
int j;
|
||||
// Paper start - Set based removal lists
|
||||
for (Entity e : this.f) {
|
||||
|
@ -42,7 +42,7 @@ index 986670f689..a01488e985 100644
|
|||
}
|
||||
|
||||
for (Entity e : this.f) {
|
||||
@@ -1578,12 +1581,17 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -1579,12 +1582,17 @@ public abstract class World implements IBlockAccess {
|
||||
this.methodProfiler.b();
|
||||
this.methodProfiler.a("remove");
|
||||
if (entity.dead) {
|
||||
|
@ -62,7 +62,7 @@ index 986670f689..a01488e985 100644
|
|||
|
||||
guardEntityList = false; // Spigot
|
||||
this.entityList.remove(this.tickPosition--); // CraftBukkit - Use field for loop variable
|
||||
@@ -1628,7 +1636,7 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -1629,7 +1637,7 @@ public abstract class World implements IBlockAccess {
|
||||
BlockPosition blockposition = tileentity.getPosition();
|
||||
|
||||
// Paper start - Skip ticking in chunks scheduled for unload
|
||||
|
@ -71,7 +71,7 @@ index 986670f689..a01488e985 100644
|
|||
boolean shouldTick = chunk != null;
|
||||
if(this.paperConfig.skipEntityTickingInChunksScheduledForUnload)
|
||||
shouldTick = shouldTick && !chunk.isUnloading() && chunk.scheduledForUnload == null;
|
||||
@@ -1664,8 +1672,11 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -1665,8 +1673,11 @@ public abstract class World implements IBlockAccess {
|
||||
tilesThisCycle--;
|
||||
this.tileEntityListTick.remove(tileTickPosition--);
|
||||
//this.tileEntityList.remove(tileentity); // Paper - remove unused list
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From df4224f8e69e3eecc619f3832f5660c09eeeecfa Mon Sep 17 00:00:00 2001
|
||||
From 186657866775b48d9c845b8066339b463c4f88ad Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Thu, 26 Jul 2018 00:11:12 -0400
|
||||
Subject: [PATCH] Prevent Saving Bad entities to chunks
|
||||
|
@ -57,10 +57,10 @@ index bcce5e8b7e..bad287fca4 100644
|
|||
nbttagcompound.set("Entities", nbttaglist1);
|
||||
NBTTagList nbttaglist2 = new NBTTagList();
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 3012768cb9..0aa2f99838 100644
|
||||
index c53e77b821..2a4405638e 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -1203,7 +1203,7 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -1204,7 +1204,7 @@ public abstract class World implements IBlockAccess {
|
||||
}
|
||||
|
||||
this.getChunkAt(i, j).a(entity);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From 1102ec474b6e3afd75431427134a4992ee08c5e8 Mon Sep 17 00:00:00 2001
|
||||
From 20049c46e31b0cfdfada2378245312927a620308 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 28 Jul 2018 12:09:20 -0400
|
||||
Subject: [PATCH] Always process chunk removal in removeEntity
|
||||
|
@ -8,10 +8,10 @@ which can keep them in the chunk when they shouldnt be if done
|
|||
during entity ticking.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 0aa2f99838..8822d17745 100644
|
||||
index 2a4405638e..eabcb4c8f9 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -1273,7 +1273,7 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -1274,7 +1274,7 @@ public abstract class World implements IBlockAccess {
|
||||
this.everyoneSleeping();
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ index 0aa2f99838..8822d17745 100644
|
|||
int i = entity.ab;
|
||||
int j = entity.ad;
|
||||
|
||||
@@ -1281,6 +1281,7 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -1282,6 +1282,7 @@ public abstract class World implements IBlockAccess {
|
||||
this.getChunkAt(i, j).b(entity);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From 485cc40d70fcb82a5538f2dac8713c253c943aed Mon Sep 17 00:00:00 2001
|
||||
From 65d78c94edafab425ea75229bbe7564974b95be1 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 28 Jul 2018 12:18:27 -0400
|
||||
Subject: [PATCH] Ignore Dead Entities in entityList iteration
|
||||
|
@ -35,10 +35,10 @@ index 1e64d5fcd6..45e149f4a3 100644
|
|||
public float length;
|
||||
public float I;
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 8822d17745..3ce6f9778b 100644
|
||||
index eabcb4c8f9..d763b48167 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -1215,6 +1215,7 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -1216,6 +1216,7 @@ public abstract class World implements IBlockAccess {
|
||||
}
|
||||
|
||||
entity.valid = true; // CraftBukkit
|
||||
|
@ -46,7 +46,7 @@ index 8822d17745..3ce6f9778b 100644
|
|||
new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid
|
||||
}
|
||||
|
||||
@@ -1280,6 +1281,7 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -1281,6 +1282,7 @@ public abstract class World implements IBlockAccess {
|
||||
if (entity.aa && this.isChunkLoaded(i, j, true)) {
|
||||
this.getChunkAt(i, j).b(entity);
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ index 8822d17745..3ce6f9778b 100644
|
|||
|
||||
if (!guardEntityList) { // Spigot - It will get removed after the tick if we are ticking // Paper - always remove from current chunk above
|
||||
// CraftBukkit start - Decrement loop variable field if we've already ticked this entity
|
||||
@@ -2634,6 +2636,7 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -2635,6 +2637,7 @@ public abstract class World implements IBlockAccess {
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
@ -62,7 +62,7 @@ index 8822d17745..3ce6f9778b 100644
|
|||
|
||||
if (oclass.isAssignableFrom(entity.getClass()) && predicate.apply((T) entity)) {
|
||||
arraylist.add(entity);
|
||||
@@ -2720,6 +2723,7 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -2721,6 +2724,7 @@ public abstract class World implements IBlockAccess {
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
|
Loading…
Reference in New Issue