From 21faf8227b57528cfa0825bb67b7e9674761c527 Mon Sep 17 00:00:00 2001 From: Omer Uddin Date: Wed, 21 Aug 2019 06:02:51 +0500 Subject: [PATCH] Implement optional per player mobspawning (#2171) --- ...tually-Limit-Natural-Spawns-To-Limit.patch | 97 --- ...0390-Implement-CraftBlockSoundGroup.patch} | 12 +- ...d.patch => 0391-Chunk-debug-command.patch} | 16 +- ...ch => 0392-incremental-chunk-saving.patch} | 16 +- ...ptions-from-dispenser-entity-spawns.patch} | 6 +- ...94-Fix-World-isChunkGenerated-calls.patch} | 20 +- ...te-location-if-we-failed-to-read-it.patch} | 6 +- ...ad-in-DataPaletteBlock-lock-failure.patch} | 8 +- ...tatus-cache-when-saving-protochunks.patch} | 6 +- ...9-Anti-Xray.patch => 0398-Anti-Xray.patch} | 46 +- ...l-Spawned-mobs-towards-natural-spaw.patch} | 8 +- ...tChunkIfLoadedImmediately-in-places.patch} | 12 +- ...urable-projectile-relative-velocity.patch} | 10 +- ...being-ticked-when-notifying-navigat.patch} | 6 +- ...h => 0403-offset-item-frame-ticking.patch} | 6 +- ...h-on-save-flag-for-reliable-regionf.patch} | 6 +- ...pper-searches-if-there-are-no-items.patch} | 8 +- ...56852.patch => 0406-Fixed-MC-156852.patch} | 6 +- ...ement-alternative-item-despawn-rate.patch} | 8 +- ...f-we-have-a-custom-Bukkit-generator.patch} | 6 +- ...-158900.patch => 0409-Fix-MC-158900.patch} | 6 +- ...0-Asynchronous-chunk-IO-and-loading.patch} | 64 +- ...ads.patch => 0411-Reduce-sync-loads.patch} | 12 +- ...ement-optional-per-player-mob-spawns.patch | 806 ++++++++++++++++++ 24 files changed, 953 insertions(+), 244 deletions(-) delete mode 100644 Spigot-Server-Patches/0390-Actually-Limit-Natural-Spawns-To-Limit.patch rename Spigot-Server-Patches/{0391-Implement-CraftBlockSoundGroup.patch => 0390-Implement-CraftBlockSoundGroup.patch} (95%) rename Spigot-Server-Patches/{0392-Chunk-debug-command.patch => 0391-Chunk-debug-command.patch} (98%) rename Spigot-Server-Patches/{0393-incremental-chunk-saving.patch => 0392-incremental-chunk-saving.patch} (96%) rename Spigot-Server-Patches/{0394-Catch-exceptions-from-dispenser-entity-spawns.patch => 0393-Catch-exceptions-from-dispenser-entity-spawns.patch} (91%) rename Spigot-Server-Patches/{0395-Fix-World-isChunkGenerated-calls.patch => 0394-Fix-World-isChunkGenerated-calls.patch} (97%) rename Spigot-Server-Patches/{0396-Show-blockstate-location-if-we-failed-to-read-it.patch => 0395-Show-blockstate-location-if-we-failed-to-read-it.patch} (93%) rename Spigot-Server-Patches/{0397-Log-other-thread-in-DataPaletteBlock-lock-failure.patch => 0396-Log-other-thread-in-DataPaletteBlock-lock-failure.patch} (95%) rename Spigot-Server-Patches/{0398-Use-ChunkStatus-cache-when-saving-protochunks.patch => 0397-Use-ChunkStatus-cache-when-saving-protochunks.patch} (92%) rename Spigot-Server-Patches/{0399-Anti-Xray.patch => 0398-Anti-Xray.patch} (99%) rename Spigot-Server-Patches/{0400-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch => 0399-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch} (94%) rename Spigot-Server-Patches/{0401-Use-getChunkIfLoadedImmediately-in-places.patch => 0400-Use-getChunkIfLoadedImmediately-in-places.patch} (95%) rename Spigot-Server-Patches/{0402-Configurable-projectile-relative-velocity.patch => 0401-Configurable-projectile-relative-velocity.patch} (95%) rename Spigot-Server-Patches/{0403-Mark-entities-as-being-ticked-when-notifying-navigat.patch => 0402-Mark-entities-as-being-ticked-when-notifying-navigat.patch} (90%) rename Spigot-Server-Patches/{0404-offset-item-frame-ticking.patch => 0403-offset-item-frame-ticking.patch} (87%) rename Spigot-Server-Patches/{0405-Preserve-old-flush-on-save-flag-for-reliable-regionf.patch => 0404-Preserve-old-flush-on-save-flag-for-reliable-regionf.patch} (89%) rename Spigot-Server-Patches/{0406-Avoid-hopper-searches-if-there-are-no-items.patch => 0405-Avoid-hopper-searches-if-there-are-no-items.patch} (97%) rename Spigot-Server-Patches/{0407-Fixed-MC-156852.patch => 0406-Fixed-MC-156852.patch} (92%) rename Spigot-Server-Patches/{0408-Implement-alternative-item-despawn-rate.patch => 0407-Implement-alternative-item-despawn-rate.patch} (97%) rename Spigot-Server-Patches/{0409-Do-less-work-if-we-have-a-custom-Bukkit-generator.patch => 0408-Do-less-work-if-we-have-a-custom-Bukkit-generator.patch} (95%) rename Spigot-Server-Patches/{0410-Fix-MC-158900.patch => 0409-Fix-MC-158900.patch} (93%) rename Spigot-Server-Patches/{0411-Asynchronous-chunk-IO-and-loading.patch => 0410-Asynchronous-chunk-IO-and-loading.patch} (99%) rename Spigot-Server-Patches/{0412-Reduce-sync-loads.patch => 0411-Reduce-sync-loads.patch} (98%) create mode 100644 Spigot-Server-Patches/0412-implement-optional-per-player-mob-spawns.patch diff --git a/Spigot-Server-Patches/0390-Actually-Limit-Natural-Spawns-To-Limit.patch b/Spigot-Server-Patches/0390-Actually-Limit-Natural-Spawns-To-Limit.patch deleted file mode 100644 index d87fbb2f96..0000000000 --- a/Spigot-Server-Patches/0390-Actually-Limit-Natural-Spawns-To-Limit.patch +++ /dev/null @@ -1,97 +0,0 @@ -From 23bfd69104bd51618d157c4cd09ba03441efddcf Mon Sep 17 00:00:00 2001 -From: kickash32 -Date: Sun, 2 Jun 2019 01:22:02 -0400 -Subject: [PATCH] Actually-Limit-Natural-Spawns-To-Limit - - -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 0ce2d6d0fb..d30da20435 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -452,8 +452,12 @@ public class ChunkProviderServer extends IChunkProvider { - if (enumcreaturetype != EnumCreatureType.MISC && (!enumcreaturetype.c() || this.allowAnimals) && (enumcreaturetype.c() || this.allowMonsters) && (!enumcreaturetype.d() || flag2)) { - int k1 = limit * l / ChunkProviderServer.b; // CraftBukkit - use per-world limits - -- if (object2intmap.getInt(enumcreaturetype) <= k1) { -- SpawnerCreature.a(enumcreaturetype, (World) this.world, chunk, blockposition); -+ // Paper start - only allow spawns upto the limit per chunk and update count afterwards -+ int currEntityCount = object2intmap.getInt(enumcreaturetype); -+ int difference = k1 - currEntityCount; -+ if (difference > 0) { -+ object2intmap.put(enumcreaturetype, currEntityCount + SpawnerCreature.spawnMobs(enumcreaturetype, world, chunk, blockposition, difference)); -+ // Paper end - } - } - } -diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index c6ea37ffbd..5e6559df0b 100644 ---- a/src/main/java/net/minecraft/server/SpawnerCreature.java -+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java -@@ -16,13 +16,20 @@ public final class SpawnerCreature { - - private static final Logger LOGGER = LogManager.getLogger(); - -+ // Paper start - add maxSpawns parameter and update counts - public static void a(EnumCreatureType enumcreaturetype, World world, Chunk chunk, BlockPosition blockposition) { -+ spawnMobs(enumcreaturetype, world, chunk, blockposition, Integer.MAX_VALUE); -+ } -+ -+ public static int spawnMobs(EnumCreatureType enumcreaturetype, World world, Chunk chunk, BlockPosition blockposition, int maxSpawns) { -+ // Paper end - ChunkGenerator chunkgenerator = world.getChunkProvider().getChunkGenerator(); - int i = 0; - BlockPosition blockposition1 = getRandomPosition(world, chunk); - int j = blockposition1.getX(); - int k = blockposition1.getY(); - int l = blockposition1.getZ(); -+ int amountSpawned = 0; // Paper - keep track of mobs spawned - - if (k >= 1) { - IBlockData iblockdata = world.getTypeIfLoadedAndInBounds(blockposition1); // Paper - don't load chunks for mob spawn -@@ -88,7 +95,7 @@ public final class SpawnerCreature { - ); - if (!event.callEvent()) { - if (event.shouldAbortSpawn()) { -- return; -+ return amountSpawned; // Paper - } - ++i2; - continue; -@@ -107,7 +114,7 @@ public final class SpawnerCreature { - } catch (Exception exception) { - SpawnerCreature.LOGGER.warn("Failed to create mob", exception); - ServerInternalException.reportInternalException(exception); // Paper -- return; -+ return amountSpawned; // Paper - } - - entityinsentient.setPositionRotation((double) f, (double) k, (double) f1, world.random.nextFloat() * 360.0F, 0.0F); -@@ -117,10 +124,16 @@ public final class SpawnerCreature { - if (world.addEntity(entityinsentient, SpawnReason.NATURAL)) { - ++i; - ++i2; -+ // Paper start - stop when limit is reached -+ ++amountSpawned; -+ } -+ if (amountSpawned >= maxSpawns) { -+ return amountSpawned; - } -+ // Paper end - // CraftBukkit end - if (i >= entityinsentient.dC()) { -- return; -+ return amountSpawned; // Paper - } - - if (entityinsentient.c(i2)) { -@@ -146,6 +159,7 @@ public final class SpawnerCreature { - - } - } -+ return amountSpawned; // Paper - } - - @Nullable --- -2.22.1 - diff --git a/Spigot-Server-Patches/0391-Implement-CraftBlockSoundGroup.patch b/Spigot-Server-Patches/0390-Implement-CraftBlockSoundGroup.patch similarity index 95% rename from Spigot-Server-Patches/0391-Implement-CraftBlockSoundGroup.patch rename to Spigot-Server-Patches/0390-Implement-CraftBlockSoundGroup.patch index 6005834d09..1603e452df 100644 --- a/Spigot-Server-Patches/0391-Implement-CraftBlockSoundGroup.patch +++ b/Spigot-Server-Patches/0390-Implement-CraftBlockSoundGroup.patch @@ -1,4 +1,4 @@ -From b85ae6b421d6b419d24f90744fbf0285dae533cd Mon Sep 17 00:00:00 2001 +From 3d6591b285cbe5e769d02e69c51098ccdd2318bf Mon Sep 17 00:00:00 2001 From: simpleauthority Date: Tue, 28 May 2019 03:48:51 -0700 Subject: [PATCH] Implement CraftBlockSoundGroup @@ -6,7 +6,7 @@ Subject: [PATCH] Implement CraftBlockSoundGroup diff --git a/src/main/java/com/destroystokyo/paper/block/CraftBlockSoundGroup.java b/src/main/java/com/destroystokyo/paper/block/CraftBlockSoundGroup.java new file mode 100644 -index 0000000000..99f99330d0 +index 000000000..99f99330d --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/block/CraftBlockSoundGroup.java @@ -0,0 +1,38 @@ @@ -49,7 +49,7 @@ index 0000000000..99f99330d0 + } +} diff --git a/src/main/java/net/minecraft/server/IBlockData.java b/src/main/java/net/minecraft/server/IBlockData.java -index 9fd1b4915f..21f734a73c 100644 +index 9fd1b4915..21f734a73 100644 --- a/src/main/java/net/minecraft/server/IBlockData.java +++ b/src/main/java/net/minecraft/server/IBlockData.java @@ -271,6 +271,7 @@ public class IBlockData extends BlockDataAbstract implements @@ -61,7 +61,7 @@ index 9fd1b4915f..21f734a73c 100644 return this.getBlock().getStepSound(this); } diff --git a/src/main/java/net/minecraft/server/SoundEffectType.java b/src/main/java/net/minecraft/server/SoundEffectType.java -index 5460d409b7..ccd5b0529a 100644 +index 5460d409b..ccd5b0529 100644 --- a/src/main/java/net/minecraft/server/SoundEffectType.java +++ b/src/main/java/net/minecraft/server/SoundEffectType.java @@ -26,10 +26,10 @@ public class SoundEffectType { @@ -96,7 +96,7 @@ index 5460d409b7..ccd5b0529a 100644 return this.C; } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 166c918d73..5296c6d9bf 100644 +index 166c918d7..5296c6d9b 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -689,4 +689,11 @@ public class CraftBlock implements Block { @@ -112,5 +112,5 @@ index 166c918d73..5296c6d9bf 100644 + // Paper end } -- -2.22.1 +2.23.0 diff --git a/Spigot-Server-Patches/0392-Chunk-debug-command.patch b/Spigot-Server-Patches/0391-Chunk-debug-command.patch similarity index 98% rename from Spigot-Server-Patches/0392-Chunk-debug-command.patch rename to Spigot-Server-Patches/0391-Chunk-debug-command.patch index ae0d66c795..e75ec876e8 100644 --- a/Spigot-Server-Patches/0392-Chunk-debug-command.patch +++ b/Spigot-Server-Patches/0391-Chunk-debug-command.patch @@ -1,4 +1,4 @@ -From 379ac9e206a7ea7e19c06067df3a8310b0969818 Mon Sep 17 00:00:00 2001 +From 307b9c67d6789626657f0f2c126955fa43d9a9ae Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Sat, 1 Jun 2019 13:00:55 -0700 Subject: [PATCH] Chunk debug command @@ -32,7 +32,7 @@ https://bugs.mojang.com/browse/MC-141484?focusedCommentId=528273&page=com.atlass https://bugs.mojang.com/browse/MC-141484?focusedCommentId=528577&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-528577 diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index d704fc79c0..09efbf7250 100644 +index d704fc79c..09efbf725 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -28,14 +28,14 @@ public class PaperCommand extends Command { @@ -185,7 +185,7 @@ index d704fc79c0..09efbf7250 100644 * Ported from MinecraftForge - author: LexManos - License: LGPLv2.1 */ diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index d30da20435..cb78e14a05 100644 +index 0ce2d6d0f..162700313 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -22,7 +22,7 @@ import org.apache.logging.log4j.Logger; @@ -198,7 +198,7 @@ index d30da20435..cb78e14a05 100644 public final ChunkGenerator chunkGenerator; private final WorldServer world; diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index ec3732193f..23d1935dd5 100644 +index ec3732193..23d1935dd 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java @@ -4,7 +4,13 @@ import com.destroystokyo.paper.block.TargetBlockInfo; @@ -399,7 +399,7 @@ index ec3732193f..23d1935dd5 100644 + } } diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 7407c1a564..14a176d61d 100644 +index 7407c1a56..14a176d61 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java @@ -26,7 +26,7 @@ public class PlayerChunk { @@ -412,7 +412,7 @@ index 7407c1a564..14a176d61d 100644 private int dirtyCount; private int r; diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 67d011745f..493770bf68 100644 +index 67d011745..493770bf6 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -57,7 +57,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -434,7 +434,7 @@ index 67d011745f..493770bf68 100644 private final DefinedStructureManager definedStructureManager; private final File x; diff --git a/src/main/java/net/minecraft/server/Ticket.java b/src/main/java/net/minecraft/server/Ticket.java -index 0430ca5353..badbe6c19d 100644 +index 0430ca535..badbe6c19 100644 --- a/src/main/java/net/minecraft/server/Ticket.java +++ b/src/main/java/net/minecraft/server/Ticket.java @@ -6,8 +6,8 @@ public final class Ticket implements Comparable> { @@ -457,5 +457,5 @@ index 0430ca5353..badbe6c19d 100644 return this.b; } -- -2.22.1 +2.23.0 diff --git a/Spigot-Server-Patches/0393-incremental-chunk-saving.patch b/Spigot-Server-Patches/0392-incremental-chunk-saving.patch similarity index 96% rename from Spigot-Server-Patches/0393-incremental-chunk-saving.patch rename to Spigot-Server-Patches/0392-incremental-chunk-saving.patch index 665864863c..7e39aa93fe 100644 --- a/Spigot-Server-Patches/0393-incremental-chunk-saving.patch +++ b/Spigot-Server-Patches/0392-incremental-chunk-saving.patch @@ -1,11 +1,11 @@ -From 2e3ff1fe99c5b8551dd4f9da59b0fc482f301d48 Mon Sep 17 00:00:00 2001 +From 26ce15746427d11172e35f35ec78b26c4af5b153 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Sun, 9 Jun 2019 03:53:22 +0100 Subject: [PATCH] incremental chunk saving diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index de11a91af6..4d3c6c6b47 100644 +index de11a91af..4d3c6c6b4 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -489,4 +489,19 @@ public class PaperWorldConfig { @@ -29,7 +29,7 @@ index de11a91af6..4d3c6c6b47 100644 + } } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index ee8f801745..2003522d96 100644 +index ee8f80174..2003522d9 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -42,7 +42,7 @@ public class Chunk implements IChunkAccess { @@ -42,7 +42,7 @@ index ee8f801745..2003522d96 100644 private long t; @Nullable diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index cb78e14a05..ca5963b11a 100644 +index 162700313..535c2258b 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -335,6 +335,15 @@ public class ChunkProviderServer extends IChunkProvider { @@ -62,7 +62,7 @@ index cb78e14a05..ca5963b11a 100644 public void close() throws IOException { // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c58f6f50d3..2293360407 100644 +index c58f6f50d..229336040 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -165,6 +165,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 100) { // Spigot diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 493770bf68..2be6fa0f07 100644 +index 493770bf6..2be6fa0f0 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -297,6 +297,36 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -147,7 +147,7 @@ index 493770bf68..2be6fa0f07 100644 if (flag) { List list = (List) this.visibleChunks.values().stream().filter(PlayerChunk::hasBeenLoaded).peek(PlayerChunk::m).collect(Collectors.toList()); diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 8ac49d8b91..9fd14b573e 100644 +index 8ac49d8b9..9fd14b573 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -756,11 +756,44 @@ public class WorldServer extends World { @@ -197,5 +197,5 @@ index 8ac49d8b91..9fd14b573e 100644 if (iprogressupdate != null) { iprogressupdate.a(new ChatMessage("menu.savingLevel", new Object[0])); -- -2.22.1 +2.23.0 diff --git a/Spigot-Server-Patches/0394-Catch-exceptions-from-dispenser-entity-spawns.patch b/Spigot-Server-Patches/0393-Catch-exceptions-from-dispenser-entity-spawns.patch similarity index 91% rename from Spigot-Server-Patches/0394-Catch-exceptions-from-dispenser-entity-spawns.patch rename to Spigot-Server-Patches/0393-Catch-exceptions-from-dispenser-entity-spawns.patch index 89f8bf5923..d62d0077b7 100644 --- a/Spigot-Server-Patches/0394-Catch-exceptions-from-dispenser-entity-spawns.patch +++ b/Spigot-Server-Patches/0393-Catch-exceptions-from-dispenser-entity-spawns.patch @@ -1,11 +1,11 @@ -From 2ed06dd3efd74e5b1062640643ebca2956e731eb Mon Sep 17 00:00:00 2001 +From 9b6be5334841e6f0c2214dcf8476765148c8ac2f Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Mon, 10 Jun 2019 09:36:40 +0100 Subject: [PATCH] Catch exceptions from dispenser entity spawns diff --git a/src/main/java/net/minecraft/server/IDispenseBehavior.java b/src/main/java/net/minecraft/server/IDispenseBehavior.java -index 976c72208f..fe3d9d5fa3 100644 +index 976c72208..fe3d9d5fa 100644 --- a/src/main/java/net/minecraft/server/IDispenseBehavior.java +++ b/src/main/java/net/minecraft/server/IDispenseBehavior.java @@ -163,7 +163,14 @@ public interface IDispenseBehavior { @@ -24,5 +24,5 @@ index 976c72208f..fe3d9d5fa3 100644 // CraftBukkit end return itemstack; -- -2.22.1 +2.23.0 diff --git a/Spigot-Server-Patches/0395-Fix-World-isChunkGenerated-calls.patch b/Spigot-Server-Patches/0394-Fix-World-isChunkGenerated-calls.patch similarity index 97% rename from Spigot-Server-Patches/0395-Fix-World-isChunkGenerated-calls.patch rename to Spigot-Server-Patches/0394-Fix-World-isChunkGenerated-calls.patch index 35cbc38961..aa779b9239 100644 --- a/Spigot-Server-Patches/0395-Fix-World-isChunkGenerated-calls.patch +++ b/Spigot-Server-Patches/0394-Fix-World-isChunkGenerated-calls.patch @@ -1,4 +1,4 @@ -From a35d57100af34be228d70a78e783305a54566e66 Mon Sep 17 00:00:00 2001 +From 512506f02da806b43410269c54caa4164b192188 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Sat, 15 Jun 2019 08:54:33 -0700 Subject: [PATCH] Fix World#isChunkGenerated calls @@ -8,7 +8,7 @@ This patch also adds a chunk status cache on region files (note that its only purpose is to cache the status on DISK) diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index ca5963b11a..3894b04342 100644 +index 535c2258b..e0bd03b3b 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -28,7 +28,7 @@ public class ChunkProviderServer extends IChunkProvider { @@ -43,7 +43,7 @@ index ca5963b11a..3894b04342 100644 @Nullable diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index e778c2e857..73f93e4948 100644 +index e778c2e85..73f93e494 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -410,6 +410,17 @@ public class ChunkRegionLoader { @@ -65,7 +65,7 @@ index e778c2e857..73f93e4948 100644 if (nbttagcompound != null) { ChunkStatus chunkstatus = ChunkStatus.a(nbttagcompound.getCompound("Level").getString("Status")); diff --git a/src/main/java/net/minecraft/server/ChunkStatus.java b/src/main/java/net/minecraft/server/ChunkStatus.java -index dd1822d6ff..e324989b46 100644 +index dd1822d6f..e324989b4 100644 --- a/src/main/java/net/minecraft/server/ChunkStatus.java +++ b/src/main/java/net/minecraft/server/ChunkStatus.java @@ -176,6 +176,7 @@ public class ChunkStatus { @@ -95,7 +95,7 @@ index dd1822d6ff..e324989b46 100644 return (ChunkStatus) IRegistry.CHUNK_STATUS.get(MinecraftKey.a(s)); } diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 14a176d61d..98590e233a 100644 +index 14a176d61..98590e233 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java @@ -70,6 +70,19 @@ public class PlayerChunk { @@ -119,7 +119,7 @@ index 14a176d61d..98590e233a 100644 public CompletableFuture> getStatusFutureUnchecked(ChunkStatus chunkstatus) { diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 2be6fa0f07..bdadbd436e 100644 +index 2be6fa0f0..bdadbd436 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -891,11 +891,61 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -187,7 +187,7 @@ index 2be6fa0f07..bdadbd436e 100644 boolean isOutsideOfRange(ChunkCoordIntPair chunkcoordintpair) { // Spigot start diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index ccc3d6c7ad..b487e80602 100644 +index ccc3d6c7a..b487e8060 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java @@ -31,6 +31,30 @@ public class RegionFile implements AutoCloseable { @@ -246,7 +246,7 @@ index ccc3d6c7ad..b487e80602 100644 } diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java -index 6f34d8aea0..d2b3289450 100644 +index 6f34d8aea..d2b328945 100644 --- a/src/main/java/net/minecraft/server/RegionFileCache.java +++ b/src/main/java/net/minecraft/server/RegionFileCache.java @@ -47,6 +47,12 @@ public abstract class RegionFileCache implements AutoCloseable { @@ -279,7 +279,7 @@ index 6f34d8aea0..d2b3289450 100644 printOversizedLog("ChunkTooLarge even after reduction. Trying in overzealous mode.", regionfile.file, chunkX, chunkZ); // Eek, major fail. We have retry logic, so reduce threshholds and fall back diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 3948de4674..20e9fd8a79 100644 +index 3948de467..20e9fd8a7 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -18,6 +18,7 @@ import java.util.Objects; @@ -375,5 +375,5 @@ index 3948de4674..20e9fd8a79 100644 @Override -- -2.22.1 +2.23.0 diff --git a/Spigot-Server-Patches/0396-Show-blockstate-location-if-we-failed-to-read-it.patch b/Spigot-Server-Patches/0395-Show-blockstate-location-if-we-failed-to-read-it.patch similarity index 93% rename from Spigot-Server-Patches/0396-Show-blockstate-location-if-we-failed-to-read-it.patch rename to Spigot-Server-Patches/0395-Show-blockstate-location-if-we-failed-to-read-it.patch index 60804ef28d..bfcdaecf37 100644 --- a/Spigot-Server-Patches/0396-Show-blockstate-location-if-we-failed-to-read-it.patch +++ b/Spigot-Server-Patches/0395-Show-blockstate-location-if-we-failed-to-read-it.patch @@ -1,11 +1,11 @@ -From cdadcf34bc202a34c0cde735f535a486f785a773 Mon Sep 17 00:00:00 2001 +From 7ebd3f6dcc789d74cf8ed5aa770c2d0bc60eac64 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Sat, 15 Jun 2019 10:28:25 -0700 Subject: [PATCH] Show blockstate location if we failed to read it diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java -index f6401e2cde..3e22d558ea 100644 +index f6401e2cd..3e22d558e 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java @@ -19,6 +19,8 @@ public class CraftBlockEntityState extends CraftBlockState @@ -33,5 +33,5 @@ index f6401e2cde..3e22d558ea 100644 public final boolean snapshotDisabled; // Paper -- -2.22.1 +2.23.0 diff --git a/Spigot-Server-Patches/0397-Log-other-thread-in-DataPaletteBlock-lock-failure.patch b/Spigot-Server-Patches/0396-Log-other-thread-in-DataPaletteBlock-lock-failure.patch similarity index 95% rename from Spigot-Server-Patches/0397-Log-other-thread-in-DataPaletteBlock-lock-failure.patch rename to Spigot-Server-Patches/0396-Log-other-thread-in-DataPaletteBlock-lock-failure.patch index 0f6290f159..9f55f2c9c6 100644 --- a/Spigot-Server-Patches/0397-Log-other-thread-in-DataPaletteBlock-lock-failure.patch +++ b/Spigot-Server-Patches/0396-Log-other-thread-in-DataPaletteBlock-lock-failure.patch @@ -1,4 +1,4 @@ -From 0d67dccc3a8bf7bea2d579455ac07251f03f2472 Mon Sep 17 00:00:00 2001 +From ce1df3bf2a50b3f194aa24860fcb3a1f5c41d52d Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Fri, 21 Jun 2019 14:42:48 -0700 Subject: [PATCH] Log other thread in DataPaletteBlock lock failure @@ -6,7 +6,7 @@ Subject: [PATCH] Log other thread in DataPaletteBlock lock failure diff --git a/src/main/java/com/destroystokyo/paper/util/ReentrantLockWithGetOwner.java b/src/main/java/com/destroystokyo/paper/util/ReentrantLockWithGetOwner.java new file mode 100644 -index 0000000000..a3b174618d +index 000000000..a3b174618 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/ReentrantLockWithGetOwner.java @@ -0,0 +1,11 @@ @@ -22,7 +22,7 @@ index 0000000000..a3b174618d + } +} diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java -index a3bb2e8779..1e2bca1e04 100644 +index a3bb2e877..1e2bca1e0 100644 --- a/src/main/java/net/minecraft/server/DataPaletteBlock.java +++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java @@ -22,14 +22,17 @@ public class DataPaletteBlock implements DataPaletteExpandable { @@ -47,5 +47,5 @@ index a3bb2e8779..1e2bca1e04 100644 crashreportsystemdetails.a("Thread dumps", (Object) s); -- -2.22.1 +2.23.0 diff --git a/Spigot-Server-Patches/0398-Use-ChunkStatus-cache-when-saving-protochunks.patch b/Spigot-Server-Patches/0397-Use-ChunkStatus-cache-when-saving-protochunks.patch similarity index 92% rename from Spigot-Server-Patches/0398-Use-ChunkStatus-cache-when-saving-protochunks.patch rename to Spigot-Server-Patches/0397-Use-ChunkStatus-cache-when-saving-protochunks.patch index 8918312b93..337dc59abf 100644 --- a/Spigot-Server-Patches/0398-Use-ChunkStatus-cache-when-saving-protochunks.patch +++ b/Spigot-Server-Patches/0397-Use-ChunkStatus-cache-when-saving-protochunks.patch @@ -1,4 +1,4 @@ -From cbcd19008d052efff2a8e4f04de3e0f16c92a455 Mon Sep 17 00:00:00 2001 +From 7e3412b5e8d6b3c6bad18965ec3b4f9159e70433 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Sat, 22 Jun 2019 04:20:47 -0700 Subject: [PATCH] Use ChunkStatus cache when saving protochunks @@ -7,7 +7,7 @@ The cache should contain the chunk status when saving. If not it will load it. diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index bdadbd436e..fbbd4d5dd0 100644 +index bdadbd436..fbbd4d5dd 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -768,8 +768,10 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -24,5 +24,5 @@ index bdadbd436e..fbbd4d5dd0 100644 } -- -2.22.1 +2.23.0 diff --git a/Spigot-Server-Patches/0399-Anti-Xray.patch b/Spigot-Server-Patches/0398-Anti-Xray.patch similarity index 99% rename from Spigot-Server-Patches/0399-Anti-Xray.patch rename to Spigot-Server-Patches/0398-Anti-Xray.patch index 9d3a9e7177..a515271651 100644 --- a/Spigot-Server-Patches/0399-Anti-Xray.patch +++ b/Spigot-Server-Patches/0398-Anti-Xray.patch @@ -1,11 +1,11 @@ -From cb6f6fe1c447df7fd2155cced33591e2dd410ae9 Mon Sep 17 00:00:00 2001 +From 6013f2d16d7d537fa82ae5fc0895933683a8f56a Mon Sep 17 00:00:00 2001 From: stonar96 Date: Mon, 20 Aug 2018 03:03:58 +0200 Subject: [PATCH] Anti-Xray diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 81987e4ad9..5942c3438e 100644 +index 81987e4ad..5942c3438 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -71,8 +71,8 @@ public class PaperConfig { @@ -20,7 +20,7 @@ index 81987e4ad9..5942c3438e 100644 } diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 4d3c6c6b47..929f5c3031 100644 +index 4d3c6c6b4..929f5c303 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -1,7 +1,11 @@ @@ -81,7 +81,7 @@ index 4d3c6c6b47..929f5c3031 100644 } diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java new file mode 100644 -index 0000000000..f7e376ce6a +index 000000000..f7e376ce6 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java @@ -0,0 +1,46 @@ @@ -133,7 +133,7 @@ index 0000000000..f7e376ce6a +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java new file mode 100644 -index 0000000000..23626bef3a +index 000000000..23626bef3 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java @@ -0,0 +1,782 @@ @@ -921,7 +921,7 @@ index 0000000000..23626bef3a +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfo.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfo.java new file mode 100644 -index 0000000000..a68bace353 +index 000000000..a68bace35 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfo.java @@ -0,0 +1,81 @@ @@ -1008,7 +1008,7 @@ index 0000000000..a68bace353 +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfoAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfoAntiXray.java new file mode 100644 -index 0000000000..067dfb2f14 +index 000000000..067dfb2f1 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfoAntiXray.java @@ -0,0 +1,31 @@ @@ -1045,7 +1045,7 @@ index 0000000000..067dfb2f14 +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java b/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java new file mode 100644 -index 0000000000..cc586827aa +index 000000000..cc586827a --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java @@ -0,0 +1,56 @@ @@ -1107,7 +1107,7 @@ index 0000000000..cc586827aa +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java b/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java new file mode 100644 -index 0000000000..37093419cf +index 000000000..37093419c --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java @@ -0,0 +1,84 @@ @@ -1196,7 +1196,7 @@ index 0000000000..37093419cf + } +} diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 2003522d96..d604f96c16 100644 +index 2003522d9..d604f96c1 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -315,7 +315,7 @@ public class Chunk implements IChunkAccess { @@ -1209,7 +1209,7 @@ index 2003522d96..d604f96c16 100644 } diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 73f93e4948..a028074112 100644 +index 73f93e494..a02807411 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -74,7 +74,7 @@ public class ChunkRegionLoader { @@ -1231,7 +1231,7 @@ index 73f93e4948..a028074112 100644 object = protochunk; protochunk.a(abiomebase); diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index ca2bf8b770..584b3e6393 100644 +index ca2bf8b77..584b3e639 100644 --- a/src/main/java/net/minecraft/server/ChunkSection.java +++ b/src/main/java/net/minecraft/server/ChunkSection.java @@ -6,21 +6,31 @@ public class ChunkSection { @@ -1270,7 +1270,7 @@ index ca2bf8b770..584b3e6393 100644 public IBlockData getType(int i, int j, int k) { diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java -index 1e2bca1e04..8fba1e2f3d 100644 +index 1e2bca1e0..8fba1e2f3 100644 --- a/src/main/java/net/minecraft/server/DataPaletteBlock.java +++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java @@ -3,6 +3,7 @@ package net.minecraft.server; @@ -1392,7 +1392,7 @@ index 1e2bca1e04..8fba1e2f3d 100644 if (this.h == this.b) { diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index e156804f7a..96a785af27 100644 +index e156804f7..96a785af2 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -42,7 +42,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { @@ -1455,7 +1455,7 @@ index e156804f7a..96a785af27 100644 public void a() { this.o(); diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -index ef71a1feb3..483317608c 100644 +index ef71a1feb..483317608 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java @@ -1,5 +1,6 @@ @@ -1548,7 +1548,7 @@ index ef71a1feb3..483317608c 100644 } diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 98590e233a..af934ef8bc 100644 +index 98590e233..af934ef8b 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java @@ -176,6 +176,11 @@ public class PlayerChunk { @@ -1573,7 +1573,7 @@ index 98590e233a..af934ef8bc 100644 this.a(new PacketPlayOutMultiBlockChange(this.dirtyCount, this.dirtyBlocks, chunk), false); diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index fbbd4d5dd0..fd0d2b6e67 100644 +index fbbd4d5dd..fd0d2b6e6 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -539,7 +539,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -1595,7 +1595,7 @@ index fbbd4d5dd0..fd0d2b6e67 100644 } diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index 1c79890e3f..e5e9de542b 100644 +index 1c79890e3..e5e9de542 100644 --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java +++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java @@ -253,6 +253,8 @@ public class PlayerInteractManager { @@ -1608,7 +1608,7 @@ index 1c79890e3f..e5e9de542b 100644 public void a(BlockPosition blockposition, PacketPlayInBlockDig.EnumPlayerDigType packetplayinblockdig_enumplayerdigtype) { diff --git a/src/main/java/net/minecraft/server/ProtoChunk.java b/src/main/java/net/minecraft/server/ProtoChunk.java -index 6bdd7dda04..7bad12eb00 100644 +index 6bdd7dda0..7bad12eb0 100644 --- a/src/main/java/net/minecraft/server/ProtoChunk.java +++ b/src/main/java/net/minecraft/server/ProtoChunk.java @@ -44,16 +44,28 @@ public class ProtoChunk implements IChunkAccess { @@ -1651,7 +1651,7 @@ index 6bdd7dda04..7bad12eb00 100644 return this.j[i]; diff --git a/src/main/java/net/minecraft/server/TicketType.java b/src/main/java/net/minecraft/server/TicketType.java -index 157ca6a7e6..9c114d2d37 100644 +index 157ca6a7e..9c114d2d3 100644 --- a/src/main/java/net/minecraft/server/TicketType.java +++ b/src/main/java/net/minecraft/server/TicketType.java @@ -21,6 +21,7 @@ public class TicketType { @@ -1663,7 +1663,7 @@ index 157ca6a7e6..9c114d2d37 100644 public static TicketType a(String s, Comparator comparator) { return new TicketType<>(s, comparator, 0L); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 10c149faec..ab98c7b796 100644 +index 10c149fae..ab98c7b79 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -2,6 +2,8 @@ package net.minecraft.server; @@ -1700,7 +1700,7 @@ index 10c149faec..ab98c7b796 100644 if (iblockdata1 == null) { // CraftBukkit start - remove blockstate if failed diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java -index 7772d59005..4570ed9991 100644 +index 7772d5900..4570ed999 100644 --- a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java +++ b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java @@ -21,9 +21,11 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData { @@ -1725,5 +1725,5 @@ index 7772d59005..4570ed9991 100644 return section; } -- -2.22.1 +2.23.0 diff --git a/Spigot-Server-Patches/0400-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch b/Spigot-Server-Patches/0399-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch similarity index 94% rename from Spigot-Server-Patches/0400-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch rename to Spigot-Server-Patches/0399-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch index 0ec731d77b..7aea1d71c8 100644 --- a/Spigot-Server-Patches/0400-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch +++ b/Spigot-Server-Patches/0399-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch @@ -1,4 +1,4 @@ -From fb5b05d9cbdd15c42b12c81e7444a6794728ac33 Mon Sep 17 00:00:00 2001 +From d3a78fe7d2131aef6839200e27885e872b431700 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 24 Mar 2019 01:01:32 -0400 Subject: [PATCH] Only count Natural Spawned mobs towards natural spawn mob @@ -17,7 +17,7 @@ This should fully solve all of the issues around it so that only natural influences natural spawns. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 929f5c3031..ff520d9e86 100644 +index 929f5c303..ff520d9e8 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -509,6 +509,16 @@ public class PaperWorldConfig { @@ -38,7 +38,7 @@ index 929f5c3031..ff520d9e86 100644 public boolean asynchronous; public EngineMode engineMode; diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 9fd14b573e..1e5b15c2e2 100644 +index 9fd14b573..1e5b15c2e 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -899,6 +899,13 @@ public class WorldServer extends World { @@ -56,5 +56,5 @@ index 9fd14b573e..1e5b15c2e2 100644 } } -- -2.22.1 +2.23.0 diff --git a/Spigot-Server-Patches/0401-Use-getChunkIfLoadedImmediately-in-places.patch b/Spigot-Server-Patches/0400-Use-getChunkIfLoadedImmediately-in-places.patch similarity index 95% rename from Spigot-Server-Patches/0401-Use-getChunkIfLoadedImmediately-in-places.patch rename to Spigot-Server-Patches/0400-Use-getChunkIfLoadedImmediately-in-places.patch index 1284677e4e..99b85c42ed 100644 --- a/Spigot-Server-Patches/0401-Use-getChunkIfLoadedImmediately-in-places.patch +++ b/Spigot-Server-Patches/0400-Use-getChunkIfLoadedImmediately-in-places.patch @@ -1,4 +1,4 @@ -From 3c29bd01d31049fe243a948921c2c00a1dbeb13d Mon Sep 17 00:00:00 2001 +From b903049b2197ac40a6bbe48c05f90ff3739eb832 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Mon, 8 Jul 2019 00:13:36 -0700 Subject: [PATCH] Use getChunkIfLoadedImmediately in places @@ -8,7 +8,7 @@ ticket level 33 (yes getChunkIfLoaded will actually perform a chunk load in that case). diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 55c73ffcaa..e8def7f812 100644 +index 55c73ffca..e8def7f81 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -199,7 +199,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -21,7 +21,7 @@ index 55c73ffcaa..e8def7f812 100644 // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 4187ba05bd..e7b8b2e992 100644 +index 4187ba05b..e7b8b2e99 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -981,7 +981,7 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -34,7 +34,7 @@ index 4187ba05bd..e7b8b2e992 100644 return; } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index ab98c7b796..b81b37445c 100644 +index ab98c7b79..b81b37445 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -131,7 +131,7 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose @@ -62,7 +62,7 @@ index ab98c7b796..b81b37445c 100644 public Chunk getChunkIfLoaded(BlockPosition blockposition) { return getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4); diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index f86404f83a..92601c581c 100644 +index f86404f83..92601c581 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java @@ -143,9 +143,10 @@ public class ActivationRange @@ -79,5 +79,5 @@ index f86404f83a..92601c581c 100644 } } -- -2.22.1 +2.23.0 diff --git a/Spigot-Server-Patches/0402-Configurable-projectile-relative-velocity.patch b/Spigot-Server-Patches/0401-Configurable-projectile-relative-velocity.patch similarity index 95% rename from Spigot-Server-Patches/0402-Configurable-projectile-relative-velocity.patch rename to Spigot-Server-Patches/0401-Configurable-projectile-relative-velocity.patch index c71ae1e91c..da84f8a1fc 100644 --- a/Spigot-Server-Patches/0402-Configurable-projectile-relative-velocity.patch +++ b/Spigot-Server-Patches/0401-Configurable-projectile-relative-velocity.patch @@ -1,4 +1,4 @@ -From d8a7240ae87dc130e4e1db3cf1e65e79d9da2a88 Mon Sep 17 00:00:00 2001 +From 8c98d71b84d9ff04539641bda4802054c11a7246 Mon Sep 17 00:00:00 2001 From: Lucavon Date: Tue, 23 Jul 2019 20:29:20 -0500 Subject: [PATCH] Configurable projectile relative velocity @@ -25,7 +25,7 @@ P3) Solutions for 1) and especially 2) might not be future-proof, while this server-internal fix makes this change future-proof. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index ff520d9e86..318a470eea 100644 +index ff520d9e8..318a470ee 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -557,4 +557,9 @@ public class PaperWorldConfig { @@ -39,7 +39,7 @@ index ff520d9e86..318a470eea 100644 + } } diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java -index a9575d310b..5f3e1ccb4e 100644 +index a9575d310..5f3e1ccb4 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java @@ -85,7 +85,7 @@ public abstract class EntityArrow extends Entity implements IProjectile { @@ -52,7 +52,7 @@ index a9575d310b..5f3e1ccb4e 100644 @Override diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java -index 18d28a151a..bd4ca73f6d 100644 +index 18d28a151..bd4ca73f6 100644 --- a/src/main/java/net/minecraft/server/EntityProjectile.java +++ b/src/main/java/net/minecraft/server/EntityProjectile.java @@ -43,7 +43,7 @@ public abstract class EntityProjectile extends Entity implements IProjectile { @@ -65,5 +65,5 @@ index 18d28a151a..bd4ca73f6d 100644 @Override -- -2.22.1 +2.23.0 diff --git a/Spigot-Server-Patches/0403-Mark-entities-as-being-ticked-when-notifying-navigat.patch b/Spigot-Server-Patches/0402-Mark-entities-as-being-ticked-when-notifying-navigat.patch similarity index 90% rename from Spigot-Server-Patches/0403-Mark-entities-as-being-ticked-when-notifying-navigat.patch rename to Spigot-Server-Patches/0402-Mark-entities-as-being-ticked-when-notifying-navigat.patch index 65a2a96a84..cec1953ff2 100644 --- a/Spigot-Server-Patches/0403-Mark-entities-as-being-ticked-when-notifying-navigat.patch +++ b/Spigot-Server-Patches/0402-Mark-entities-as-being-ticked-when-notifying-navigat.patch @@ -1,11 +1,11 @@ -From 4ed947b04eb34215ca7c2f22bd492213348a01fd Mon Sep 17 00:00:00 2001 +From c3d5aff66879249ce33e2fad1f04e9aaa7217093 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Sun, 28 Jul 2019 00:51:11 +0100 Subject: [PATCH] Mark entities as being ticked when notifying navigation diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 1e5b15c2e2..84c16e2750 100644 +index 1e5b15c2e..84c16e275 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -1325,6 +1325,7 @@ public class WorldServer extends World { @@ -25,5 +25,5 @@ index 1e5b15c2e2..84c16e2750 100644 } -- -2.22.1 +2.23.0 diff --git a/Spigot-Server-Patches/0404-offset-item-frame-ticking.patch b/Spigot-Server-Patches/0403-offset-item-frame-ticking.patch similarity index 87% rename from Spigot-Server-Patches/0404-offset-item-frame-ticking.patch rename to Spigot-Server-Patches/0403-offset-item-frame-ticking.patch index 18206c2ee1..985c38b342 100644 --- a/Spigot-Server-Patches/0404-offset-item-frame-ticking.patch +++ b/Spigot-Server-Patches/0403-offset-item-frame-ticking.patch @@ -1,11 +1,11 @@ -From e7e0f94ce68757ad43c38a7f262757b0d885ad0c Mon Sep 17 00:00:00 2001 +From 5b964c886c2783dd44c93297d132792d17091650 Mon Sep 17 00:00:00 2001 From: kickash32 Date: Tue, 30 Jul 2019 03:17:16 +0500 Subject: [PATCH] offset item frame ticking diff --git a/src/main/java/net/minecraft/server/EntityHanging.java b/src/main/java/net/minecraft/server/EntityHanging.java -index 3b282a18a2..2b4a849f48 100644 +index 3b282a18a..2b4a849f4 100644 --- a/src/main/java/net/minecraft/server/EntityHanging.java +++ b/src/main/java/net/minecraft/server/EntityHanging.java @@ -15,7 +15,7 @@ public abstract class EntityHanging extends Entity { @@ -18,5 +18,5 @@ index 3b282a18a2..2b4a849f48 100644 protected EnumDirection direction; -- -2.22.1 +2.23.0 diff --git a/Spigot-Server-Patches/0405-Preserve-old-flush-on-save-flag-for-reliable-regionf.patch b/Spigot-Server-Patches/0404-Preserve-old-flush-on-save-flag-for-reliable-regionf.patch similarity index 89% rename from Spigot-Server-Patches/0405-Preserve-old-flush-on-save-flag-for-reliable-regionf.patch rename to Spigot-Server-Patches/0404-Preserve-old-flush-on-save-flag-for-reliable-regionf.patch index e406d54da2..bfd8810b76 100644 --- a/Spigot-Server-Patches/0405-Preserve-old-flush-on-save-flag-for-reliable-regionf.patch +++ b/Spigot-Server-Patches/0404-Preserve-old-flush-on-save-flag-for-reliable-regionf.patch @@ -1,4 +1,4 @@ -From 4e9e8fcb96e24d84f1ea01726960e000e0747fda Mon Sep 17 00:00:00 2001 +From 4c3bca65e308b39ad3f4df22bff48c0d3538b8de Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Mon, 5 Aug 2019 08:24:01 -0700 Subject: [PATCH] Preserve old flush on save flag for reliable regionfiles @@ -6,7 +6,7 @@ Subject: [PATCH] Preserve old flush on save flag for reliable regionfiles Originally this patch was in paper diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index b487e80602..a8c8ace46c 100644 +index b487e8060..a8c8ace46 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java @@ -349,7 +349,7 @@ public class RegionFile implements AutoCloseable { @@ -19,5 +19,5 @@ index b487e80602..a8c8ace46c 100644 if (!FLUSH_ON_SAVE) { return; -- -2.22.1 +2.23.0 diff --git a/Spigot-Server-Patches/0406-Avoid-hopper-searches-if-there-are-no-items.patch b/Spigot-Server-Patches/0405-Avoid-hopper-searches-if-there-are-no-items.patch similarity index 97% rename from Spigot-Server-Patches/0406-Avoid-hopper-searches-if-there-are-no-items.patch rename to Spigot-Server-Patches/0405-Avoid-hopper-searches-if-there-are-no-items.patch index 6eb12c1559..064a89861c 100644 --- a/Spigot-Server-Patches/0406-Avoid-hopper-searches-if-there-are-no-items.patch +++ b/Spigot-Server-Patches/0405-Avoid-hopper-searches-if-there-are-no-items.patch @@ -1,4 +1,4 @@ -From 930f77a8a2f97b5969f057112520bf94df821400 Mon Sep 17 00:00:00 2001 +From 2e3adab90109275dfaa287129668bc5ef2e8a121 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 d604f96c16..67dc837f43 100644 +index d604f96c1..67dc837f4 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 { @@ -90,7 +90,7 @@ index d604f96c16..67dc837f43 100644 while (iterator.hasNext()) { diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java -index 56488b78dd..56739e6ed5 100644 +index 56488b78d..56739e6ed 100644 --- a/src/main/java/net/minecraft/server/IEntitySelector.java +++ b/src/main/java/net/minecraft/server/IEntitySelector.java @@ -11,6 +11,7 @@ public final class IEntitySelector { @@ -102,5 +102,5 @@ index 56488b78dd..56739e6ed5 100644 return entity instanceof IInventory && entity.isAlive(); }; -- -2.22.1 +2.23.0 diff --git a/Spigot-Server-Patches/0407-Fixed-MC-156852.patch b/Spigot-Server-Patches/0406-Fixed-MC-156852.patch similarity index 92% rename from Spigot-Server-Patches/0407-Fixed-MC-156852.patch rename to Spigot-Server-Patches/0406-Fixed-MC-156852.patch index 27e60ae4db..14999d5e2e 100644 --- a/Spigot-Server-Patches/0407-Fixed-MC-156852.patch +++ b/Spigot-Server-Patches/0406-Fixed-MC-156852.patch @@ -1,4 +1,4 @@ -From a3e706da03ede31d3d5f297acb569baad24a7803 Mon Sep 17 00:00:00 2001 +From 7cb4669fb5d991d54e6bfe922fa2e679e47af0d6 Mon Sep 17 00:00:00 2001 From: TheGreatKetchup Date: Thu, 1 Aug 2019 21:24:30 -0400 Subject: [PATCH] Fixed MC-156852 @@ -12,7 +12,7 @@ issue in 1.8-1.12. Originally solved by Gnembon on MC-5694 at bugs.mojang.com diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index e5e9de542b..c96564a59b 100644 +index e5e9de542..c96564a59 100644 --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java +++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java @@ -218,6 +218,7 @@ public class PlayerInteractManager { @@ -24,5 +24,5 @@ index e5e9de542b..c96564a59b 100644 this.l = j; } -- -2.22.1 +2.23.0 diff --git a/Spigot-Server-Patches/0408-Implement-alternative-item-despawn-rate.patch b/Spigot-Server-Patches/0407-Implement-alternative-item-despawn-rate.patch similarity index 97% rename from Spigot-Server-Patches/0408-Implement-alternative-item-despawn-rate.patch rename to Spigot-Server-Patches/0407-Implement-alternative-item-despawn-rate.patch index d3dc7c5cb4..4ca77c53fa 100644 --- a/Spigot-Server-Patches/0408-Implement-alternative-item-despawn-rate.patch +++ b/Spigot-Server-Patches/0407-Implement-alternative-item-despawn-rate.patch @@ -1,11 +1,11 @@ -From 62f3bf54c31e04625bbf93b067e1f542f3c6f6e4 Mon Sep 17 00:00:00 2001 +From 047831d4933a3a4c074bca80512ebd023526c742 Mon Sep 17 00:00:00 2001 From: kickash32 Date: Mon, 3 Jun 2019 02:02:39 -0400 Subject: [PATCH] Implement alternative item-despawn-rate diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 318a470eea..e7bbeef74d 100644 +index 318a470ee..e7bbeef74 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -1,12 +1,17 @@ @@ -80,7 +80,7 @@ index 318a470eea..e7bbeef74d 100644 + } } diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index 2091698953..97e3790908 100644 +index 209169895..97e379090 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java @@ -5,6 +5,7 @@ import java.util.List; @@ -128,5 +128,5 @@ index 2091698953..97e3790908 100644 public Packet N() { return new PacketPlayOutSpawnEntity(this); -- -2.22.1 +2.23.0 diff --git a/Spigot-Server-Patches/0409-Do-less-work-if-we-have-a-custom-Bukkit-generator.patch b/Spigot-Server-Patches/0408-Do-less-work-if-we-have-a-custom-Bukkit-generator.patch similarity index 95% rename from Spigot-Server-Patches/0409-Do-less-work-if-we-have-a-custom-Bukkit-generator.patch rename to Spigot-Server-Patches/0408-Do-less-work-if-we-have-a-custom-Bukkit-generator.patch index c605a6b1a9..fde749b669 100644 --- a/Spigot-Server-Patches/0409-Do-less-work-if-we-have-a-custom-Bukkit-generator.patch +++ b/Spigot-Server-Patches/0408-Do-less-work-if-we-have-a-custom-Bukkit-generator.patch @@ -1,4 +1,4 @@ -From d97061fb09c251d90f2388a3ad3ef3975b063dd8 Mon Sep 17 00:00:00 2001 +From ab8fa425b78ec7d2d9ddf7fe697015e1e5ab82ac Mon Sep 17 00:00:00 2001 From: Paul Sauve Date: Sun, 14 Jul 2019 21:05:03 -0500 Subject: [PATCH] Do less work if we have a custom Bukkit generator @@ -7,7 +7,7 @@ If the Bukkit generator already has a spawn, use it immediately instead of spending time generating one that we won't use diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 84c16e2750..4497f6a601 100644 +index 84c16e275..4497f6a60 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -663,12 +663,6 @@ public class WorldServer extends World { @@ -39,5 +39,5 @@ index 84c16e2750..4497f6a601 100644 WorldServer.LOGGER.warn("Unable to find spawn biome"); } -- -2.22.1 +2.23.0 diff --git a/Spigot-Server-Patches/0410-Fix-MC-158900.patch b/Spigot-Server-Patches/0409-Fix-MC-158900.patch similarity index 93% rename from Spigot-Server-Patches/0410-Fix-MC-158900.patch rename to Spigot-Server-Patches/0409-Fix-MC-158900.patch index 7df8d78873..8f38bd12ac 100644 --- a/Spigot-Server-Patches/0410-Fix-MC-158900.patch +++ b/Spigot-Server-Patches/0409-Fix-MC-158900.patch @@ -1,4 +1,4 @@ -From 3925d94376e662aa8711754eb27b22df40a42c0a Mon Sep 17 00:00:00 2001 +From 2f7aaa74e3eadc5cbb5e0e11789fd82308f363b3 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Tue, 13 Aug 2019 06:35:17 -0700 Subject: [PATCH] Fix MC-158900 @@ -7,7 +7,7 @@ The problem was we were checking isExpired() on the entry, but if it was expired at that point, then it would be null. diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index a183bb450d..3cb443c4ff 100644 +index a183bb450..3cb443c4f 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -512,8 +512,10 @@ public abstract class PlayerList { @@ -24,5 +24,5 @@ index a183bb450d..3cb443c4ff 100644 chatmessage = new ChatMessage("multiplayer.disconnect.banned.reason", new Object[]{gameprofilebanentry.getReason()}); if (gameprofilebanentry.getExpires() != null) { -- -2.22.1 +2.23.0 diff --git a/Spigot-Server-Patches/0411-Asynchronous-chunk-IO-and-loading.patch b/Spigot-Server-Patches/0410-Asynchronous-chunk-IO-and-loading.patch similarity index 99% rename from Spigot-Server-Patches/0411-Asynchronous-chunk-IO-and-loading.patch rename to Spigot-Server-Patches/0410-Asynchronous-chunk-IO-and-loading.patch index 5130727e64..a7e95ee6ec 100644 --- a/Spigot-Server-Patches/0411-Asynchronous-chunk-IO-and-loading.patch +++ b/Spigot-Server-Patches/0410-Asynchronous-chunk-IO-and-loading.patch @@ -1,4 +1,4 @@ -From 3e8fc610d83ee7f81bb9107356df8b1d6c15bda4 Mon Sep 17 00:00:00 2001 +From 5f7499a5fbc7f2e64fae45fa52bf74839749267a Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Sat, 13 Jul 2019 09:23:10 -0700 Subject: [PATCH] Asynchronous chunk IO and loading @@ -121,7 +121,7 @@ tasks required to be executed by the chunk load task (i.e lighting and some poi tasks). diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java -index 92c32c48d2..f4d5db02f7 100644 +index 92c32c48d..f4d5db02f 100644 --- a/src/main/java/co/aikar/timings/WorldTimingsHandler.java +++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java @@ -58,6 +58,17 @@ public class WorldTimingsHandler { @@ -161,7 +161,7 @@ index 92c32c48d2..f4d5db02f7 100644 public static Timing getTickList(WorldServer worldserver, String timingsType) { diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 5942c3438e..61eeb6747a 100644 +index 5942c3438..61eeb6747 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -1,5 +1,6 @@ @@ -237,7 +237,7 @@ index 5942c3438e..61eeb6747a 100644 + } } diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java -index 23626bef3a..1edcecd2ee 100644 +index 23626bef3..1edcecd2e 100644 --- a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java @@ -9,6 +9,7 @@ import java.util.concurrent.Executors; @@ -318,7 +318,7 @@ index 23626bef3a..1edcecd2ee 100644 diff --git a/src/main/java/com/destroystokyo/paper/io/IOUtil.java b/src/main/java/com/destroystokyo/paper/io/IOUtil.java new file mode 100644 -index 0000000000..5af0ac3d9e +index 000000000..5af0ac3d9 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/io/IOUtil.java @@ -0,0 +1,62 @@ @@ -386,7 +386,7 @@ index 0000000000..5af0ac3d9e +} diff --git a/src/main/java/com/destroystokyo/paper/io/PaperFileIOThread.java b/src/main/java/com/destroystokyo/paper/io/PaperFileIOThread.java new file mode 100644 -index 0000000000..4f10a8311e +index 000000000..4f10a8311 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/io/PaperFileIOThread.java @@ -0,0 +1,661 @@ @@ -1053,7 +1053,7 @@ index 0000000000..4f10a8311e +} diff --git a/src/main/java/com/destroystokyo/paper/io/PrioritizedTaskQueue.java b/src/main/java/com/destroystokyo/paper/io/PrioritizedTaskQueue.java new file mode 100644 -index 0000000000..c3ca3c4a1c +index 000000000..c3ca3c4a1 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/io/PrioritizedTaskQueue.java @@ -0,0 +1,258 @@ @@ -1317,7 +1317,7 @@ index 0000000000..c3ca3c4a1c +} diff --git a/src/main/java/com/destroystokyo/paper/io/QueueExecutorThread.java b/src/main/java/com/destroystokyo/paper/io/QueueExecutorThread.java new file mode 100644 -index 0000000000..f127ef236e +index 000000000..f127ef236 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/io/QueueExecutorThread.java @@ -0,0 +1,244 @@ @@ -1567,7 +1567,7 @@ index 0000000000..f127ef236e +} diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkLoadTask.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkLoadTask.java new file mode 100644 -index 0000000000..305da47868 +index 000000000..305da4786 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkLoadTask.java @@ -0,0 +1,149 @@ @@ -1722,7 +1722,7 @@ index 0000000000..305da47868 +} diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkSaveTask.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkSaveTask.java new file mode 100644 -index 0000000000..60312b85f9 +index 000000000..60312b85f --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkSaveTask.java @@ -0,0 +1,112 @@ @@ -1840,7 +1840,7 @@ index 0000000000..60312b85f9 +} diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTask.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTask.java new file mode 100644 -index 0000000000..1dfa8abfd8 +index 000000000..1dfa8abfd --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTask.java @@ -0,0 +1,40 @@ @@ -1886,7 +1886,7 @@ index 0000000000..1dfa8abfd8 +} diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java new file mode 100644 -index 0000000000..98a9744a0e +index 000000000..98a9744a0 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java @@ -0,0 +1,429 @@ @@ -2320,7 +2320,7 @@ index 0000000000..98a9744a0e + +} diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 3894b04342..9138a256bd 100644 +index e0bd03b3b..69f3159ce 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -124,11 +124,137 @@ public class ChunkProviderServer extends IChunkProvider { @@ -2475,7 +2475,7 @@ index 3894b04342..9138a256bd 100644 this.world.timings.chunkAwait.stopTiming(); // Paper } // Paper ichunkaccess = (IChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { -@@ -631,11 +762,12 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -627,11 +758,12 @@ public class ChunkProviderServer extends IChunkProvider { protected boolean executeNext() { // CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task try { @@ -2490,7 +2490,7 @@ index 3894b04342..9138a256bd 100644 } finally { playerChunkMap.callbackExecutor.run(); diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index a028074112..98cc4efcf5 100644 +index a02807411..98cc4efcf 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -6,6 +6,7 @@ import it.unimi.dsi.fastutil.longs.LongOpenHashSet; @@ -2759,7 +2759,7 @@ index a028074112..98cc4efcf5 100644 nbttagcompound1.set("PostProcessing", a(ichunkaccess.l())); diff --git a/src/main/java/net/minecraft/server/ChunkStatus.java b/src/main/java/net/minecraft/server/ChunkStatus.java -index e324989b46..abb0d69d2f 100644 +index e324989b4..abb0d69d2 100644 --- a/src/main/java/net/minecraft/server/ChunkStatus.java +++ b/src/main/java/net/minecraft/server/ChunkStatus.java @@ -153,6 +153,7 @@ public class ChunkStatus { @@ -2771,7 +2771,7 @@ index e324989b46..abb0d69d2f 100644 return ChunkStatus.r.getInt(chunkstatus.c()); } diff --git a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -index d521d25cf5..84024e6ba4 100644 +index d521d25cf..84024e6ba 100644 --- a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java +++ b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java @@ -91,7 +91,7 @@ public abstract class IAsyncTaskHandler implements Mailbox extends RegionFi @@ -3537,7 +3537,7 @@ index 4b3e0c0f01..04b7dab646 100644 + // Paper end } diff --git a/src/main/java/net/minecraft/server/TicketType.java b/src/main/java/net/minecraft/server/TicketType.java -index 9c114d2d37..e3150f85a5 100644 +index 9c114d2d3..e3150f85a 100644 --- a/src/main/java/net/minecraft/server/TicketType.java +++ b/src/main/java/net/minecraft/server/TicketType.java @@ -22,6 +22,7 @@ public class TicketType { @@ -3549,7 +3549,7 @@ index 9c114d2d37..e3150f85a5 100644 public static TicketType a(String s, Comparator comparator) { return new TicketType<>(s, comparator, 0L); diff --git a/src/main/java/net/minecraft/server/VillagePlace.java b/src/main/java/net/minecraft/server/VillagePlace.java -index 3169590641..0e98b7803b 100644 +index 316959064..0e98b7803 100644 --- a/src/main/java/net/minecraft/server/VillagePlace.java +++ b/src/main/java/net/minecraft/server/VillagePlace.java @@ -20,8 +20,16 @@ public class VillagePlace extends RegionFileSection { @@ -3638,7 +3638,7 @@ index 3169590641..0e98b7803b 100644 HAS_SPACE(VillagePlaceRecord::d), IS_OCCUPIED(VillagePlaceRecord::e), ANY((villageplacerecord) -> { diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 4497f6a601..cf981632c7 100644 +index 4497f6a60..cf981632c 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -78,6 +78,79 @@ public class WorldServer extends World { @@ -3731,7 +3731,7 @@ index 4497f6a601..cf981632c7 100644 public void doTick(BooleanSupplier booleansupplier) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 20e9fd8a79..0e98f00225 100644 +index 20e9fd8a7..0e98f0022 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -551,22 +551,23 @@ public class CraftWorld implements World { @@ -3793,7 +3793,7 @@ index 20e9fd8a79..0e98f00225 100644 @Override public int getViewDistance() { diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java -index a1d93200e6..6ca0ebfdee 100644 +index a1d93200e..6ca0ebfde 100644 --- a/src/main/java/org/spigotmc/WatchdogThread.java +++ b/src/main/java/org/spigotmc/WatchdogThread.java @@ -6,6 +6,7 @@ import java.lang.management.ThreadInfo; @@ -3821,5 +3821,5 @@ index a1d93200e6..6ca0ebfdee 100644 log.log( Level.SEVERE, "------------------------------" ); // -- -2.22.1 +2.23.0 diff --git a/Spigot-Server-Patches/0412-Reduce-sync-loads.patch b/Spigot-Server-Patches/0411-Reduce-sync-loads.patch similarity index 98% rename from Spigot-Server-Patches/0412-Reduce-sync-loads.patch rename to Spigot-Server-Patches/0411-Reduce-sync-loads.patch index b34422f004..ac1bf6d7de 100644 --- a/Spigot-Server-Patches/0412-Reduce-sync-loads.patch +++ b/Spigot-Server-Patches/0411-Reduce-sync-loads.patch @@ -1,4 +1,4 @@ -From 2567891663da05271689ca3b429a3a678ceff42e Mon Sep 17 00:00:00 2001 +From 3526d3feddbcac38820cbafe5036fb52a46c236a Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Fri, 19 Jul 2019 03:29:14 -0700 Subject: [PATCH] Reduce sync loads @@ -11,7 +11,7 @@ it must be enabled by setting the startup flag -Dpaper.debug-sync-loads=true To get a debug log for sync loads, the command is /paper syncloadinfo diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index 09efbf7250..132397b3f3 100644 +index 09efbf725..132397b3f 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -1,9 +1,13 @@ @@ -91,7 +91,7 @@ index 09efbf7250..132397b3f3 100644 if (args.length < 2 || args[1].equals("*")) { diff --git a/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java b/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java new file mode 100644 -index 0000000000..59aec10329 +index 000000000..59aec1032 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java @@ -0,0 +1,172 @@ @@ -268,7 +268,7 @@ index 0000000000..59aec10329 + } +} diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 9138a256bd..9f9bebdb22 100644 +index 69f3159ce..17f04fb81 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -280,6 +280,7 @@ public class ChunkProviderServer extends IChunkProvider { @@ -280,7 +280,7 @@ index 9138a256bd..9f9bebdb22 100644 this.serverThreadQueue.awaitTasks(completablefuture::isDone); com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index b81b37445c..d3a0ed52bc 100644 +index b81b37445..d3a0ed52b 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -1249,7 +1249,7 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose @@ -311,5 +311,5 @@ index b81b37445c..d3a0ed52bc 100644 if (chunk != null) { chunk.a(oclass, axisalignedbb, list, predicate); -- -2.22.1 +2.23.0 diff --git a/Spigot-Server-Patches/0412-implement-optional-per-player-mob-spawns.patch b/Spigot-Server-Patches/0412-implement-optional-per-player-mob-spawns.patch new file mode 100644 index 0000000000..8c1c03c7c7 --- /dev/null +++ b/Spigot-Server-Patches/0412-implement-optional-per-player-mob-spawns.patch @@ -0,0 +1,806 @@ +From 7feffe7b8be9bb6667f6bb02078642d2b8b6aee1 Mon Sep 17 00:00:00 2001 +From: kickash32 +Date: Mon, 19 Aug 2019 01:27:58 +0500 +Subject: [PATCH] implement optional per player mob spawns + + +diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java +index f4d5db02f..24b4c6e6a 100644 +--- a/src/main/java/co/aikar/timings/WorldTimingsHandler.java ++++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java +@@ -69,6 +69,8 @@ public class WorldTimingsHandler { + public final Timing chunkUnloadPOISerialization; + public final Timing chunkUnloadDataSave; + ++ public final Timing playerMobDistanceMapUpdate; ++ + public WorldTimingsHandler(World server) { + String name = server.worldData.getName() +" - "; + +@@ -134,6 +136,8 @@ public class WorldTimingsHandler { + chunkUnloadPrepareSave = Timings.ofSafe(name + "Chunk unload - Async Save Prepare"); + chunkUnloadPOISerialization = Timings.ofSafe(name + "Chunk unload - POI Data Serialization"); + chunkUnloadDataSave = Timings.ofSafe(name + "Chunk unload - Data Serialization"); ++ ++ playerMobDistanceMapUpdate = Timings.ofSafe(name + "Per Player Mob Spawning - Distance Map Update"); + } + + public static Timing getTickList(WorldServer worldserver, String timingsType) { +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index e7bbeef74..246bb4b01 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -615,4 +615,9 @@ public class PaperWorldConfig { + } + } + } ++ ++ public boolean perPlayerMobSpawns = false; ++ private void perPlayerMobSpawns() { ++ perPlayerMobSpawns = getBoolean("per-player-mob-spawns", false); ++ } + } +diff --git a/src/main/java/com/destroystokyo/paper/util/PlayerMobDistanceMap.java b/src/main/java/com/destroystokyo/paper/util/PlayerMobDistanceMap.java +new file mode 100644 +index 000000000..9ebd7ecb7 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/util/PlayerMobDistanceMap.java +@@ -0,0 +1,253 @@ ++package com.destroystokyo.paper.util; ++ ++import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap; ++import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; ++import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet; ++import net.minecraft.server.ChunkCoordIntPair; ++import net.minecraft.server.EntityPlayer; ++import net.minecraft.server.SectionPosition; ++import org.spigotmc.AsyncCatcher; ++import java.util.HashMap; ++import java.util.List; ++import java.util.Map; ++import java.util.Set; ++ ++/** @author Spottedleaf */ ++public final class PlayerMobDistanceMap { ++ ++ private static final PooledHashSets.PooledObjectLinkedOpenHashSet EMPTY_SET = new PooledHashSets.PooledObjectLinkedOpenHashSet<>(); ++ ++ private final Map players = new HashMap<>(); ++ // we use linked for better iteration. ++ private final Long2ObjectOpenHashMap> playerMap = new Long2ObjectOpenHashMap<>(32, 0.5f); ++ private int viewDistance; ++ ++ private final PooledHashSets pooledHashSets = new PooledHashSets<>(); ++ ++ public PooledHashSets.PooledObjectLinkedOpenHashSet getPlayersInRange(final ChunkCoordIntPair chunkPos) { ++ return this.getPlayersInRange(chunkPos.x, chunkPos.z); ++ } ++ ++ public PooledHashSets.PooledObjectLinkedOpenHashSet getPlayersInRange(final int chunkX, final int chunkZ) { ++ return this.playerMap.getOrDefault(ChunkCoordIntPair.pair(chunkX, chunkZ), EMPTY_SET); ++ } ++ ++ public void update(final List currentPlayers, final int newViewDistance) { ++ AsyncCatcher.catchOp("Distance map update"); ++ final ObjectLinkedOpenHashSet gone = new ObjectLinkedOpenHashSet<>(this.players.keySet()); ++ ++ final int oldViewDistance = this.viewDistance; ++ this.viewDistance = newViewDistance; ++ ++ for (final EntityPlayer player : currentPlayers) { ++ if (player.isSpectator() || !player.affectsSpawning) { ++ continue; // will be left in 'gone' (or not added at all) ++ } ++ ++ gone.remove(player); ++ ++ final SectionPosition newPosition = player.getPlayerMapSection(); ++ final SectionPosition oldPosition = this.players.put(player, newPosition); ++ ++ if (oldPosition == null) { ++ this.addNewPlayer(player, newPosition, newViewDistance); ++ } else { ++ this.updatePlayer(player, oldPosition, newPosition, oldViewDistance, newViewDistance); ++ } ++ //this.validatePlayer(player, newViewDistance); // debug only ++ } ++ ++ for (final EntityPlayer player : gone) { ++ final SectionPosition oldPosition = this.players.remove(player); ++ if (oldPosition != null) { ++ this.removePlayer(player, oldPosition, oldViewDistance); ++ } ++ } ++ } ++ ++ // expensive op, only for debug ++ private void validatePlayer(final EntityPlayer player, final int viewDistance) { ++ int entiesGot = 0; ++ int expectedEntries = (2 * viewDistance + 1); ++ expectedEntries *= expectedEntries; ++ ++ final SectionPosition currPosition = player.getPlayerMapSection(); ++ ++ final int centerX = currPosition.getX(); ++ final int centerZ = currPosition.getZ(); ++ ++ for (final Long2ObjectLinkedOpenHashMap.Entry> entry : this.playerMap.long2ObjectEntrySet()) { ++ final long key = entry.getLongKey(); ++ final PooledHashSets.PooledObjectLinkedOpenHashSet map = entry.getValue(); ++ ++ if (map.referenceCount == 0) { ++ throw new IllegalStateException("Invalid map"); ++ } ++ ++ if (map.set.contains(player)) { ++ ++entiesGot; ++ ++ final int chunkX = ChunkCoordIntPair.getX(key); ++ final int chunkZ = ChunkCoordIntPair.getZ(key); ++ ++ final int dist = Math.max(Math.abs(chunkX - centerX), Math.abs(chunkZ - centerZ)); ++ ++ if (dist > viewDistance) { ++ throw new IllegalStateException("Expected view distance " + viewDistance + ", got " + dist); ++ } ++ } ++ } ++ ++ if (entiesGot != expectedEntries) { ++ throw new IllegalStateException("Expected " + expectedEntries + ", got " + entiesGot); ++ } ++ } ++ ++ private void addPlayerTo(final EntityPlayer player, final int chunkX, final int chunkZ) { ++ this.playerMap.compute(ChunkCoordIntPair.pair(chunkX, chunkZ), (final Long key, final PooledHashSets.PooledObjectLinkedOpenHashSet players) -> { ++ if (players == null) { ++ return player.cachedSingleMobDistanceMap; ++ } else { ++ return PlayerMobDistanceMap.this.pooledHashSets.findMapWith(players, player); ++ } ++ }); ++ } ++ ++ private void removePlayerFrom(final EntityPlayer player, final int chunkX, final int chunkZ) { ++ this.playerMap.compute(ChunkCoordIntPair.pair(chunkX, chunkZ), (final Long keyInMap, final PooledHashSets.PooledObjectLinkedOpenHashSet players) -> { ++ return PlayerMobDistanceMap.this.pooledHashSets.findMapWithout(players, player); // rets null instead of an empty map ++ }); ++ } ++ ++ private void updatePlayer(final EntityPlayer player, final SectionPosition oldPosition, final SectionPosition newPosition, final int oldViewDistance, final int newViewDistance) { ++ final int toX = newPosition.getX(); ++ final int toZ = newPosition.getZ(); ++ final int fromX = oldPosition.getX(); ++ final int fromZ = oldPosition.getZ(); ++ ++ final int dx = toX - fromX; ++ final int dz = toZ - fromZ; ++ ++ final int totalX = Math.abs(fromX - toX); ++ final int totalZ = Math.abs(fromZ - toZ); ++ ++ if (Math.max(totalX, totalZ) > (2 * oldViewDistance)) { ++ // teleported? ++ this.removePlayer(player, oldPosition, oldViewDistance); ++ this.addNewPlayer(player, newPosition, newViewDistance); ++ return; ++ } ++ ++ // x axis is width ++ // z axis is height ++ // right refers to the x axis of where we moved ++ // top refers to the z axis of where we moved ++ ++ if (oldViewDistance == newViewDistance) { ++ // same view distance ++ ++ // used for relative positioning ++ final int up = 1 | (dz >> (Integer.SIZE - 1)); // 1 if dz >= 0, -1 otherwise ++ final int right = 1 | (dx >> (Integer.SIZE - 1)); // 1 if dx >= 0, -1 otherwise ++ ++ // The area excluded by overlapping the two view distance squares creates four rectangles: ++ // Two on the left, and two on the right. The ones on the left we consider the "removed" section ++ // and on the right the "added" section. ++ // https://i.imgur.com/MrnOBgI.png is a reference image. Note that the outside border is not actually ++ // exclusive to the regions they surround. ++ ++ // 4 points of the rectangle ++ int maxX; // exclusive ++ int minX; // inclusive ++ int maxZ; // exclusive ++ int minZ; // inclusive ++ ++ if (dx != 0) { ++ // handle right addition ++ ++ maxX = toX + (oldViewDistance * right) + right; // exclusive ++ minX = fromX + (oldViewDistance * right) + right; // inclusive ++ maxZ = fromZ + (oldViewDistance * up) + up; // exclusive ++ minZ = toZ - (oldViewDistance * up); // inclusive ++ ++ for (int currX = minX; currX != maxX; currX += right) { ++ for (int currZ = minZ; currZ != maxZ; currZ += up) { ++ this.addPlayerTo(player, currX, currZ); ++ } ++ } ++ } ++ ++ if (dz != 0) { ++ // handle up addition ++ ++ maxX = toX + (oldViewDistance * right) + right; // exclusive ++ minX = toX - (oldViewDistance * right); // inclusive ++ maxZ = toZ + (oldViewDistance * up) + up; // exclusive ++ minZ = fromZ + (oldViewDistance * up) + up; // inclusive ++ ++ for (int currX = minX; currX != maxX; currX += right) { ++ for (int currZ = minZ; currZ != maxZ; currZ += up) { ++ this.addPlayerTo(player, currX, currZ); ++ } ++ } ++ } ++ ++ if (dx != 0) { ++ // handle left removal ++ ++ maxX = toX - (oldViewDistance * right); // exclusive ++ minX = fromX - (oldViewDistance * right); // inclusive ++ maxZ = fromZ + (oldViewDistance * up) + up; // exclusive ++ minZ = toZ - (oldViewDistance * up); // inclusive ++ ++ for (int currX = minX; currX != maxX; currX += right) { ++ for (int currZ = minZ; currZ != maxZ; currZ += up) { ++ this.removePlayerFrom(player, currX, currZ); ++ } ++ } ++ } ++ ++ if (dz != 0) { ++ // handle down removal ++ ++ maxX = fromX + (oldViewDistance * right) + right; // exclusive ++ minX = fromX - (oldViewDistance * right); // inclusive ++ maxZ = toZ - (oldViewDistance * up); // exclusive ++ minZ = fromZ - (oldViewDistance * up); // inclusive ++ ++ for (int currX = minX; currX != maxX; currX += right) { ++ for (int currZ = minZ; currZ != maxZ; currZ += up) { ++ this.removePlayerFrom(player, currX, currZ); ++ } ++ } ++ } ++ } else { ++ // different view distance ++ // for now :) ++ this.removePlayer(player, oldPosition, oldViewDistance); ++ this.addNewPlayer(player, newPosition, newViewDistance); ++ } ++ } ++ ++ private void removePlayer(final EntityPlayer player, final SectionPosition position, final int viewDistance) { ++ final int x = position.getX(); ++ final int z = position.getZ(); ++ ++ for (int xoff = -viewDistance; xoff <= viewDistance; ++xoff) { ++ for (int zoff = -viewDistance; zoff <= viewDistance; ++zoff) { ++ this.removePlayerFrom(player, x + xoff, z + zoff); ++ } ++ } ++ } ++ ++ private void addNewPlayer(final EntityPlayer player, final SectionPosition position, final int viewDistance) { ++ final int x = position.getX(); ++ final int z = position.getZ(); ++ ++ for (int xoff = -viewDistance; xoff <= viewDistance; ++xoff) { ++ for (int zoff = -viewDistance; zoff <= viewDistance; ++zoff) { ++ this.addPlayerTo(player, x + xoff, z + zoff); ++ } ++ } ++ } ++} +diff --git a/src/main/java/com/destroystokyo/paper/util/PooledHashSets.java b/src/main/java/com/destroystokyo/paper/util/PooledHashSets.java +new file mode 100644 +index 000000000..4f13d3ff8 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/util/PooledHashSets.java +@@ -0,0 +1,241 @@ ++package com.destroystokyo.paper.util; ++ ++import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; ++import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet; ++import java.lang.ref.WeakReference; ++import java.util.Iterator; ++ ++/** @author Spottedleaf */ ++public class PooledHashSets { ++ ++ // we really want to avoid that equals() check as much as possible... ++ protected final Object2ObjectOpenHashMap, PooledObjectLinkedOpenHashSet> mapPool = new Object2ObjectOpenHashMap<>(64, 0.25f); ++ ++ protected void decrementReferenceCount(final PooledObjectLinkedOpenHashSet current) { ++ if (current.referenceCount == 0) { ++ throw new IllegalStateException("Cannot decrement reference count for " + current); ++ } ++ if (current.referenceCount == -1 || --current.referenceCount > 0) { ++ return; ++ } ++ ++ this.mapPool.remove(current); ++ return; ++ } ++ ++ public PooledObjectLinkedOpenHashSet findMapWith(final PooledObjectLinkedOpenHashSet current, final E object) { ++ final PooledObjectLinkedOpenHashSet cached = current.getAddCache(object); ++ ++ if (cached != null) { ++ if (cached.referenceCount != -1) { ++ ++cached.referenceCount; ++ } ++ ++ decrementReferenceCount(current); ++ ++ return cached; ++ } ++ ++ if (!current.add(object)) { ++ return current; ++ } ++ ++ // we use get/put since we use a different key on put ++ PooledObjectLinkedOpenHashSet ret = this.mapPool.get(current); ++ ++ if (ret == null) { ++ ret = new PooledObjectLinkedOpenHashSet<>(current); ++ current.remove(object); ++ this.mapPool.put(ret, ret); ++ ret.referenceCount = 1; ++ } else { ++ if (ret.referenceCount != -1) { ++ ++ret.referenceCount; ++ } ++ current.remove(object); ++ } ++ ++ current.updateAddCache(object, ret); ++ ++ decrementReferenceCount(current); ++ return ret; ++ } ++ ++ // rets null if current.size() == 1 ++ public PooledObjectLinkedOpenHashSet findMapWithout(final PooledObjectLinkedOpenHashSet current, final E object) { ++ if (current.set.size() == 1) { ++ decrementReferenceCount(current); ++ return null; ++ } ++ ++ final PooledObjectLinkedOpenHashSet cached = current.getRemoveCache(object); ++ ++ if (cached != null) { ++ if (cached.referenceCount != -1) { ++ ++cached.referenceCount; ++ } ++ ++ decrementReferenceCount(current); ++ ++ return cached; ++ } ++ ++ if (!current.remove(object)) { ++ return current; ++ } ++ ++ // we use get/put since we use a different key on put ++ PooledObjectLinkedOpenHashSet ret = this.mapPool.get(current); ++ ++ if (ret == null) { ++ ret = new PooledObjectLinkedOpenHashSet<>(current); ++ current.add(object); ++ this.mapPool.put(ret, ret); ++ ret.referenceCount = 1; ++ } else { ++ if (ret.referenceCount != -1) { ++ ++ret.referenceCount; ++ } ++ current.add(object); ++ } ++ ++ current.updateRemoveCache(object, ret); ++ ++ decrementReferenceCount(current); ++ return ret; ++ } ++ ++ public static final class PooledObjectLinkedOpenHashSet implements Iterable { ++ ++ private static final WeakReference NULL_REFERENCE = new WeakReference(null); ++ ++ final ObjectLinkedOpenHashSet set; ++ int referenceCount; // -1 if special ++ int hash; // optimize hashcode ++ ++ // add cache ++ WeakReference lastAddObject = NULL_REFERENCE; ++ WeakReference> lastAddMap = NULL_REFERENCE; ++ ++ // remove cache ++ WeakReference lastRemoveObject = NULL_REFERENCE; ++ WeakReference> lastRemoveMap = NULL_REFERENCE; ++ ++ public PooledObjectLinkedOpenHashSet() { ++ this.set = new ObjectLinkedOpenHashSet<>(2, 0.6f); ++ } ++ ++ public PooledObjectLinkedOpenHashSet(final E single) { ++ this(); ++ this.referenceCount = -1; ++ this.add(single); ++ } ++ ++ public PooledObjectLinkedOpenHashSet(final PooledObjectLinkedOpenHashSet other) { ++ this.set = other.set.clone(); ++ this.hash = other.hash; ++ } ++ ++ // from https://github.com/Spottedleaf/ConcurrentUtil/blob/master/src/main/java/ca/spottedleaf/concurrentutil/util/IntegerUtil.java ++ // generated by https://github.com/skeeto/hash-prospector ++ static int hash0(int x) { ++ x *= 0x36935555; ++ x ^= x >>> 16; ++ return x; ++ } ++ ++ public PooledObjectLinkedOpenHashSet getAddCache(final E element) { ++ final E currentAdd = this.lastAddObject.get(); ++ ++ if (currentAdd == null || !(currentAdd == element || currentAdd.equals(element))) { ++ return null; ++ } ++ ++ final PooledObjectLinkedOpenHashSet map = this.lastAddMap.get(); ++ if (map == null || map.referenceCount == 0) { ++ // we need to ret null if ref count is zero as calling code will assume the map is in use ++ return null; ++ } ++ ++ return map; ++ } ++ ++ public PooledObjectLinkedOpenHashSet getRemoveCache(final E element) { ++ final E currentRemove = this.lastRemoveObject.get(); ++ ++ if (currentRemove == null || !(currentRemove == element || currentRemove.equals(element))) { ++ return null; ++ } ++ ++ final PooledObjectLinkedOpenHashSet map = this.lastRemoveMap.get(); ++ if (map == null || map.referenceCount == 0) { ++ // we need to ret null if ref count is zero as calling code will assume the map is in use ++ return null; ++ } ++ ++ return map; ++ } ++ ++ public void updateAddCache(final E element, final PooledObjectLinkedOpenHashSet map) { ++ this.lastAddObject = new WeakReference<>(element); ++ this.lastAddMap = new WeakReference<>(map); ++ } ++ ++ public void updateRemoveCache(final E element, final PooledObjectLinkedOpenHashSet map) { ++ this.lastRemoveObject = new WeakReference<>(element); ++ this.lastRemoveMap = new WeakReference<>(map); ++ } ++ ++ boolean add(final E element) { ++ boolean added = this.set.add(element); ++ ++ if (added) { ++ this.hash += hash0(element.hashCode()); ++ } ++ ++ return added; ++ } ++ ++ boolean remove(Object element) { ++ boolean removed = this.set.remove(element); ++ ++ if (removed) { ++ this.hash -= hash0(element.hashCode()); ++ } ++ ++ return removed; ++ } ++ ++ @Override ++ public Iterator iterator() { ++ return this.set.iterator(); ++ } ++ ++ @Override ++ public int hashCode() { ++ return this.hash; ++ } ++ ++ @Override ++ public boolean equals(final Object other) { ++ if (!(other instanceof PooledObjectLinkedOpenHashSet)) { ++ return false; ++ } ++ if (this.referenceCount == 0) { ++ return other == this; ++ } else { ++ if (other == this) { ++ // Unfortunately we are never equal to our own instance while in use! ++ return false; ++ } ++ return this.hash == ((PooledObjectLinkedOpenHashSet)other).hash && this.set.equals(((PooledObjectLinkedOpenHashSet)other).set); ++ } ++ } ++ ++ @Override ++ public String toString() { ++ return "PooledHashSet: size: " + this.set.size() + ", reference count: " + this.referenceCount + ", hash: " + ++ this.hashCode() + ", identity: " + System.identityHashCode(this) + " map: " + this.set.toString(); ++ } ++ } ++} +diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java +index 17f04fb81..bc5011312 100644 +--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +@@ -555,7 +555,22 @@ public class ChunkProviderServer extends IChunkProvider { + this.world.timings.countNaturalMobs.startTiming(); // Paper - timings + int l = this.chunkMapDistance.b(); + EnumCreatureType[] aenumcreaturetype = EnumCreatureType.values(); +- Object2IntMap object2intmap = this.world.l(); ++ // Paper start - per player mob spawning ++ int[] worldMobCount; ++ if (this.playerChunkMap.playerMobDistanceMap != null) { ++ // update distance map ++ this.world.timings.playerMobDistanceMapUpdate.startTiming(); ++ this.playerChunkMap.playerMobDistanceMap.update(this.world.players, this.playerChunkMap.viewDistance); ++ this.world.timings.playerMobDistanceMapUpdate.stopTiming(); ++ // re-set mob counts ++ for (EntityPlayer player : this.world.players) { ++ Arrays.fill(player.mobCounts, 0); ++ } ++ worldMobCount = this.world.countMobs(true); ++ } else { ++ worldMobCount = this.world.countMobs(false); ++ } ++ // Paper end + + this.world.timings.countNaturalMobs.stopTiming(); // Paper - timings + this.world.getMethodProfiler().exit(); +@@ -608,8 +623,23 @@ public class ChunkProviderServer extends IChunkProvider { + if (enumcreaturetype != EnumCreatureType.MISC && (!enumcreaturetype.c() || this.allowAnimals) && (enumcreaturetype.c() || this.allowMonsters) && (!enumcreaturetype.d() || flag2)) { + int k1 = limit * l / ChunkProviderServer.b; // CraftBukkit - use per-world limits + +- if (object2intmap.getInt(enumcreaturetype) <= k1) { +- SpawnerCreature.a(enumcreaturetype, (World) this.world, chunk, blockposition); ++ // Paper start - only allow spawns upto the limit per chunk and update count afterwards ++ int currEntityCount = worldMobCount[enumcreaturetype.ordinal()]; ++ int difference = k1 - currEntityCount; ++ ++ if (this.world.paperConfig.perPlayerMobSpawns) { ++ int minDiff = Integer.MAX_VALUE; ++ for (EntityPlayer entityplayer : this.playerChunkMap.playerMobDistanceMap.getPlayersInRange(chunk.getPos())) { ++ minDiff = Math.min(limit - this.playerChunkMap.getMobCountNear(entityplayer, enumcreaturetype), minDiff); ++ } ++ difference = (minDiff == Integer.MAX_VALUE) ? 0 : minDiff; ++ } ++ ++ if (difference > 0) { ++ int spawnCount = SpawnerCreature.spawnMobs(enumcreaturetype, this.world, chunk, blockposition, difference, ++ this.world.paperConfig.perPlayerMobSpawns ? this.playerChunkMap::updatePlayerMobTypeMap : null); ++ worldMobCount[enumcreaturetype.ordinal()] += spawnCount; ++ // Paper end + } + } + } +diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +index 18695d9b5..5c4a4be1b 100644 +--- a/src/main/java/net/minecraft/server/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/EntityPlayer.java +@@ -80,6 +80,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + public boolean queueHealthUpdatePacket = false; + public net.minecraft.server.PacketPlayOutUpdateHealth queuedHealthUpdatePacket; + // Paper end ++ // Paper start - mob spawning rework ++ public static final int ENUMCREATURETYPE_TOTAL_ENUMS = EnumCreatureType.values().length; ++ public final int[] mobCounts = new int[ENUMCREATURETYPE_TOTAL_ENUMS]; // Paper ++ public final com.destroystokyo.paper.util.PooledHashSets.PooledObjectLinkedOpenHashSet cachedSingleMobDistanceMap; ++ // Paper end + + // CraftBukkit start + public String displayName; +@@ -110,6 +115,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + this.displayName = this.getName(); + this.canPickUpLoot = true; + this.maxHealthCache = this.getMaxHealth(); ++ this.cachedSingleMobDistanceMap = new com.destroystokyo.paper.util.PooledHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper + } + + // Yes, this doesn't match Vanilla, but it's the best we can do for now. +@@ -1766,6 +1772,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + this.playerConnection.sendPacket(new PacketPlayOutUnloadChunk(chunkcoordintpair.x, chunkcoordintpair.z)); + } + ++ public SectionPosition getPlayerMapSection() { return this.M(); } // Paper - OBFHELPER + public SectionPosition M() { + return this.cv; + } +diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java +index a7fc34f85..612b9b7e3 100644 +--- a/src/main/java/net/minecraft/server/EntityTypes.java ++++ b/src/main/java/net/minecraft/server/EntityTypes.java +@@ -253,6 +253,7 @@ public class EntityTypes { + return this.be; + } + ++ public EnumCreatureType getEnumCreatureType() { return this.e(); } // Paper - OBFHELPER + public EnumCreatureType e() { + return this.ba; + } +diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +index e6b7c41bf..a6b0fb160 100644 +--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +@@ -77,7 +77,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + private final PlayerMap playerMap; + public final Int2ObjectMap trackedEntities; + private final Queue A; +- private int viewDistance; ++ int viewDistance; // Paper - private -> package private ++ public final com.destroystokyo.paper.util.PlayerMobDistanceMap playerMobDistanceMap; // Paper + + // CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback() + public final CallbackExecutor callbackExecutor = new CallbackExecutor(); +@@ -135,6 +136,24 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + this.m = supplier; + this.n = new VillagePlace(new File(this.x, "poi"), datafixer, this.world); // Paper + this.setViewDistance(i); ++ this.playerMobDistanceMap = this.world.paperConfig.perPlayerMobSpawns ? new com.destroystokyo.paper.util.PlayerMobDistanceMap() : null; // Paper ++ } ++ ++ public void updatePlayerMobTypeMap(Entity entity) { ++ if (!this.world.paperConfig.perPlayerMobSpawns) { ++ return; ++ } ++ int chunkX = (int)Math.floor(entity.locX) >> 4; ++ int chunkZ = (int)Math.floor(entity.locZ) >> 4; ++ int index = entity.getEntityType().getEnumCreatureType().ordinal(); ++ ++ for (EntityPlayer player : this.playerMobDistanceMap.getPlayersInRange(chunkX, chunkZ)) { ++ ++player.mobCounts[index]; ++ } ++ } ++ ++ public int getMobCountNear(EntityPlayer entityPlayer, EnumCreatureType enumCreatureType) { ++ return entityPlayer.mobCounts[enumCreatureType.ordinal()]; + } + + private static double a(ChunkCoordIntPair chunkcoordintpair, Entity entity) { +diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java +index c6ea37ffb..9d4a96ae4 100644 +--- a/src/main/java/net/minecraft/server/SpawnerCreature.java ++++ b/src/main/java/net/minecraft/server/SpawnerCreature.java +@@ -3,6 +3,7 @@ package net.minecraft.server; + import java.util.List; + import java.util.Objects; + import java.util.Random; ++import java.util.function.Consumer; // Paper + import javax.annotation.Nullable; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; +@@ -16,9 +17,14 @@ public final class SpawnerCreature { + + private static final Logger LOGGER = LogManager.getLogger(); + ++ // Paper start - add maxSpawns parameter and return spawned mobs + public static void a(EnumCreatureType enumcreaturetype, World world, Chunk chunk, BlockPosition blockposition) { ++ spawnMobs(enumcreaturetype, world, chunk, blockposition, Integer.MAX_VALUE, null); ++ } ++ public static int spawnMobs(EnumCreatureType enumcreaturetype, World world, Chunk chunk, BlockPosition blockposition, int maxSpawns, Consumer trackEntity) { ++ // Paper end + ChunkGenerator chunkgenerator = world.getChunkProvider().getChunkGenerator(); +- int i = 0; ++ int i = 0; // Paper - force diff on name change + BlockPosition blockposition1 = getRandomPosition(world, chunk); + int j = blockposition1.getX(); + int k = blockposition1.getY(); +@@ -88,7 +94,7 @@ public final class SpawnerCreature { + ); + if (!event.callEvent()) { + if (event.shouldAbortSpawn()) { +- return; ++ return i; // Paper + } + ++i2; + continue; +@@ -107,7 +113,7 @@ public final class SpawnerCreature { + } catch (Exception exception) { + SpawnerCreature.LOGGER.warn("Failed to create mob", exception); + ServerInternalException.reportInternalException(exception); // Paper +- return; ++ return i; // Paper + } + + entityinsentient.setPositionRotation((double) f, (double) k, (double) f1, world.random.nextFloat() * 360.0F, 0.0F); +@@ -115,12 +121,16 @@ public final class SpawnerCreature { + groupdataentity = entityinsentient.prepare(world, world.getDamageScaler(new BlockPosition(entityinsentient)), EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null); + // CraftBukkit start + if (world.addEntity(entityinsentient, SpawnReason.NATURAL)) { +- ++i; ++ ++i; // Paper - force diff on name change + ++i2; ++ if (trackEntity != null) { ++ trackEntity.accept(entityinsentient); // Paper ++ } + } ++ if (i >= maxSpawns) { return i; } // Paper + // CraftBukkit end + if (i >= entityinsentient.dC()) { +- return; ++ return i; // Paper + } + + if (entityinsentient.c(i2)) { +@@ -146,6 +156,7 @@ public final class SpawnerCreature { + + } + } ++ return i; // Paper + } + + @Nullable +diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +index cf981632c..5eff278e7 100644 +--- a/src/main/java/net/minecraft/server/WorldServer.java ++++ b/src/main/java/net/minecraft/server/WorldServer.java +@@ -958,7 +958,20 @@ public class WorldServer extends World { + } + + public Object2IntMap l() { +- Object2IntMap object2intmap = new Object2IntOpenHashMap(); ++ // Paper start ++ int[] values = this.countMobs(false); ++ EnumCreatureType[] byId = EnumCreatureType.values(); ++ Object2IntMap ret = new Object2IntOpenHashMap<>(); ++ ++ for (int i = 0, len = values.length; i < len; ++i) { ++ ret.put(byId[i], values[i]); ++ } ++ ++ return ret; ++ } ++ public int[] countMobs(boolean updatePlayerCounts) { ++ int[] ret = new int[EntityPlayer.ENUMCREATURETYPE_TOTAL_ENUMS]; ++ // Paper end + ObjectIterator objectiterator = this.entitiesById.values().iterator(); + + while (objectiterator.hasNext()) { +@@ -983,11 +996,16 @@ public class WorldServer extends World { + continue; + } + // Paper end +- object2intmap.mergeInt(enumcreaturetype, 1, Integer::sum); ++ // Paper start - rework mob spawning ++ if (updatePlayerCounts) { ++ this.getChunkProvider().playerChunkMap.updatePlayerMobTypeMap(entity); ++ } ++ ++ret[enumcreaturetype.ordinal()]; ++ // Paper end + } + } + +- return object2intmap; ++ return ret; + } + + @Override +-- +2.23.0 +