13
0
geforkt von Mirrors/Paper

Merge branch 'master' into pre/1.13

* master:
  Fix false positive on Chunk Entity slice messages #1302
Dieser Commit ist enthalten in:
Aikar 2018-08-20 00:58:08 -04:00
Commit 2155cb7a61
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 401ADFC9891FAAFE
2 geänderte Dateien mit 25 neuen und 21 gelöschten Zeilen

Datei anzeigen

@ -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> From: Aikar <aikar@aikar.co>
Date: Mon, 23 Jul 2018 22:44:23 -0400 Date: Mon, 23 Jul 2018 22:44:23 -0400
Subject: [PATCH] Add some Debug to Chunk Entity slices 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 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 67e2158ca..e510940ab 100644 index 67e2158ca1..17f19219f2 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
@@ -712,8 +712,33 @@ public class Chunk implements IChunkAccess { @@ -712,8 +712,34 @@ public class Chunk implements IChunkAccess {
entity.ae = this.locX; entity.ae = this.locX;
entity.af = k; entity.af = k;
entity.ag = this.locZ; entity.ag = this.locZ;
@ -21,13 +21,14 @@ index 67e2158ca..e510940ab 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) {
@ -47,20 +48,23 @@ index 67e2158ca..e510940ab 100644
this.markDirty(); this.markDirty();
if (entity instanceof EntityItem) { if (entity instanceof EntityItem) {
itemCounts[k]++; itemCounts[k]++;
@@ -746,6 +771,12 @@ public class Chunk implements IChunkAccess { @@ -743,9 +769,13 @@ public class Chunk implements IChunkAccess {
if (!this.entitySlices[i].remove(entity)) { i = this.entitySlices.length - 1;
return;
} }
// 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();
if (entity instanceof EntityItem) { if (entity instanceof EntityItem) {
itemCounts[i]--; itemCounts[i]--;
@@ -979,6 +1010,7 @@ public class Chunk implements IChunkAccess { @@ -979,6 +1009,7 @@ public class Chunk implements IChunkAccess {
} }
// Spigot End // Spigot End
entity.setCurrentChunk(null); // Paper 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. // 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 4315804dd..785c31089 100644 index 4315804ddb..166abea704 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
@@ -64,6 +64,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -64,6 +64,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
} }
} }
}; };
+ 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

@ -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> From: Aikar <aikar@aikar.co>
Date: Fri, 3 Aug 2018 22:47:46 -0400 Date: Fri, 3 Aug 2018 22:47:46 -0400
Subject: [PATCH] Entity add to world fixes 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. 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 e510940ab..db8fbc006 100644 index 17f19219f2..bb193966b8 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
@@ -902,6 +902,7 @@ public class Chunk implements IChunkAccess { @@ -901,6 +901,7 @@ public class Chunk implements IChunkAccess {
this.world.b(this.tileEntities.values()); this.world.b(this.tileEntities.values());
List[] aentityslice = this.entitySlices; // Spigot List[] aentityslice = this.entitySlices; // Spigot
int i = aentityslice.length; int i = aentityslice.length;
@ -25,7 +25,7 @@ index e510940ab..db8fbc006 100644
for (int j = 0; j < i; ++j) { for (int j = 0; j < i; ++j) {
List entityslice = aentityslice[j]; // Spigot 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); thisChunk.put(entity.uniqueID, entity);
} }
} }
@ -41,7 +41,7 @@ index e510940ab..db8fbc006 100644
// CraftBukkit start // CraftBukkit start
org.bukkit.Server server = this.world.getServer(); 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 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 --- 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
@@ -1069,6 +1069,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose @@ -1069,6 +1069,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@ -70,7 +70,7 @@ index b0053e5e6..004c3ec47 100644
} }
this.entityList.add(entity); this.entityList.add(entity);
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java 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 --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/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 { @@ -992,7 +992,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {