13
0
geforkt von Mirrors/Paper

Fix false positive on Chunk Entity slice messages #1302

Update links too
Dieser Commit ist enthalten in:
Aikar 2018-08-20 00:54:03 -04:00
Ursprung 4cf5e15b50
Commit 0f2aaa4364
2 geänderte Dateien mit 13 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -9,7 +9,7 @@ This should hopefully avoid duplicate entities ever being created
if the entity was to end up in 2 different chunk slices 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 diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 195cde784b..575ddcb2a0 100644 index 195cde784b..82abe2a914 100644
--- a/src/main/java/net/minecraft/server/Chunk.java --- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -0,0 +0,0 @@ public class Chunk { @@ -0,0 +0,0 @@ public class Chunk {
@ -21,13 +21,14 @@ index 195cde784b..575ddcb2a0 100644
// Paper start // Paper start
+ List<Entity> entitySlice = this.entitySlices[k]; + List<Entity> entitySlice = this.entitySlices[k];
+ boolean inThis = entitySlice.contains(entity); + boolean inThis = entitySlice.contains(entity);
+ if (entity.entitySlice != null || inThis) { + List<Entity> currentSlice = entity.entitySlice;
+ if (entity.entitySlice == entitySlice || inThis) { + if ((currentSlice != null && currentSlice.contains(entity)) || inThis) {
+ LogManager.getLogger().warn(entity + " was already in this chunk section! Report this to https://github.com/PaperMC/Paper/issues/1223"); + 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(); + new Throwable().printStackTrace();
+ return; + return;
+ } else { + } 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(); + Chunk chunk = entity.getCurrentChunk();
+ if (chunk != null) { + if (chunk != null) {
@ -48,18 +49,18 @@ index 195cde784b..575ddcb2a0 100644
entity.setCurrentChunk(this); entity.setCurrentChunk(this);
entityCounts.increment(entity.getMinecraftKeyString()); entityCounts.increment(entity.getMinecraftKeyString());
@@ -0,0 +0,0 @@ public class Chunk { @@ -0,0 +0,0 @@ public class Chunk {
}
// Paper start // Paper start
if (!this.entitySlices[i].remove(entity)) { return; }
+ if (entitySlices[i] == entity.entitySlice) { + if (entitySlices[i] == entity.entitySlice) {
+ entity.entitySlice = null; + entity.entitySlice = null;
+ } else { + } 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(); + new Throwable().printStackTrace();
+ } + }
if (!this.entitySlices[i].remove(entity)) { return; }
this.markDirty(); this.markDirty();
entity.setCurrentChunk(null); entity.setCurrentChunk(null);
entityCounts.decrement(entity.getMinecraftKeyString());
@@ -0,0 +0,0 @@ public class Chunk { @@ -0,0 +0,0 @@ public class Chunk {
} }
// Spigot End // Spigot End
@ -69,14 +70,14 @@ index 195cde784b..575ddcb2a0 100644
// Do not pass along players, as doing so can get them stuck outside of time. // 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) // (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 diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index eb8904a728..1e64d5fcd6 100644 index eb8904a728..86b0b84335 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
} }
} }
}; };
+ Object entitySlice = null; + List<Entity> entitySlice = null;
// Paper end // Paper end
static boolean isLevelAtLeast(NBTTagCompound tag, int level) { static boolean isLevelAtLeast(NBTTagCompound tag, int level) {
return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level; return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;

Datei anzeigen

@ -14,7 +14,7 @@ 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. 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 diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 575ddcb2a0..3d512d7595 100644 index 82abe2a914..f618e8f628 100644
--- a/src/main/java/net/minecraft/server/Chunk.java --- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -0,0 +0,0 @@ public class Chunk { @@ -0,0 +0,0 @@ public class Chunk {
@ -41,7 +41,7 @@ index 575ddcb2a0..3d512d7595 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 2ad7c75d2b..c04a9d5a09 100644 index 4a16f7ac71..04d0fa1df9 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 {