diff --git a/Spigot-Server-Patches/0258-Add-some-Debug-to-Chunk-Entity-slices.patch b/Spigot-Server-Patches/0258-Add-some-Debug-to-Chunk-Entity-slices.patch index 6cb288e44..1e8db78ea 100644 --- a/Spigot-Server-Patches/0258-Add-some-Debug-to-Chunk-Entity-slices.patch +++ b/Spigot-Server-Patches/0258-Add-some-Debug-to-Chunk-Entity-slices.patch @@ -1,4 +1,4 @@ -From 1bf6b4b9f9a3d22b4f53574346c79bbeac1d6e90 Mon Sep 17 00:00:00 2001 +From 65393557682e7ac540e0feee2cae3b5c2bd14e89 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 23 Jul 2018 22:44:23 -0400 Subject: [PATCH] Add some Debug to Chunk Entity slices @@ -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 diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 68cde33565..1d47e47370 100644 +index 68cde33565..3267e87259 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -407,6 +407,25 @@ public class Chunk implements IChunkAccess { @@ -46,12 +46,13 @@ index 68cde33565..1d47e47370 100644 this.markDirty(); // Paper } -@@ -440,6 +460,9 @@ public class Chunk implements IChunkAccess { +@@ -440,6 +460,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/Spigot-Server-Patches/0263-Ignore-Dead-Entities-in-entityList-iteration.patch b/Spigot-Server-Patches/0263-Ignore-Dead-Entities-in-entityList-iteration.patch index f12bfcbcb..18b1c468a 100644 --- a/Spigot-Server-Patches/0263-Ignore-Dead-Entities-in-entityList-iteration.patch +++ b/Spigot-Server-Patches/0263-Ignore-Dead-Entities-in-entityList-iteration.patch @@ -1,4 +1,4 @@ -From e52d0934b4de9b05971b1d0e36731a771eaf9efc Mon Sep 17 00:00:00 2001 +From 43c1459292e3c2c7f57b4c716b84346ea7f4b757 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 28 Jul 2018 12:18:27 -0400 Subject: [PATCH] Ignore Dead Entities in entityList iteration @@ -23,10 +23,10 @@ index b839769cea..5acad8e44f 100644 MutablePair> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap())); ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.getChunkX(), e.getChunkZ()); diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 1d47e47370..c464d69623 100644 +index 3267e87259..a51de83cf5 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -681,6 +681,7 @@ public class Chunk implements IChunkAccess { +@@ -682,6 +682,7 @@ public class Chunk implements IChunkAccess { while (iterator.hasNext()) { Entity entity1 = (Entity) iterator.next(); @@ -34,7 +34,7 @@ index 1d47e47370..c464d69623 100644 if (entity1.getBoundingBox().c(axisalignedbb) && entity1 != entity) { if (predicate == null || predicate.test(entity1)) { -@@ -718,6 +719,7 @@ public class Chunk implements IChunkAccess { +@@ -719,6 +720,7 @@ public class Chunk implements IChunkAccess { while (iterator.hasNext()) { T entity = (T) iterator.next(); // CraftBukkit - decompile error @@ -42,7 +42,7 @@ index 1d47e47370..c464d69623 100644 if ((entitytypes == null || entity.getEntityType() == entitytypes) && entity.getBoundingBox().c(axisalignedbb) && predicate.test(entity)) { list.add(entity); -@@ -739,6 +741,7 @@ public class Chunk implements IChunkAccess { +@@ -740,6 +742,7 @@ public class Chunk implements IChunkAccess { while (iterator.hasNext()) { T t0 = (T) iterator.next(); // CraftBukkit - decompile error diff --git a/Spigot-Server-Patches/0372-Duplicate-UUID-Resolve-Option.patch b/Spigot-Server-Patches/0372-Duplicate-UUID-Resolve-Option.patch index 634b93d14..993b6cf14 100644 --- a/Spigot-Server-Patches/0372-Duplicate-UUID-Resolve-Option.patch +++ b/Spigot-Server-Patches/0372-Duplicate-UUID-Resolve-Option.patch @@ -1,4 +1,4 @@ -From ce13336d3fb72611127734a52c8e8f07e2c9a558 Mon Sep 17 00:00:00 2001 +From 692223e06a0a25f01d8622e42040e981a24c8cfe Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 21 Jul 2018 14:27:34 -0400 Subject: [PATCH] Duplicate UUID Resolve Option @@ -81,7 +81,7 @@ index 4ba72275b9..572679e4d1 100644 + } } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index c464d69623..3882e5b2a6 100644 +index a51de83cf5..c263a8250d 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -396,6 +396,7 @@ public class Chunk implements IChunkAccess { @@ -105,7 +105,7 @@ index 1a20f105b5..d522d7238d 100644 this.uniqueID = uuid; this.am = this.uniqueID.toString(); diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index f640d2ac76..5763538905 100644 +index f640d2ac76..863c47b761 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -1,6 +1,7 @@ @@ -134,8 +134,12 @@ index f640d2ac76..5763538905 100644 import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionException; import java.util.concurrent.Executor; -@@ -641,9 +645,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - entity.die(); +@@ -638,12 +642,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + // CraftBukkit start - these are spawned serialized (DefinedStructure) and we don't call an add event below at the moment due to ordering complexities + boolean needsRemoval = false; + if (chunk.needsDecoration && !this.world.getServer().getServer().getSpawnNPCs() && entity instanceof NPC) { +- entity.die(); ++ entity.dead = true; // Paper needsRemoval = true; } - @@ -166,7 +170,7 @@ index f640d2ac76..5763538905 100644 + && entity.getBukkitEntity().getLocation().distance(other.getBukkitEntity().getLocation()) < world.paperConfig.duplicateUUIDDeleteRange + ) { + if (World.DEBUG_ENTITIES) LOGGER.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + " because it was near the duplicate and likely an actual duplicate. See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); -+ entity.die(); ++ entity.dead = true; + return; + } + if (other != null && !other.dead) { @@ -178,7 +182,7 @@ index f640d2ac76..5763538905 100644 + } + case DELETE: { + if (World.DEBUG_ENTITIES) LOGGER.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); -+ entity.die(); ++ entity.dead = true; + break; + } + default: diff --git a/Spigot-Server-Patches/0391-Avoid-hopper-searches-if-there-are-no-items.patch b/Spigot-Server-Patches/0391-Avoid-hopper-searches-if-there-are-no-items.patch index 7653537f8..c5ba3e0ef 100644 --- a/Spigot-Server-Patches/0391-Avoid-hopper-searches-if-there-are-no-items.patch +++ b/Spigot-Server-Patches/0391-Avoid-hopper-searches-if-there-are-no-items.patch @@ -1,4 +1,4 @@ -From f78f01f3686c8be41b0a1a5dae5f08f269db99c5 Mon Sep 17 00:00:00 2001 +From 881b367b809850a9bb9325fca91e6ccc0184b224 Mon Sep 17 00:00:00 2001 From: CullanP Date: Thu, 3 Mar 2016 02:13:38 -0600 Subject: [PATCH] Avoid hopper searches if there are no items @@ -14,7 +14,7 @@ And since minecart hoppers are used _very_ rarely near we can avoid alot of sear Combined, this adds up a lot. diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 06b4dc6284..fc01aa68eb 100644 +index b6ba0cb79e..38ab4197b2 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -84,6 +84,10 @@ public class Chunk implements IChunkAccess { @@ -42,7 +42,7 @@ index 06b4dc6284..fc01aa68eb 100644 entity.entitySlice = this.entitySlices[k]; // Paper this.markDirty(); // Paper } -@@ -467,6 +478,11 @@ public class Chunk implements IChunkAccess { +@@ -468,6 +479,11 @@ public class Chunk implements IChunkAccess { if (!this.entitySlices[i].remove(entity)) { return; } @@ -54,7 +54,7 @@ index 06b4dc6284..fc01aa68eb 100644 entityCounts.decrement(entity.getMinecraftKeyString()); this.markDirty(); // Paper // Paper end -@@ -737,9 +753,29 @@ public class Chunk implements IChunkAccess { +@@ -738,9 +754,29 @@ public class Chunk implements IChunkAccess { i = MathHelper.clamp(i, 0, this.entitySlices.length - 1); j = MathHelper.clamp(j, 0, this.entitySlices.length - 1); diff --git a/Spigot-Server-Patches/0437-Optimise-random-block-ticking.patch b/Spigot-Server-Patches/0437-Optimise-random-block-ticking.patch index 99911a3ed..5ffda2467 100644 --- a/Spigot-Server-Patches/0437-Optimise-random-block-ticking.patch +++ b/Spigot-Server-Patches/0437-Optimise-random-block-ticking.patch @@ -1,4 +1,4 @@ -From 977c9a022adf2cc2dabc38fd50e46cc859e69412 Mon Sep 17 00:00:00 2001 +From 9b356605eb26690183b2c23e5ac090da4b4bd366 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Mon, 27 Jan 2020 21:28:00 -0800 Subject: [PATCH] Optimise random block ticking @@ -111,7 +111,7 @@ index e76528f199..e650a2e48d 100644 return this.d(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ()); } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index fc01aa68eb..92065fe029 100644 +index 38ab4197b2..971c0315d5 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -52,6 +52,8 @@ public class Chunk implements IChunkAccess { @@ -142,7 +142,7 @@ index fc01aa68eb..92065fe029 100644 System.arraycopy(achunksection, 0, this.sections, 0, this.sections.length); } else { Chunk.LOGGER.warn("Could not set level chunk sections, array length is {} instead of {}", achunksection.length, this.sections.length); -@@ -489,8 +503,8 @@ public class Chunk implements IChunkAccess { +@@ -490,8 +504,8 @@ public class Chunk implements IChunkAccess { this.entities.remove(entity); // Paper }