diff --git a/patches/server/Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch b/patches/server/Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch index 86662ed565..3d19ac9839 100644 --- a/patches/server/Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch +++ b/patches/server/Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch @@ -17,8 +17,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import java.util.Collection; +import java.util.List; import java.util.Objects; - import java.util.function.Predicate; - import net.minecraft.core.BlockPos; + import java.util.concurrent.locks.LockSupport; + import java.util.function.BooleanSupplier; @@ -0,0 +0,0 @@ public class CraftChunk implements Chunk { @Override diff --git a/patches/server/Do-not-process-entity-loads-in-CraftChunk-getEntitie.patch b/patches/server/Do-not-process-entity-loads-in-CraftChunk-getEntitie.patch index 329832a9e8..1986d2db7e 100644 --- a/patches/server/Do-not-process-entity-loads-in-CraftChunk-getEntitie.patch +++ b/patches/server/Do-not-process-entity-loads-in-CraftChunk-getEntitie.patch @@ -32,20 +32,36 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - - entityManager.ensureChunkQueuedForLoad(pair); // Start entity loading - -- // now we wait until the entities are loaded, -- // the converting from NBT to entity object is done on the main Thread which is why we wait -- this.getCraftWorld().getHandle().getServer().managedBlock(() -> { -- boolean status = entityManager.areEntitiesLoaded(pair); +- // SPIGOT-6772: Use entity mailbox and re-schedule entities if they get unloaded +- ProcessorMailbox mailbox = ((EntityStorage) entityManager.permanentStorage).entityDeserializerQueue; +- BooleanSupplier supplier = () -> { - // only execute inbox if our entities are not present -- if (status) { +- if (entityManager.areEntitiesLoaded(pair)) { - return true; - } +- +- if (!entityManager.isPending(pair)) { +- // Our entities got unloaded, this should normally not happen. +- entityManager.ensureChunkQueuedForLoad(pair); // Re-start entity loading +- } +- - // tick loading inbox, which loads the created entities to the world - // (if present) - entityManager.tick(); - // check if our entities are loaded - return entityManager.areEntitiesLoaded(pair); -- }); +- }; +- +- // now we wait until the entities are loaded, +- // the converting from NBT to entity object is done on the main Thread which is why we wait +- while (!supplier.getAsBoolean()) { +- if (mailbox.size() != 0) { // PAIL rename size +- mailbox.run(); +- } else { +- Thread.yield(); +- LockSupport.parkNanos("waiting for entity loading", 100000L); +- } +- } - return getCraftWorld().getHandle().getChunkEntities(this.x, this.z); // Paper - optimise this } diff --git a/patches/server/Rewrite-entity-bounding-box-lookup-calls.patch b/patches/server/Rewrite-entity-bounding-box-lookup-calls.patch index 91ca12be97..abb2c6ac1f 100644 --- a/patches/server/Rewrite-entity-bounding-box-lookup-calls.patch +++ b/patches/server/Rewrite-entity-bounding-box-lookup-calls.patch @@ -1273,8 +1273,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 entityManager.ensureChunkQueuedForLoad(pair); // Start entity loading @@ -0,0 +0,0 @@ public class CraftChunk implements Chunk { - return entityManager.areEntitiesLoaded(pair); - }); + } + } - return entityManager.getEntities(new ChunkPos(this.x, this.z)).stream() - .map(net.minecraft.world.entity.Entity::getBukkitEntity) diff --git a/work/Bukkit b/work/Bukkit index 9b45fa2fab..cfd18bd0ac 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit 9b45fa2fab08e654962ed0ca5f85f6d22bea40c2 +Subproject commit cfd18bd0ac9000319520374d6950d95bf8a218f4 diff --git a/work/CraftBukkit b/work/CraftBukkit index cef1fda37b..b58f4299c6 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit cef1fda37b872df7f6c2f401c669a78fd2de5d70 +Subproject commit b58f4299c6f1438846f14ba5bb88cda531e33da1