Merge branch 'master' into pre/1.13

* master:
  Fix false positive on Chunk Entity slice messages #1302
This commit is contained in:
Aikar 2018-08-20 00:58:08 -04:00
commit 2155cb7a61
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE
2 changed files with 25 additions and 21 deletions

View File

@ -1,4 +1,4 @@
From d728994e934f85f2d2ddd3aa9f3f818f37781f52 Mon Sep 17 00:00:00 2001
From 93bbdd338d77b337b8fca1fe8d65bd45b8f35079 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 23 Jul 2018 22:44:23 -0400
Subject: [PATCH] Add some Debug to Chunk Entity slices
@ -9,10 +9,10 @@ This should hopefully avoid duplicate entities ever being created
if the entity was to end up in 2 different chunk slices
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 67e2158ca..e510940ab 100644
index 67e2158ca1..17f19219f2 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -712,8 +712,33 @@ public class Chunk implements IChunkAccess {
@@ -712,8 +712,34 @@ public class Chunk implements IChunkAccess {
entity.ae = this.locX;
entity.af = k;
entity.ag = this.locZ;
@ -21,13 +21,14 @@ index 67e2158ca..e510940ab 100644
// Paper start
+ List<Entity> entitySlice = this.entitySlices[k];
+ boolean inThis = entitySlice.contains(entity);
+ if (entity.entitySlice != null || inThis) {
+ if (entity.entitySlice == entitySlice || inThis) {
+ LogManager.getLogger().warn(entity + " was already in this chunk section! Report this to https://github.com/PaperMC/Paper/issues/1223");
+ List<Entity> currentSlice = entity.entitySlice;
+ if ((currentSlice != null && currentSlice.contains(entity)) || inThis) {
+ if (currentSlice == entitySlice || inThis) {
+ LogManager.getLogger().warn(entity + " was already in this chunk section! Report this to https://github.com/PaperMC/Paper/issues/1302");
+ new Throwable().printStackTrace();
+ return;
+ } else {
+ LogManager.getLogger().warn(entity + " is still in another ChunkSection! Report this to https://github.com/PaperMC/Paper/issues/1223");
+ LogManager.getLogger().warn(entity + " is still in another ChunkSection! Report this to https://github.com/PaperMC/Paper/issues/1302");
+
+ Chunk chunk = entity.getCurrentChunk();
+ if (chunk != null) {
@ -47,20 +48,23 @@ index 67e2158ca..e510940ab 100644
this.markDirty();
if (entity instanceof EntityItem) {
itemCounts[k]++;
@@ -746,6 +771,12 @@ public class Chunk implements IChunkAccess {
if (!this.entitySlices[i].remove(entity)) {
return;
@@ -743,9 +769,13 @@ public class Chunk implements IChunkAccess {
i = this.entitySlices.length - 1;
}
// Paper start
- if (!this.entitySlices[i].remove(entity)) {
- return;
+ if (entitySlices[i] == entity.entitySlice) {
+ entity.entitySlice = null;
+ } else {
+ LogManager.getLogger().warn(entity + " was removed from a entitySlice we did not expect. Report this to https://github.com/PaperMC/Paper/issues/1223");
+ LogManager.getLogger().warn(entity + " was removed from a entitySlice we did not expect. Report this to https://github.com/PaperMC/Paper/issues/1302");
+ new Throwable().printStackTrace();
+ }
}
+ if (!this.entitySlices[i].remove(entity)) { return; }
this.markDirty();
if (entity instanceof EntityItem) {
itemCounts[i]--;
@@ -979,6 +1010,7 @@ public class Chunk implements IChunkAccess {
@@ -979,6 +1009,7 @@ public class Chunk implements IChunkAccess {
}
// Spigot End
entity.setCurrentChunk(null); // Paper
@ -69,14 +73,14 @@ index 67e2158ca..e510940ab 100644
// Do not pass along players, as doing so can get them stuck outside of time.
// (which for example disables inventory icon updates and prevents block breaking)
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 4315804dd..785c31089 100644
index 4315804ddb..166abea704 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -64,6 +64,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
}
}
};
+ Object entitySlice = null;
+ List<Entity> entitySlice = null;
// Paper end
static boolean isLevelAtLeast(NBTTagCompound tag, int level) {
return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;

View File

@ -1,4 +1,4 @@
From 0f4cf78346f2dc4ea140744c1e6342a38c0f0acf Mon Sep 17 00:00:00 2001
From 82217d58cde2b4773bc1e220125a27af2975eb8b Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 3 Aug 2018 22:47:46 -0400
Subject: [PATCH] Entity add to world fixes
@ -14,10 +14,10 @@ Fix this by differing entity add to world for all entities at the same time
the original entity is dead, overwrite it as the logic does for unloaod queued entities.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index e510940ab..db8fbc006 100644
index 17f19219f2..bb193966b8 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -902,6 +902,7 @@ public class Chunk implements IChunkAccess {
@@ -901,6 +901,7 @@ public class Chunk implements IChunkAccess {
this.world.b(this.tileEntities.values());
List[] aentityslice = this.entitySlices; // Spigot
int i = aentityslice.length;
@ -25,7 +25,7 @@ index e510940ab..db8fbc006 100644
for (int j = 0; j < i; ++j) {
List entityslice = aentityslice[j]; // Spigot
@@ -948,10 +949,12 @@ public class Chunk implements IChunkAccess {
@@ -947,10 +948,12 @@ public class Chunk implements IChunkAccess {
thisChunk.put(entity.uniqueID, entity);
}
}
@ -41,7 +41,7 @@ index e510940ab..db8fbc006 100644
// CraftBukkit start
org.bukkit.Server server = this.world.getServer();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index b0053e5e6..004c3ec47 100644
index b0053e5e63..004c3ec474 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1069,6 +1069,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@ -70,7 +70,7 @@ index b0053e5e6..004c3ec47 100644
}
this.entityList.add(entity);
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 6b5b2c825..f5911fbf0 100644
index 6b5b2c8258..f5911fbf08 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -992,7 +992,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {