Updated Upstream (Bukkit/CraftBukkit) (#6872)

Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
cfd18bd0 SPIGOT-6436: Add Player#stopAllSounds

CraftBukkit Changes:
b58f4299 SPIGOT-6436: Add Player#stopAllSounds
eb191612 SPIGOT-6783: Items do not appear in custom anvil inventories
376edf4f SPIGOT-6779: Fix LivingEntity#attack for Player entities
747a73ec SPIGOT-6772: Use entity mailbox and re-schedule entities if they get unloaded
This commit is contained in:
Nassim Jahnke 2021-11-05 15:08:24 +01:00
parent 130e21da7e
commit f79445fff5
5 changed files with 28 additions and 12 deletions

View file

@ -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

View file

@ -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<Runnable> 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
}

View file

@ -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)

@ -1 +1 @@
Subproject commit 9b45fa2fab08e654962ed0ca5f85f6d22bea40c2
Subproject commit cfd18bd0ac9000319520374d6950d95bf8a218f4

@ -1 +1 @@
Subproject commit cef1fda37b872df7f6c2f401c669a78fd2de5d70
Subproject commit b58f4299c6f1438846f14ba5bb88cda531e33da1