mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-03 13:36:44 +01:00
c97ce029e9
PaperMC believes that 1.16.2 is now ready for general release as we fixed the main issue plagueing the 1.16.x release, the MapLike data conversion issues. Until now, it was not safe for a server to convert a world to 1.16.2 without data conversion issues around villages and potentially other things. If you did, those MapLike errors meant something went wrong. This is now resolved. Big thanks to all those that helped, notably @BillyGalbreath and @Proximyst who did large parts of the update process with me. Please as always, backup your worlds and test before updating to 1.16.2! If you update to 1.16.2, there is no going back to an older build than this. --------------------------------- Co-authored-by: William Blake Galbreath <Blake.Galbreath@GMail.com> Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com> Co-authored-by: krolik-exe <69214078+krolik-exe@users.noreply.github.com> Co-authored-by: BillyGalbreath <BillyGalbreath@users.noreply.github.com> Co-authored-by: stonar96 <minecraft.stonar96@gmail.com> Co-authored-by: Shane Freeder <theboyetronic@gmail.com> Co-authored-by: Jason <jasonpenilla2@me.com> Co-authored-by: kashike <kashike@vq.lc> Co-authored-by: Aurora <21148213+aurorasmiles@users.noreply.github.com> Co-authored-by: KennyTV <kennytv@t-online.de> Co-authored-by: commandblockguy <commandblockguy1@gmail.com> Co-authored-by: DigitalRegent <misterwener@gmail.com> Co-authored-by: ishland <ishlandmc@yeah.net>
71 lines
3.3 KiB
Diff
71 lines
3.3 KiB
Diff
From 0000000000000000000000000000000000000000 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
|
|
|
|
If we detect unexpected state, log and try to recover
|
|
|
|
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 bc249e399befa84cdf07cc58cd0072bb9cb5cced..3b3cae92513a85ba842d403c68f5a1fb8fde785d 100644
|
|
--- a/src/main/java/net/minecraft/server/Chunk.java
|
|
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
|
@@ -510,6 +510,25 @@ public class Chunk implements IChunkAccess {
|
|
if (k >= this.entitySlices.length) {
|
|
k = this.entitySlices.length - 1;
|
|
}
|
|
+ // Paper - remove from any old list if its in one
|
|
+ List<Entity> nextSlice = this.entitySlices[k]; // the next list to be added to
|
|
+ List<Entity> currentSlice = entity.entitySlice;
|
|
+ if (nextSlice == currentSlice) {
|
|
+ if (World.DEBUG_ENTITIES) MinecraftServer.LOGGER.warn("Entity was already in this chunk!" + entity, new Throwable());
|
|
+ return; // ??? silly plugins
|
|
+ }
|
|
+ if (currentSlice != null && currentSlice.contains(entity)) {
|
|
+ // Still in an old chunk...
|
|
+ if (World.DEBUG_ENTITIES) MinecraftServer.LOGGER.warn("Entity is still in another chunk!" + entity, new Throwable());
|
|
+ Chunk chunk = entity.getCurrentChunk();
|
|
+ if (chunk != null) {
|
|
+ chunk.removeEntity(entity);
|
|
+ } else {
|
|
+ removeEntity(entity);
|
|
+ }
|
|
+ currentSlice.remove(entity); // Just incase the above did not remove from the previous slice
|
|
+ }
|
|
+ // Paper end
|
|
|
|
if (!entity.inChunk || entity.getCurrentChunk() != this) entityCounts.increment(entity.getMinecraftKeyString()); // Paper
|
|
entity.inChunk = true;
|
|
@@ -519,6 +538,7 @@ public class Chunk implements IChunkAccess {
|
|
entity.chunkZ = this.loc.z;
|
|
this.entities.add(entity); // Paper - per chunk entity list
|
|
this.entitySlices[k].add(entity);
|
|
+ entity.entitySlice = this.entitySlices[k]; // Paper
|
|
this.markDirty(); // Paper
|
|
}
|
|
|
|
@@ -543,6 +563,10 @@ public class Chunk implements IChunkAccess {
|
|
|
|
// Paper start
|
|
if (entity.currentChunk != null && entity.currentChunk.get() == this) entity.setCurrentChunk(null);
|
|
+ if (entitySlices[i] == entity.entitySlice) {
|
|
+ entity.entitySlice = null;
|
|
+ entity.inChunk = false;
|
|
+ }
|
|
if (!this.entitySlices[i].remove(entity)) {
|
|
return;
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
|
index 90f5d8c9d04463d65bf8ab936b07d829b2b9f55d..5e96d7a8adc043ff7e1451d4ecdacb2cfc9d08c6 100644
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
@@ -73,6 +73,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
}
|
|
}
|
|
};
|
|
+ List<Entity> entitySlice = null;
|
|
// Paper end
|
|
|
|
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
|