From 973a5271c3d4703c09134da4c5809be677f66fc2 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Sun, 12 Apr 2020 22:34:18 -0700 Subject: [PATCH] Port 04-Util.patch from Tuinity (#3136) --- .../Add-LivingEntity-getTargetEntity.patch | 10 +- .../Add-exception-reporting-event.patch | 22 +- ...dd-some-Debug-to-Chunk-Entity-slices.patch | 4 +- Spigot-Server-Patches/Anti-Xray.patch | 2 +- .../Asynchronous-chunk-IO-and-loading.patch | 4 +- ...opper-searches-if-there-are-no-items.patch | 4 +- .../Basic-PlayerProfile-API.patch | 18 +- ...arseException-in-Entity-and-TE-names.patch | 10 +- .../Chunk-debug-command.patch | 12 +- .../Configurable-Chunk-Inhabited-Time.patch | 4 +- .../Duplicate-UUID-Resolve-Option.patch | 10 +- ...ead-Entities-in-entityList-iteration.patch | 2 +- Spigot-Server-Patches/MC-Utils.patch | 606 ++++++++++++++---- ...-anytime-entities-change-to-guarante.patch | 2 +- .../Optimise-Chunk-getFluid.patch | 4 +- .../Optimise-random-block-ticking.patch | 24 +- ...hunkMap-memory-use-for-visibleChunks.patch | 10 +- ...Location-getType-and-getBlockData-fo.patch | 8 +- ...tion-to-remove-corrupt-tile-entities.patch | 4 +- ...ve-invalid-mob-spawner-tile-entities.patch | 2 +- ...ts-for-each-Entity-Block-Entity-Type.patch | 2 +- ...to-current-Chunk-for-Entity-and-Bloc.patch | 8 +- .../String-based-Action-Bar-API.patch | 4 +- Spigot-Server-Patches/Timings-v2.patch | 58 +- 24 files changed, 604 insertions(+), 230 deletions(-) diff --git a/Spigot-Server-Patches/Add-LivingEntity-getTargetEntity.patch b/Spigot-Server-Patches/Add-LivingEntity-getTargetEntity.patch index bdf582f763..9d828df0d6 100644 --- a/Spigot-Server-Patches/Add-LivingEntity-getTargetEntity.patch +++ b/Spigot-Server-Patches/Add-LivingEntity-getTargetEntity.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add LivingEntity#getTargetEntity diff --git a/src/main/java/net/minecraft/server/AxisAlignedBB.java b/src/main/java/net/minecraft/server/AxisAlignedBB.java -index 4f60b931a1..c950139c0f 100644 +index f427953a8..3fdb52007 100644 --- a/src/main/java/net/minecraft/server/AxisAlignedBB.java +++ b/src/main/java/net/minecraft/server/AxisAlignedBB.java @@ -0,0 +0,0 @@ public class AxisAlignedBB { @@ -46,7 +46,7 @@ index 4f60b931a1..c950139c0f 100644 double[] adouble = new double[]{1.0D}; double d0 = vec3d1.x - vec3d.x; diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 725fa9501a..427d66ed01 100644 +index 725fa9501..427d66ed0 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -66,7 +66,7 @@ index 725fa9501a..427d66ed01 100644 return 0.0F; } diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 4e64a80a8a..af79b6e378 100644 +index 4e64a80a8..af79b6e37 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { @@ -108,7 +108,7 @@ index 4e64a80a8a..af79b6e378 100644 public int getShieldBlockingDelay() { diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java -index c1f462d9d3..498f381099 100644 +index c1f462d9d..498f38109 100644 --- a/src/main/java/net/minecraft/server/IEntitySelector.java +++ b/src/main/java/net/minecraft/server/IEntitySelector.java @@ -0,0 +0,0 @@ public final class IEntitySelector { @@ -120,7 +120,7 @@ index c1f462d9d3..498f381099 100644 return !entity.isSpectator(); }; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index d197094f54..6de01e4f0e 100644 +index d197094f5..6de01e4f0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/Spigot-Server-Patches/Add-exception-reporting-event.patch b/Spigot-Server-Patches/Add-exception-reporting-event.patch index f8a04dbefd..61d9568f0c 100644 --- a/Spigot-Server-Patches/Add-exception-reporting-event.patch +++ b/Spigot-Server-Patches/Add-exception-reporting-event.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add exception reporting event diff --git a/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java b/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java new file mode 100644 -index 0000000000..f699ce18ca +index 000000000..f699ce18c --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java @@ -0,0 +0,0 @@ @@ -49,7 +49,7 @@ index 0000000000..f699ce18ca + } +} diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 9adb212790..f3d20f214d 100644 +index 14097d40d..ac11e214b 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ @@ -80,7 +80,7 @@ index 9adb212790..f3d20f214d 100644 } } diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index a878f7c759..e5d89299f6 100644 +index a878f7c75..e5d89299f 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -0,0 +0,0 @@ import java.util.function.BooleanSupplier; @@ -94,7 +94,7 @@ index a878f7c759..e5d89299f6 100644 public class ChunkProviderServer extends IChunkProvider { diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java -index c9c2b00251..1422503e11 100644 +index c9c2b0025..1422503e1 100644 --- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java +++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java @@ -0,0 +0,0 @@ @@ -121,7 +121,7 @@ index c9c2b00251..1422503e11 100644 } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 3dd72e0842..291c2a17bb 100644 +index 3dd72e084..291c2a17b 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -141,7 +141,7 @@ index 3dd72e0842..291c2a17bb 100644 } } diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index 187c4e0f58..c2312a227c 100644 +index 187c4e0f5..c2312a227 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java @@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable { @@ -161,7 +161,7 @@ index 187c4e0f58..c2312a227c 100644 } finally { if (filechannel != null) { diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index 8ba344df64..02157d051f 100644 +index 8ba344df6..02157d051 100644 --- a/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java @@ -0,0 +0,0 @@ import org.apache.logging.log4j.LogManager; @@ -189,7 +189,7 @@ index 8ba344df64..02157d051f 100644 } diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java -index d5e9bae709..1bcf01c09a 100644 +index d5e9bae70..1bcf01c09 100644 --- a/src/main/java/net/minecraft/server/VillageSiege.java +++ b/src/main/java/net/minecraft/server/VillageSiege.java @@ -0,0 +0,0 @@ @@ -209,7 +209,7 @@ index d5e9bae709..1bcf01c09a 100644 } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 6e8ac186c9..a6b2867094 100644 +index 6e8ac186c..a6b286709 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ package net.minecraft.server; @@ -248,7 +248,7 @@ index 6e8ac186c9..a6b2867094 100644 return; // Paper end diff --git a/src/main/java/net/minecraft/server/WorldPersistentData.java b/src/main/java/net/minecraft/server/WorldPersistentData.java -index 19e68a7831..a2a25cf6a4 100644 +index 19e68a783..a2a25cf6a 100644 --- a/src/main/java/net/minecraft/server/WorldPersistentData.java +++ b/src/main/java/net/minecraft/server/WorldPersistentData.java @@ -0,0 +0,0 @@ public class WorldPersistentData { @@ -260,7 +260,7 @@ index 19e68a7831..a2a25cf6a4 100644 } finally { if (pushbackinputstream != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index 8823f94f7b..552daf4376 100644 +index 8823f94f7..552daf437 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java @@ -0,0 +0,0 @@ import java.util.concurrent.atomic.AtomicInteger; diff --git a/Spigot-Server-Patches/Add-some-Debug-to-Chunk-Entity-slices.patch b/Spigot-Server-Patches/Add-some-Debug-to-Chunk-Entity-slices.patch index 067e5c362d..bf9c932d33 100644 --- a/Spigot-Server-Patches/Add-some-Debug-to-Chunk-Entity-slices.patch +++ b/Spigot-Server-Patches/Add-some-Debug-to-Chunk-Entity-slices.patch @@ -9,7 +9,7 @@ This should hopefully avoid duplicate entities ever being created if the entity was to end up in 2 different chunk slices diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 68cde33565..3267e87259 100644 +index 54d48ef5e..8d3c265cc 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { @@ -58,7 +58,7 @@ index 68cde33565..3267e87259 100644 return; } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 7378d531b6..356de07dad 100644 +index 7378d531b..356de07da 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke diff --git a/Spigot-Server-Patches/Anti-Xray.patch b/Spigot-Server-Patches/Anti-Xray.patch index cf4cb6f898..9c83e5085f 100644 --- a/Spigot-Server-Patches/Anti-Xray.patch +++ b/Spigot-Server-Patches/Anti-Xray.patch @@ -1181,7 +1181,7 @@ index 000000000..37093419c + } +} diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 1709f9b84..b6ba0cb79 100644 +index d6637f3dd..bdd04305f 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { diff --git a/Spigot-Server-Patches/Asynchronous-chunk-IO-and-loading.patch b/Spigot-Server-Patches/Asynchronous-chunk-IO-and-loading.patch index 7e95632564..ff10ec0e97 100644 --- a/Spigot-Server-Patches/Asynchronous-chunk-IO-and-loading.patch +++ b/Spigot-Server-Patches/Asynchronous-chunk-IO-and-loading.patch @@ -3008,7 +3008,7 @@ index 2f95174fc..134c76065 100644 +// Paper end } diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index 047a0c659..b9d584452 100644 +index 4851b9fc5..786e6c976 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java @@ -0,0 +0,0 @@ public final class MCUtil { @@ -3983,7 +3983,7 @@ index c999f8c9b..b59ef1a63 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 4ddd8fd04..b5daebe51 100644 +index a79ccad0b..6634348e4 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World { diff --git a/Spigot-Server-Patches/Avoid-hopper-searches-if-there-are-no-items.patch b/Spigot-Server-Patches/Avoid-hopper-searches-if-there-are-no-items.patch index 174b365b68..d17a1b5cb7 100644 --- a/Spigot-Server-Patches/Avoid-hopper-searches-if-there-are-no-items.patch +++ b/Spigot-Server-Patches/Avoid-hopper-searches-if-there-are-no-items.patch @@ -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 b6ba0cb79e..38ab4197b2 100644 +index bdd04305f..03c25eae7 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { @@ -85,7 +85,7 @@ index b6ba0cb79e..38ab4197b2 100644 T t0 = (T) iterator.next(); // CraftBukkit - decompile error if (t0.shouldBeRemoved) continue; // Paper diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java -index 498f381099..a2d1ef3602 100644 +index 498f38109..a2d1ef360 100644 --- a/src/main/java/net/minecraft/server/IEntitySelector.java +++ b/src/main/java/net/minecraft/server/IEntitySelector.java @@ -0,0 +0,0 @@ public final class IEntitySelector { diff --git a/Spigot-Server-Patches/Basic-PlayerProfile-API.patch b/Spigot-Server-Patches/Basic-PlayerProfile-API.patch index 0d6a2582e0..7b679d8683 100644 --- a/Spigot-Server-Patches/Basic-PlayerProfile-API.patch +++ b/Spigot-Server-Patches/Basic-PlayerProfile-API.patch @@ -7,7 +7,7 @@ Establishes base extension of profile systems for future edits too diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java new file mode 100644 -index 0000000000..b151a13c1b +index 000000000..b151a13c1 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java @@ -0,0 +0,0 @@ @@ -293,7 +293,7 @@ index 0000000000..b151a13c1b +} diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java b/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java new file mode 100644 -index 0000000000..25836b975b +index 000000000..25836b975 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java @@ -0,0 +0,0 @@ @@ -329,7 +329,7 @@ index 0000000000..25836b975b +} diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java new file mode 100644 -index 0000000000..3bcdb8f93f +index 000000000..3bcdb8f93 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java @@ -0,0 +0,0 @@ @@ -352,7 +352,7 @@ index 0000000000..3bcdb8f93f +} diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java new file mode 100644 -index 0000000000..4b2a67423f +index 000000000..4b2a67423 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java @@ -0,0 +0,0 @@ @@ -387,7 +387,7 @@ index 0000000000..4b2a67423f +} diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperUserAuthentication.java b/src/main/java/com/destroystokyo/paper/profile/PaperUserAuthentication.java new file mode 100644 -index 0000000000..3aceb0ea8a +index 000000000..3aceb0ea8 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/profile/PaperUserAuthentication.java @@ -0,0 +0,0 @@ @@ -403,7 +403,7 @@ index 0000000000..3aceb0ea8a + } +} diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index e42dc05504..ddd7277162 100644 +index cc495020e..dae1560be 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java @@ -0,0 +0,0 @@ @@ -429,7 +429,7 @@ index e42dc05504..ddd7277162 100644 * Calculates distance between 2 entities * @param e1 diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 7016dac2d7..c15ca642d0 100644 +index 7016dac2d..c15ca642d 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant - License: LGPLv2.1 */ diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 96ac76c134..0db7b88bdd 100644 +index 96ac76c13..0db7b88bd 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; @@ -198,7 +198,7 @@ index 96ac76c134..0db7b88bdd 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 bfddeb7cdb..047a0c6591 100644 +index 95024d6ee..4851b9fc5 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java @@ -0,0 +0,0 @@ import com.destroystokyo.paper.block.TargetBlockInfo; @@ -399,7 +399,7 @@ index bfddeb7cdb..047a0c6591 100644 + } } diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index c4bbee7d6a..b6d3870063 100644 +index c4bbee7d6..b6d387006 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java @@ -0,0 +0,0 @@ public class PlayerChunk { @@ -412,7 +412,7 @@ index c4bbee7d6a..b6d3870063 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 863c47b761..cdab5ab6be 100644 +index 863c47b76..cdab5ab6b 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -434,7 +434,7 @@ index 863c47b761..cdab5ab6be 100644 private final DefinedStructureManager definedStructureManager; private final File w; diff --git a/src/main/java/net/minecraft/server/Ticket.java b/src/main/java/net/minecraft/server/Ticket.java -index 77bb6b092a..7a8397815a 100644 +index 77bb6b092..7a8397815 100644 --- a/src/main/java/net/minecraft/server/Ticket.java +++ b/src/main/java/net/minecraft/server/Ticket.java @@ -0,0 +0,0 @@ public final class Ticket implements Comparable> { diff --git a/Spigot-Server-Patches/Configurable-Chunk-Inhabited-Time.patch b/Spigot-Server-Patches/Configurable-Chunk-Inhabited-Time.patch index cea023348d..3a1085ac68 100644 --- a/Spigot-Server-Patches/Configurable-Chunk-Inhabited-Time.patch +++ b/Spigot-Server-Patches/Configurable-Chunk-Inhabited-Time.patch @@ -11,7 +11,7 @@ For people who want all chunks to be treated equally, you can chose a fixed valu This allows to fine-tune vanilla gameplay. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 6ef0e1399e..5872e6b171 100644 +index 6ef0e1399..5872e6b17 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -30,7 +30,7 @@ index 6ef0e1399e..5872e6b171 100644 + } } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index ee94f59e64..4fe36bb71d 100644 +index 6e50efbf6..8963acb9f 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { diff --git a/Spigot-Server-Patches/Duplicate-UUID-Resolve-Option.patch b/Spigot-Server-Patches/Duplicate-UUID-Resolve-Option.patch index fa7ccd72d5..5c9eaf64a5 100644 --- a/Spigot-Server-Patches/Duplicate-UUID-Resolve-Option.patch +++ b/Spigot-Server-Patches/Duplicate-UUID-Resolve-Option.patch @@ -33,7 +33,7 @@ But for those who are ok with leaving this inconsistent behavior, you may use WA It is recommended you regenerate the entities, as these were legit entities, and deserve your love. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 4ba72275b9..572679e4d1 100644 +index 4ba72275b..572679e4d 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -81,7 +81,7 @@ index 4ba72275b9..572679e4d1 100644 + } } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index a51de83cf5..c263a8250d 100644 +index 8d6c5d18e..23cc0c360 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { @@ -93,7 +93,7 @@ index a51de83cf5..c263a8250d 100644 int k = MathHelper.floor(entity.locY() / 16.0D); diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index bb1fd6e46c..0900db052d 100644 +index bb1fd6e46..0900db052 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -105,7 +105,7 @@ index bb1fd6e46c..0900db052d 100644 this.uniqueID = uuid; this.am = this.uniqueID.toString(); diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index f640d2ac76..863c47b761 100644 +index f640d2ac7..863c47b76 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -0,0 +0,0 @@ @@ -197,7 +197,7 @@ index f640d2ac76..863c47b761 100644 ChunkCoordIntPair chunkcoordintpair = playerchunk.i(); CompletableFuture, PlayerChunk.Failure>> completablefuture = this.a(chunkcoordintpair, 1, (i) -> { diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 1221c30a99..ff58e0190e 100644 +index e34ea3d09..f9ee9afe3 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -0,0 +0,0 @@ package net.minecraft.server; diff --git a/Spigot-Server-Patches/Ignore-Dead-Entities-in-entityList-iteration.patch b/Spigot-Server-Patches/Ignore-Dead-Entities-in-entityList-iteration.patch index 0d27e6117c..d64692db24 100644 --- a/Spigot-Server-Patches/Ignore-Dead-Entities-in-entityList-iteration.patch +++ b/Spigot-Server-Patches/Ignore-Dead-Entities-in-entityList-iteration.patch @@ -23,7 +23,7 @@ index b839769ce..5acad8e44 100644 MutablePair> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap())); ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.getChunkX(), e.getChunkZ()); diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 3267e8725..a51de83cf 100644 +index 8d3c265cc..8d6c5d18e 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { diff --git a/Spigot-Server-Patches/MC-Utils.patch b/Spigot-Server-Patches/MC-Utils.patch index a54c9159ef..660bc4d783 100644 --- a/Spigot-Server-Patches/MC-Utils.patch +++ b/Spigot-Server-Patches/MC-Utils.patch @@ -6,7 +6,7 @@ Subject: [PATCH] MC Utils diff --git a/src/main/java/com/destroystokyo/paper/util/concurrent/WeakSeqLock.java b/src/main/java/com/destroystokyo/paper/util/concurrent/WeakSeqLock.java new file mode 100644 -index 0000000000..4029dc68cf +index 000000000..4029dc68c --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/concurrent/WeakSeqLock.java @@ -0,0 +0,0 @@ @@ -80,7 +80,7 @@ index 0000000000..4029dc68cf +} diff --git a/src/main/java/com/destroystokyo/paper/util/map/QueuedChangesMapLong2Int.java b/src/main/java/com/destroystokyo/paper/util/map/QueuedChangesMapLong2Int.java new file mode 100644 -index 0000000000..968c9ed328 +index 000000000..59868f37d --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/map/QueuedChangesMapLong2Int.java @@ -0,0 +0,0 @@ @@ -181,7 +181,7 @@ index 0000000000..968c9ed328 + while (iterator0.hasNext()) { + final Long2IntMap.Entry entry = iterator0.next(); + final long key = entry.getLongKey(); -+ final int val = entry.getValue(); ++ final int val = entry.getIntValue(); + + this.updatingMapSeqLock.acquireWrite(); + try { @@ -191,6 +191,8 @@ index 0000000000..968c9ed328 + } + } + ++ this.queuedPuts.clear(); ++ + final LongIterator iterator1 = this.queuedRemove.iterator(); + while (iterator1.hasNext()) { + final long key = iterator1.nextLong(); @@ -203,6 +205,7 @@ index 0000000000..968c9ed328 + } + } + ++ this.queuedRemove.clear(); + + return true; + } @@ -221,11 +224,13 @@ index 0000000000..968c9ed328 + while (iterator0.hasNext()) { + final Long2IntMap.Entry entry = iterator0.next(); + final long key = entry.getLongKey(); -+ final int val = entry.getValue(); ++ final int val = entry.getIntValue(); + + this.visibleMap.put(key, val); + } + ++ this.queuedPuts.clear(); ++ + final LongIterator iterator1 = this.queuedRemove.iterator(); + while (iterator1.hasNext()) { + final long key = iterator1.nextLong(); @@ -233,6 +238,7 @@ index 0000000000..968c9ed328 + this.visibleMap.remove(key); + } + ++ this.queuedRemove.clear(); + + return true; + } finally { @@ -242,7 +248,7 @@ index 0000000000..968c9ed328 +} diff --git a/src/main/java/com/destroystokyo/paper/util/map/QueuedChangesMapLong2Object.java b/src/main/java/com/destroystokyo/paper/util/map/QueuedChangesMapLong2Object.java new file mode 100644 -index 0000000000..07685b6bd5 +index 000000000..07685b6bd --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/map/QueuedChangesMapLong2Object.java @@ -0,0 +0,0 @@ @@ -420,7 +426,7 @@ index 0000000000..07685b6bd5 +} diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/ChunkList.java b/src/main/java/com/destroystokyo/paper/util/maplist/ChunkList.java new file mode 100644 -index 0000000000..4ec248adb6 +index 000000000..4eac05778 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/maplist/ChunkList.java @@ -0,0 +0,0 @@ @@ -439,12 +445,14 @@ index 0000000000..4ec248adb6 + */ +public final class ChunkList implements Iterable { + -+ protected final Long2IntOpenHashMap chunkToIndex = new Long2IntOpenHashMap(); ++ protected final Long2IntOpenHashMap chunkToIndex = new Long2IntOpenHashMap(2, 0.8f); + { + this.chunkToIndex.defaultReturnValue(Integer.MIN_VALUE); + } + -+ protected Chunk[] chunks = new Chunk[16]; ++ protected static final Chunk[] EMPTY_LIST = new Chunk[0]; ++ ++ protected Chunk[] chunks = EMPTY_LIST; + protected int count; + + public int size() { @@ -452,11 +460,11 @@ index 0000000000..4ec248adb6 + } + + public boolean contains(final Chunk chunk) { -+ return this.chunkToIndex.containsKey(MCUtil.getCoordinateKey(chunk.getPos())); ++ return this.chunkToIndex.containsKey(chunk.coordinateKey); + } + + public boolean remove(final Chunk chunk) { -+ final int index = this.chunkToIndex.remove(MCUtil.getCoordinateKey(chunk.getPos())); ++ final int index = this.chunkToIndex.remove(chunk.coordinateKey); + if (index == Integer.MIN_VALUE) { + return false; + } @@ -466,7 +474,7 @@ index 0000000000..4ec248adb6 + final Chunk end = this.chunks[endIndex]; + if (index != endIndex) { + // not empty after this call -+ this.chunkToIndex.put(MCUtil.getCoordinateKey(end.getPos()), index); // update index ++ this.chunkToIndex.put(end.coordinateKey, index); // update index + } + this.chunks[index] = end; + this.chunks[endIndex] = null; @@ -476,7 +484,7 @@ index 0000000000..4ec248adb6 + + public boolean add(final Chunk chunk) { + final int count = this.count; -+ final int currIndex = this.chunkToIndex.putIfAbsent(MCUtil.getCoordinateKey(chunk.getPos()), count); ++ final int currIndex = this.chunkToIndex.putIfAbsent(chunk.coordinateKey, count); + + if (currIndex != Integer.MIN_VALUE) { + return false; // already in this list @@ -486,7 +494,7 @@ index 0000000000..4ec248adb6 + + if (list.length == count) { + // resize required -+ list = this.chunks = Arrays.copyOf(list, count * 2); // overflow results in negative ++ list = this.chunks = Arrays.copyOf(list, (int)Math.max(4L, count * 2L)); // overflow results in negative + } + + list[count] = chunk; @@ -553,7 +561,7 @@ index 0000000000..4ec248adb6 +} diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java b/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java new file mode 100644 -index 0000000000..f3cb346c9d +index 000000000..cdda74564 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java @@ -0,0 +0,0 @@ @@ -571,12 +579,14 @@ index 0000000000..f3cb346c9d + */ +public final class EntityList implements Iterable { + -+ protected final Int2IntOpenHashMap entityToIndex = new Int2IntOpenHashMap(); ++ protected final Int2IntOpenHashMap entityToIndex = new Int2IntOpenHashMap(2, 0.8f); + { + this.entityToIndex.defaultReturnValue(Integer.MIN_VALUE); + } + -+ protected Entity[] entities = new Entity[16]; ++ protected static final Entity[] EMPTY_LIST = new Entity[0]; ++ ++ protected Entity[] entities = EMPTY_LIST; + protected int count; + + public int size() { @@ -618,7 +628,7 @@ index 0000000000..f3cb346c9d + + if (list.length == count) { + // resize required -+ list = this.entities = Arrays.copyOf(list, count * 2); // overflow results in negative ++ list = this.entities = Arrays.copyOf(list, (int)Math.max(4L, count * 2L)); // overflow results in negative + } + + list[count] = entity; @@ -685,7 +695,7 @@ index 0000000000..f3cb346c9d +} diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java b/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java new file mode 100644 -index 0000000000..c2f7e4ca0f +index 000000000..84ef8d9ec --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java @@ -0,0 +0,0 @@ @@ -706,12 +716,14 @@ index 0000000000..c2f7e4ca0f + static final DataPaletteGlobal GLOBAL_PALETTE = (DataPaletteGlobal)ChunkSection.GLOBAL_PALETTE; + + // map of location -> (index | (location << 16) | (palette id << 32)) -+ private final Short2LongOpenHashMap map = new Short2LongOpenHashMap(16, 0.7f); ++ private final Short2LongOpenHashMap map = new Short2LongOpenHashMap(2, 0.8f); + { + this.map.defaultReturnValue(Long.MAX_VALUE); + } + -+ private long[] byIndex = new long[16]; ++ private static final long[] EMPTY_LIST = new long[0]; ++ ++ private long[] byIndex = EMPTY_LIST; + private int size; + + public static int getLocationKey(final int x, final int y, final int z) { @@ -751,7 +763,7 @@ index 0000000000..c2f7e4ca0f + this.map.put((short)location, raw); + + if (index >= this.byIndex.length) { -+ this.byIndex = Arrays.copyOf(this.byIndex, this.byIndex.length * 2); ++ this.byIndex = Arrays.copyOf(this.byIndex, (int)Math.max(4L, this.byIndex.length * 2L)); + } + + this.byIndex[index] = raw; @@ -817,7 +829,7 @@ index 0000000000..c2f7e4ca0f +} diff --git a/src/main/java/com/destroystokyo/paper/util/math/IntegerUtil.java b/src/main/java/com/destroystokyo/paper/util/math/IntegerUtil.java new file mode 100644 -index 0000000000..c3b936f54b +index 000000000..c3b936f54 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/math/IntegerUtil.java @@ -0,0 +0,0 @@ @@ -1053,12 +1065,13 @@ index 0000000000..c3b936f54b +} diff --git a/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java b/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java new file mode 100644 -index 0000000000..5a44bc644b +index 000000000..f625da9f0 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java @@ -0,0 +0,0 @@ +package com.destroystokyo.paper.util.misc; + ++import com.destroystokyo.paper.util.math.IntegerUtil; +import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap; +import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; @@ -1069,15 +1082,13 @@ index 0000000000..5a44bc644b +import javax.annotation.Nullable; +import java.util.Iterator; + -+/** -+ * @author Spottedleaf -+ */ ++/** @author Spottedleaf */ +public abstract class AreaMap { + + /* Tested via https://gist.github.com/Spottedleaf/520419c6f41ef348fe9926ce674b7217 */ + -+ private final Object2LongOpenHashMap objectToLastCoordinate = new Object2LongOpenHashMap<>(); -+ private final Object2IntOpenHashMap objectToViewDistance = new Object2IntOpenHashMap<>(); ++ protected final Object2LongOpenHashMap objectToLastCoordinate = new Object2LongOpenHashMap<>(); ++ protected final Object2IntOpenHashMap objectToViewDistance = new Object2IntOpenHashMap<>(); + + { + this.objectToViewDistance.defaultReturnValue(-1); @@ -1086,11 +1097,11 @@ index 0000000000..5a44bc644b + + // we use linked for better iteration. + // map of: coordinate to set of objects in coordinate -+ private final Long2ObjectOpenHashMap> areaMap = new Long2ObjectOpenHashMap<>(1024, 0.3f); -+ private final PooledLinkedHashSets pooledHashSets; ++ protected final Long2ObjectOpenHashMap> areaMap = new Long2ObjectOpenHashMap<>(1024, 0.7f); ++ protected final PooledLinkedHashSets pooledHashSets; + -+ private final ChangeCallback addCallback; -+ private final ChangeCallback removeCallback; ++ protected final ChangeCallback addCallback; ++ protected final ChangeCallback removeCallback; + + public AreaMap() { + this(new PooledLinkedHashSets<>()); @@ -1108,48 +1119,57 @@ index 0000000000..5a44bc644b + } + + @Nullable -+ public PooledLinkedHashSets.PooledObjectLinkedOpenHashSet getObjectsInRange(final long key) { ++ public final PooledLinkedHashSets.PooledObjectLinkedOpenHashSet getObjectsInRange(final long key) { + return this.areaMap.get(key); + } + + @Nullable -+ public PooledLinkedHashSets.PooledObjectLinkedOpenHashSet getObjectsInRange(final ChunkCoordIntPair chunkPos) { -+ return this.getObjectsInRange(chunkPos.x, chunkPos.z); ++ public final PooledLinkedHashSets.PooledObjectLinkedOpenHashSet getObjectsInRange(final ChunkCoordIntPair chunkPos) { ++ return this.areaMap.get(MCUtil.getCoordinateKey(chunkPos)); + } + + @Nullable -+ public PooledLinkedHashSets.PooledObjectLinkedOpenHashSet getObjectsInRange(final int chunkX, final int chunkZ) { -+ return this.getObjectsInRange(MCUtil.getCoordinateKey(chunkX, chunkZ)); ++ public final PooledLinkedHashSets.PooledObjectLinkedOpenHashSet getObjectsInRange(final int chunkX, final int chunkZ) { ++ return this.areaMap.get(MCUtil.getCoordinateKey(chunkX, chunkZ)); + } + + // Long.MIN_VALUE indicates the object is not mapped -+ public long getLastCoordinate(final E object) { ++ public final long getLastCoordinate(final E object) { + return this.objectToLastCoordinate.getOrDefault(object, Long.MIN_VALUE); + } + + // -1 indicates the object is not mapped -+ public int getLastViewDistance(final E object) { ++ public final int getLastViewDistance(final E object) { + return this.objectToViewDistance.getOrDefault(object, -1); + } + + // returns the total number of mapped chunks -+ public int size() { ++ public final int size() { + return this.areaMap.size(); + } + -+ public void update(final E object, final int chunkX, final int chunkZ, final int viewDistance) { -+ final int oldDistance = this.objectToViewDistance.put(object, viewDistance); ++ public final void update(final E object, final int chunkX, final int chunkZ, final int viewDistance) { ++ final int oldViewDistance = this.objectToViewDistance.put(object, viewDistance); + final long newPos = MCUtil.getCoordinateKey(chunkX, chunkZ); -+ if (oldDistance == -1) { ++ if (oldViewDistance == -1) { + this.objectToLastCoordinate.put(object, newPos); + this.addObject(object, chunkX, chunkZ, Integer.MIN_VALUE, Integer.MIN_VALUE, viewDistance); ++ this.addObjectCallback(object, chunkX, chunkZ, viewDistance); + } else { -+ this.updateObject(object, this.objectToLastCoordinate.put(object, newPos), newPos, oldDistance, viewDistance); ++ final long oldPos = this.objectToLastCoordinate.put(object, newPos); ++ this.updateObject(object, oldPos, newPos, oldViewDistance, viewDistance); ++ this.updateObjectCallback(object, oldPos, newPos, oldViewDistance, viewDistance); + } + //this.validate(object, viewDistance); + } + -+ public boolean remove(final E object) { ++ // called after the distance map updates ++ protected void addObjectCallback(final E object, final int chunkX, final int chunkZ, final int viewDistance) {} ++ ++ // called after the distance map updates ++ protected void updateObjectCallback(final E Object, final long oldPosition, final long newPosition, final int oldViewDistance, final int newViewDistance) {} ++ ++ public final boolean remove(final E object) { + final long position = this.objectToLastCoordinate.removeLong(object); + final int viewDistance = this.objectToViewDistance.removeInt(object); + @@ -1161,14 +1181,18 @@ index 0000000000..5a44bc644b + final int currentZ = MCUtil.getCoordinateZ(position); + + this.removeObject(object, currentX, currentZ, currentX, currentZ, viewDistance); ++ this.removeObjectCallback(object, currentX, currentZ, viewDistance); + //this.validate(object, -1); + return true; + } + ++ // called after the distance map updates ++ protected void removeObjectCallback(final E object, final int chunkX, final int chunkZ, final int viewDistance) {} ++ + protected abstract PooledLinkedHashSets.PooledObjectLinkedOpenHashSet getEmptySetFor(final E object); + + // expensive op, only for debug -+ private void validate(final E object, final int viewDistance) { ++ protected void validate(final E object, final int viewDistance) { + int entiesGot = 0; + int expectedEntries = (2 * viewDistance + 1); + expectedEntries *= expectedEntries; @@ -1198,7 +1222,7 @@ index 0000000000..5a44bc644b + final int chunkX = MCUtil.getCoordinateX(key); + final int chunkZ = MCUtil.getCoordinateZ(key); + -+ final int dist = Math.max(Math.abs(chunkX - centerX), Math.abs(chunkZ - centerZ)); ++ final int dist = Math.max(IntegerUtil.branchlessAbs(chunkX - centerX), IntegerUtil.branchlessAbs(chunkZ - centerZ)); + + if (dist > viewDistance) { + throw new IllegalStateException("Expected view distance " + viewDistance + ", got " + dist); @@ -1211,8 +1235,8 @@ index 0000000000..5a44bc644b + } + } + -+ protected final void addObjectTo(final E object, final int chunkX, final int chunkZ, final int currChunkX, -+ final int currChunkZ, final int prevChunkX, final int prevChunkZ) { ++ private void addObjectTo(final E object, final int chunkX, final int chunkZ, final int currChunkX, ++ final int currChunkZ, final int prevChunkX, final int prevChunkZ) { + final long key = MCUtil.getCoordinateKey(chunkX, chunkZ); + + PooledLinkedHashSets.PooledObjectLinkedOpenHashSet empty = this.getEmptySetFor(object); @@ -1243,8 +1267,8 @@ index 0000000000..5a44bc644b + } + } + -+ protected final void removeObjectFrom(final E object, final int chunkX, final int chunkZ, final int currChunkX, -+ final int currChunkZ, final int prevChunkX, final int prevChunkZ) { ++ private void removeObjectFrom(final E object, final int chunkX, final int chunkZ, final int currChunkX, ++ final int currChunkZ, final int prevChunkX, final int prevChunkZ) { + final long key = MCUtil.getCoordinateKey(chunkX, chunkZ); + + PooledLinkedHashSets.PooledObjectLinkedOpenHashSet current = this.areaMap.get(key); @@ -1280,8 +1304,10 @@ index 0000000000..5a44bc644b + private void addObject(final E object, final int chunkX, final int chunkZ, final int prevChunkX, final int prevChunkZ, final int viewDistance) { + final int maxX = chunkX + viewDistance; + final int maxZ = chunkZ + viewDistance; -+ for (int x = chunkX - viewDistance; x <= maxX; ++x) { -+ for (int z = chunkZ - viewDistance; z <= maxZ; ++z) { ++ final int minX = chunkX - viewDistance; ++ final int minZ = chunkZ - viewDistance; ++ for (int x = minX; x <= maxX; ++x) { ++ for (int z = minZ; z <= maxZ; ++z) { + this.addObjectTo(object, x, z, chunkX, chunkZ, prevChunkX, prevChunkZ); + } + } @@ -1290,8 +1316,10 @@ index 0000000000..5a44bc644b + private void removeObject(final E object, final int chunkX, final int chunkZ, final int currentChunkX, final int currentChunkZ, final int viewDistance) { + final int maxX = chunkX + viewDistance; + final int maxZ = chunkZ + viewDistance; -+ for (int x = chunkX - viewDistance; x <= maxX; ++x) { -+ for (int z = chunkZ - viewDistance; z <= maxZ; ++z) { ++ final int minX = chunkX - viewDistance; ++ final int minZ = chunkZ - viewDistance; ++ for (int x = minX; x <= maxX; ++x) { ++ for (int z = minZ; z <= maxZ; ++z) { + this.removeObjectFrom(object, x, z, currentChunkX, currentChunkZ, chunkX, chunkZ); + } + } @@ -1302,7 +1330,7 @@ index 0000000000..5a44bc644b + return 1 | (val >> (Integer.SIZE - 1)); + } + -+ protected final void updateObject(final E object, final long oldPosition, final long newPosition, final int oldViewDistance, final int newViewDistance) { ++ private void updateObject(final E object, final long oldPosition, final long newPosition, final int oldViewDistance, final int newViewDistance) { + final int toX = MCUtil.getCoordinateX(newPosition); + final int toZ = MCUtil.getCoordinateZ(newPosition); + final int fromX = MCUtil.getCoordinateX(oldPosition); @@ -1311,8 +1339,8 @@ index 0000000000..5a44bc644b + final int dx = toX - fromX; + final int dz = toZ - fromZ; + -+ final int totalX = Math.abs(fromX - toX); -+ final int totalZ = Math.abs(fromZ - toZ); ++ final int totalX = IntegerUtil.branchlessAbs(fromX - toX); ++ final int totalZ = IntegerUtil.branchlessAbs(fromZ - toZ); + + if (Math.max(totalX, totalZ) > (2 * Math.max(newViewDistance, oldViewDistance))) { + // teleported? @@ -1324,13 +1352,15 @@ index 0000000000..5a44bc644b + if (oldViewDistance != newViewDistance) { + // remove loop + ++ final int oldMinX = fromX - oldViewDistance; ++ final int oldMinZ = fromZ - oldViewDistance; + final int oldMaxX = fromX + oldViewDistance; + final int oldMaxZ = fromZ + oldViewDistance; -+ for (int currX = fromX - oldViewDistance; currX <= oldMaxX; ++currX) { -+ for (int currZ = fromZ - oldViewDistance; currZ <= oldMaxZ; ++currZ) { ++ for (int currX = oldMinX; currX <= oldMaxX; ++currX) { ++ for (int currZ = oldMinZ; currZ <= oldMaxZ; ++currZ) { + + // only remove if we're outside the new view distance... -+ if (Math.max(Math.abs(currX - toX), Math.abs(currZ - toZ)) > newViewDistance) { ++ if (Math.max(IntegerUtil.branchlessAbs(currX - toX), IntegerUtil.branchlessAbs(currZ - toZ)) > newViewDistance) { + this.removeObjectFrom(object, currX, currZ, toX, toZ, fromX, fromZ); + } + } @@ -1338,13 +1368,15 @@ index 0000000000..5a44bc644b + + // add loop + ++ final int newMinX = toX - newViewDistance; ++ final int newMinZ = toZ - newViewDistance; + final int newMaxX = toX + newViewDistance; + final int newMaxZ = toZ + newViewDistance; -+ for (int currX = toX - newViewDistance; currX <= newMaxX; ++currX) { -+ for (int currZ = toZ - newViewDistance; currZ <= newMaxZ; ++currZ) { ++ for (int currX = newMinX; currX <= newMaxX; ++currX) { ++ for (int currZ = newMinZ; currZ <= newMaxZ; ++currZ) { + + // only add if we're outside the old view distance... -+ if (Math.max(Math.abs(currX - fromX), Math.abs(currZ - fromZ)) > oldViewDistance) { ++ if (Math.max(IntegerUtil.branchlessAbs(currX - fromX), IntegerUtil.branchlessAbs(currZ - fromZ)) > oldViewDistance) { + this.addObjectTo(object, currX, currZ, toX, toZ, fromX, fromZ); + } + } @@ -1446,9 +1478,190 @@ index 0000000000..5a44bc644b + + } +} +diff --git a/src/main/java/com/destroystokyo/paper/util/misc/DistanceTrackingAreaMap.java b/src/main/java/com/destroystokyo/paper/util/misc/DistanceTrackingAreaMap.java +new file mode 100644 +index 000000000..3f86c1ad4 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/util/misc/DistanceTrackingAreaMap.java +@@ -0,0 +0,0 @@ ++package com.destroystokyo.paper.util.misc; ++ ++import com.destroystokyo.paper.util.math.IntegerUtil; ++import it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap; ++import net.minecraft.server.ChunkCoordIntPair; ++import net.minecraft.server.MCUtil; ++ ++/** @author Spottedleaf */ ++public abstract class DistanceTrackingAreaMap extends AreaMap { ++ ++ // use this map only if you need distance tracking, the tracking here is obviously going to hit harder. ++ ++ protected final Long2IntOpenHashMap chunkToNearestDistance = new Long2IntOpenHashMap(1024, 0.7f); ++ { ++ this.chunkToNearestDistance.defaultReturnValue(-1); ++ } ++ ++ protected final DistanceChangeCallback distanceChangeCallback; ++ ++ public DistanceTrackingAreaMap() { ++ this(new PooledLinkedHashSets<>()); ++ } ++ ++ // let users define a "global" or "shared" pooled sets if they wish ++ public DistanceTrackingAreaMap(final PooledLinkedHashSets pooledHashSets) { ++ this(pooledHashSets, null, null, null); ++ } ++ ++ public DistanceTrackingAreaMap(final PooledLinkedHashSets pooledHashSets, final ChangeCallback addCallback, final ChangeCallback removeCallback, ++ final DistanceChangeCallback distanceChangeCallback) { ++ super(pooledHashSets, addCallback, removeCallback); ++ this.distanceChangeCallback = distanceChangeCallback; ++ } ++ ++ // ret -1 if there is nothing mapped ++ public final int getNearestObjectDistance(final long key) { ++ return this.chunkToNearestDistance.get(key); ++ } ++ ++ // ret -1 if there is nothing mapped ++ public final int getNearestObjectDistance(final ChunkCoordIntPair chunkPos) { ++ return this.chunkToNearestDistance.get(MCUtil.getCoordinateKey(chunkPos)); ++ } ++ ++ // ret -1 if there is nothing mapped ++ public final int getNearestObjectDistance(final int chunkX, final int chunkZ) { ++ return this.chunkToNearestDistance.get(MCUtil.getCoordinateKey(chunkX, chunkZ)); ++ } ++ ++ protected final void recalculateDistance(final int chunkX, final int chunkZ) { ++ final long key = MCUtil.getCoordinateKey(chunkX, chunkZ); ++ final PooledLinkedHashSets.PooledObjectLinkedOpenHashSet state = this.areaMap.get(key); ++ if (state == null) { ++ final int oldDistance = this.chunkToNearestDistance.remove(key); ++ // nothing here. ++ if (oldDistance == -1) { ++ // nothing was here previously ++ return; ++ } ++ if (this.distanceChangeCallback != null) { ++ this.distanceChangeCallback.accept(chunkX, chunkZ, oldDistance, -1, null); ++ } ++ return; ++ } ++ ++ int newDistance = Integer.MAX_VALUE; ++ ++ final Object[] rawData = state.getBackingSet(); ++ for (int i = 0, len = rawData.length; i < len; ++i) { ++ final Object raw = rawData[i]; ++ ++ if (raw == null) { ++ continue; ++ } ++ ++ final E object = (E)raw; ++ final long location = this.objectToLastCoordinate.getLong(object); ++ ++ final int distance = Math.max(IntegerUtil.branchlessAbs(chunkX - MCUtil.getCoordinateX(location)), IntegerUtil.branchlessAbs(chunkZ - MCUtil.getCoordinateZ(location))); ++ ++ if (distance < newDistance) { ++ newDistance = distance; ++ } ++ } ++ ++ final int oldDistance = this.chunkToNearestDistance.put(key, newDistance); ++ ++ if (oldDistance != newDistance) { ++ if (this.distanceChangeCallback != null) { ++ this.distanceChangeCallback.accept(chunkX, chunkZ, oldDistance, newDistance, state); ++ } ++ } ++ } ++ ++ @Override ++ protected void addObjectCallback(final E object, final int chunkX, final int chunkZ, final int viewDistance) { ++ final int maxX = chunkX + viewDistance; ++ final int maxZ = chunkZ + viewDistance; ++ final int minX = chunkX - viewDistance; ++ final int minZ = chunkZ - viewDistance; ++ for (int x = minX; x <= maxX; ++x) { ++ for (int z = minZ; z <= maxZ; ++z) { ++ this.recalculateDistance(x, z); ++ } ++ } ++ } ++ ++ @Override ++ protected void removeObjectCallback(final E object, final int chunkX, final int chunkZ, final int viewDistance) { ++ final int maxX = chunkX + viewDistance; ++ final int maxZ = chunkZ + viewDistance; ++ final int minX = chunkX - viewDistance; ++ final int minZ = chunkZ - viewDistance; ++ for (int x = minX; x <= maxX; ++x) { ++ for (int z = minZ; z <= maxZ; ++z) { ++ this.recalculateDistance(x, z); ++ } ++ } ++ } ++ ++ @Override ++ protected void updateObjectCallback(final E object, final long oldPosition, final long newPosition, final int oldViewDistance, final int newViewDistance) { ++ if (oldPosition == newPosition && newViewDistance == oldViewDistance) { ++ return; ++ } ++ ++ final int toX = MCUtil.getCoordinateX(newPosition); ++ final int toZ = MCUtil.getCoordinateZ(newPosition); ++ final int fromX = MCUtil.getCoordinateX(oldPosition); ++ final int fromZ = MCUtil.getCoordinateZ(oldPosition); ++ ++ final int totalX = IntegerUtil.branchlessAbs(fromX - toX); ++ final int totalZ = IntegerUtil.branchlessAbs(fromZ - toZ); ++ ++ if (Math.max(totalX, totalZ) > (2 * Math.max(newViewDistance, oldViewDistance))) { ++ // teleported? ++ this.removeObjectCallback(object, fromX, fromZ, oldViewDistance); ++ this.addObjectCallback(object, toX, toZ, newViewDistance); ++ return; ++ } ++ ++ final int minX = Math.min(fromX - oldViewDistance, toX - newViewDistance); ++ final int maxX = Math.max(fromX + oldViewDistance, toX + newViewDistance); ++ final int minZ = Math.min(fromZ - oldViewDistance, toZ - newViewDistance); ++ final int maxZ = Math.max(fromZ + oldViewDistance, toZ + newViewDistance); ++ ++ for (int x = minX; x <= maxX; ++x) { ++ for (int z = minZ; z <= maxZ; ++z) { ++ final int distXOld = IntegerUtil.branchlessAbs(x - fromX); ++ final int distZOld = IntegerUtil.branchlessAbs(z - fromZ); ++ ++ if (Math.max(distXOld, distZOld) <= oldViewDistance) { ++ this.recalculateDistance(x, z); ++ continue; ++ } ++ ++ final int distXNew = IntegerUtil.branchlessAbs(x - toX); ++ final int distZNew = IntegerUtil.branchlessAbs(z - toZ); ++ ++ if (Math.max(distXNew, distZNew) <= newViewDistance) { ++ this.recalculateDistance(x, z); ++ continue; ++ } ++ } ++ } ++ } ++ ++ @FunctionalInterface ++ public static interface DistanceChangeCallback { ++ ++ void accept(final int posX, final int posZ, final int oldNearestDistance, final int newNearestDistance, ++ final PooledLinkedHashSets.PooledObjectLinkedOpenHashSet state); ++ ++ } ++} diff --git a/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java b/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java new file mode 100644 -index 0000000000..8a552a87ab +index 000000000..8a552a87a --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java @@ -0,0 +0,0 @@ @@ -1479,9 +1692,39 @@ index 0000000000..8a552a87ab + return player.cachedSingleHashSet; + } +} +diff --git a/src/main/java/com/destroystokyo/paper/util/misc/PlayerDistanceTrackingAreaMap.java b/src/main/java/com/destroystokyo/paper/util/misc/PlayerDistanceTrackingAreaMap.java +new file mode 100644 +index 000000000..0292afc52 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/util/misc/PlayerDistanceTrackingAreaMap.java +@@ -0,0 +0,0 @@ ++package com.destroystokyo.paper.util.misc; ++ ++import net.minecraft.server.EntityPlayer; ++ ++public class PlayerDistanceTrackingAreaMap extends DistanceTrackingAreaMap { ++ ++ public PlayerDistanceTrackingAreaMap() { ++ super(); ++ } ++ ++ public PlayerDistanceTrackingAreaMap(final PooledLinkedHashSets pooledHashSets) { ++ super(pooledHashSets); ++ } ++ ++ public PlayerDistanceTrackingAreaMap(final PooledLinkedHashSets pooledHashSets, final ChangeCallback addCallback, ++ final ChangeCallback removeCallback, final DistanceChangeCallback distanceChangeCallback) { ++ super(pooledHashSets, addCallback, removeCallback, distanceChangeCallback); ++ } ++ ++ @Override ++ protected PooledLinkedHashSets.PooledObjectLinkedOpenHashSet getEmptySetFor(final EntityPlayer player) { ++ return player.cachedSingleHashSet; ++ } ++} diff --git a/src/main/java/com/destroystokyo/paper/util/misc/PooledLinkedHashSets.java b/src/main/java/com/destroystokyo/paper/util/misc/PooledLinkedHashSets.java new file mode 100644 -index 0000000000..5f2d88797d +index 000000000..e51104e65 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/misc/PooledLinkedHashSets.java @@ -0,0 +0,0 @@ @@ -1491,9 +1734,7 @@ index 0000000000..5f2d88797d +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; +import java.lang.ref.WeakReference; + -+/** -+ * @author Spottedleaf -+ */ ++/** @author Spottedleaf */ +public class PooledLinkedHashSets { + + /* Tested via https://gist.github.com/Spottedleaf/a93bb7a8993d6ce142d3efc5932bf573 */ @@ -1776,7 +2017,7 @@ index 0000000000..5f2d88797d +} diff --git a/src/main/java/com/destroystokyo/paper/util/set/OptimizedSmallEnumSet.java b/src/main/java/com/destroystokyo/paper/util/set/OptimizedSmallEnumSet.java new file mode 100644 -index 0000000000..9df0006c1a +index 000000000..9df0006c1 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/set/OptimizedSmallEnumSet.java @@ -0,0 +0,0 @@ @@ -1847,8 +2088,20 @@ index 0000000000..9df0006c1a + return (other.backingSet & this.backingSet) != 0; + } +} +diff --git a/src/main/java/net/minecraft/server/AxisAlignedBB.java b/src/main/java/net/minecraft/server/AxisAlignedBB.java +index 4f60b931a..f427953a8 100644 +--- a/src/main/java/net/minecraft/server/AxisAlignedBB.java ++++ b/src/main/java/net/minecraft/server/AxisAlignedBB.java +@@ -0,0 +0,0 @@ public class AxisAlignedBB { + return this.d(vec3d.x, vec3d.y, vec3d.z); + } + ++ public final boolean intersects(AxisAlignedBB axisalignedbb) { return this.c(axisalignedbb); } // Paper - OBFHELPER + public boolean c(AxisAlignedBB axisalignedbb) { + return this.a(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ, axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ); + } diff --git a/src/main/java/net/minecraft/server/BlockAccessAir.java b/src/main/java/net/minecraft/server/BlockAccessAir.java -index eff6ebcd30..30cbfc8eac 100644 +index eff6ebcd3..30cbfc8ea 100644 --- a/src/main/java/net/minecraft/server/BlockAccessAir.java +++ b/src/main/java/net/minecraft/server/BlockAccessAir.java @@ -0,0 +0,0 @@ public enum BlockAccessAir implements IBlockAccess { @@ -1871,7 +2124,7 @@ index eff6ebcd30..30cbfc8eac 100644 public IBlockData getType(BlockPosition blockposition) { return Blocks.AIR.getBlockData(); diff --git a/src/main/java/net/minecraft/server/BlockDataAbstract.java b/src/main/java/net/minecraft/server/BlockDataAbstract.java -index 1cf97cefc9..2040f18349 100644 +index 1cf97cefc..2040f1834 100644 --- a/src/main/java/net/minecraft/server/BlockDataAbstract.java +++ b/src/main/java/net/minecraft/server/BlockDataAbstract.java @@ -0,0 +0,0 @@ public abstract class BlockDataAbstract implements IBlockDataHolder { @@ -1883,7 +2136,7 @@ index 1cf97cefc9..2040f18349 100644 return this.d.containsKey(iblockstate); } diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index c88a62f6b7..5dbd3e60fe 100644 +index c88a62f6b..5dbd3e60f 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java @@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali @@ -1938,7 +2191,7 @@ index c88a62f6b7..5dbd3e60fe 100644 this.d = i; } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 55373cae07..af10c18d44 100644 +index 55373cae0..c50fe1c24 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; @@ -1975,6 +2228,88 @@ index 55373cae07..af10c18d44 100644 + // Paper start + public final com.destroystokyo.paper.util.maplist.EntityList entities = new com.destroystokyo.paper.util.maplist.EntityList(); + public PlayerChunk playerChunk; ++ ++ static final int NEIGHBOUR_CACHE_RADIUS = 3; ++ public static int getNeighbourCacheRadius() { ++ return NEIGHBOUR_CACHE_RADIUS; ++ } ++ ++ boolean loadedTicketLevel; ++ private long neighbourChunksLoadedBitset; ++ private final Chunk[] loadedNeighbourChunks = new Chunk[(NEIGHBOUR_CACHE_RADIUS * 2 + 1) * (NEIGHBOUR_CACHE_RADIUS * 2 + 1)]; ++ ++ private static int getNeighbourIndex(final int relativeX, final int relativeZ) { ++ // index = (relativeX + NEIGHBOUR_CACHE_RADIUS) + (relativeZ + NEIGHBOUR_CACHE_RADIUS) * (NEIGHBOUR_CACHE_RADIUS * 2 + 1) ++ // optimised variant of the above by moving some of the ops to compile time ++ return relativeX + (relativeZ * (NEIGHBOUR_CACHE_RADIUS * 2 + 1)) + (NEIGHBOUR_CACHE_RADIUS + NEIGHBOUR_CACHE_RADIUS * ((NEIGHBOUR_CACHE_RADIUS * 2 + 1))); ++ } ++ ++ public final Chunk getRelativeNeighbourIfLoaded(final int relativeX, final int relativeZ) { ++ return this.loadedNeighbourChunks[getNeighbourIndex(relativeX, relativeZ)]; ++ } ++ ++ public final boolean isNeighbourLoaded(final int relativeX, final int relativeZ) { ++ return (this.neighbourChunksLoadedBitset & (1L << getNeighbourIndex(relativeX, relativeZ))) != 0; ++ } ++ ++ public final void setNeighbourLoaded(final int relativeX, final int relativeZ, final Chunk chunk) { ++ if (chunk == null) { ++ throw new IllegalArgumentException("Chunk must be non-null, neighbour: (" + relativeX + "," + relativeZ + "), chunk: " + this.loc); ++ } ++ final int index = getNeighbourIndex(relativeX, relativeZ); ++ this.loadedNeighbourChunks[index] = chunk; ++ this.neighbourChunksLoadedBitset |= (1L << index); ++ } ++ ++ public final void setNeighbourUnloaded(final int relativeX, final int relativeZ) { ++ final int index = getNeighbourIndex(relativeX, relativeZ); ++ this.loadedNeighbourChunks[index] = null; ++ this.neighbourChunksLoadedBitset &= ~(1L << index); ++ } ++ ++ public final void resetNeighbours() { ++ this.neighbourChunksLoadedBitset = 0L; ++ java.util.Arrays.fill(this.loadedNeighbourChunks, null); ++ } ++ ++ public final boolean areNeighboursLoaded(final int radius) { ++ // index = relativeX + (relativeZ * (NEIGHBOUR_CACHE_RADIUS * 2 + 1)) + (NEIGHBOUR_CACHE_RADIUS + NEIGHBOUR_CACHE_RADIUS * ((NEIGHBOUR_CACHE_RADIUS * 2 + 1))) ++ switch (radius) { ++ case 0: { ++ return this.loadedTicketLevel; ++ } ++ case 1: { ++ long mask = 0L; ++ for (int dx = -1; dx <= 1; ++dx) { ++ for (int dz = -1; dz <= 1; ++dz) { ++ mask |= (1L << getNeighbourIndex(dx, dz)); ++ } ++ } ++ return (this.neighbourChunksLoadedBitset & mask) == mask; ++ } ++ case 2: { ++ long mask = 0L; ++ for (int dx = -2; dx <= 2; ++dx) { ++ for (int dz = -2; dz <= 2; ++dz) { ++ mask |= (1L << getNeighbourIndex(dx, dz)); ++ } ++ } ++ return (this.neighbourChunksLoadedBitset & mask) == mask; ++ } ++ case 3: { ++ long mask = 0L; ++ for (int dx = -3; dx <= 3; ++dx) { ++ for (int dz = -3; dz <= 3; ++dz) { ++ mask |= (1L << getNeighbourIndex(dx, dz)); ++ } ++ } ++ return (this.neighbourChunksLoadedBitset & mask) == mask; ++ } ++ ++ default: ++ throw new IllegalArgumentException("Radius not recognized: " + radius); ++ } ++ } + // Paper end + public Chunk(World world, ProtoChunk protochunk) { @@ -2024,8 +2359,26 @@ index 55373cae07..af10c18d44 100644 public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) { // CraftBukkit start @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + // CraftBukkit start public void loadCallback() { ++ // Paper start - neighbour cache ++ int chunkX = this.loc.x; ++ int chunkZ = this.loc.z; ++ ChunkProviderServer chunkProvider = ((WorldServer)this.world).getChunkProvider(); ++ for (int dx = -NEIGHBOUR_CACHE_RADIUS; dx <= NEIGHBOUR_CACHE_RADIUS; ++dx) { ++ for (int dz = -NEIGHBOUR_CACHE_RADIUS; dz <= NEIGHBOUR_CACHE_RADIUS; ++dz) { ++ Chunk neighbour = chunkProvider.getChunkAtIfLoadedMainThreadNoCache(chunkX + dx, chunkZ + dz); ++ if (neighbour != null) { ++ neighbour.setNeighbourLoaded(-dx, -dz, this); ++ // should be in cached already ++ this.setNeighbourLoaded(dx, dz, neighbour); ++ } ++ } ++ } ++ this.setNeighbourLoaded(0, 0, this); ++ this.loadedTicketLevel = true; ++ // Paper end - neighbour cache org.bukkit.Server server = this.world.getServer(); + ((WorldServer)this.world).getChunkProvider().addLoadedChunk(this); // Paper if (server != null) { @@ -2036,11 +2389,26 @@ index 55373cae07..af10c18d44 100644 // note: saving can be prevented, but not forced if no saving is actually required this.mustNotSave = !unloadEvent.isSaveChunk(); + ((WorldServer)this.world).getChunkProvider().removeLoadedChunk(this); // Paper ++ // Paper start - neighbour cache ++ int chunkX = this.loc.x; ++ int chunkZ = this.loc.z; ++ ChunkProviderServer chunkProvider = ((WorldServer)this.world).getChunkProvider(); ++ for (int dx = -NEIGHBOUR_CACHE_RADIUS; dx <= NEIGHBOUR_CACHE_RADIUS; ++dx) { ++ for (int dz = -NEIGHBOUR_CACHE_RADIUS; dz <= NEIGHBOUR_CACHE_RADIUS; ++dz) { ++ Chunk neighbour = chunkProvider.getChunkAtIfLoadedMainThreadNoCache(chunkX + dx, chunkZ + dz); ++ if (neighbour != null) { ++ neighbour.setNeighbourUnloaded(-dx, -dz); ++ } ++ } ++ } ++ this.loadedTicketLevel = false; ++ this.resetNeighbours(); ++ // Paper end } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/ChunkCache.java b/src/main/java/net/minecraft/server/ChunkCache.java -index 11c4d23ba9..53c15c1c0b 100644 +index 11c4d23ba..53c15c1c0 100644 --- a/src/main/java/net/minecraft/server/ChunkCache.java +++ b/src/main/java/net/minecraft/server/ChunkCache.java @@ -0,0 +0,0 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess { @@ -2074,7 +2442,7 @@ index 11c4d23ba9..53c15c1c0b 100644 @Override public TileEntity getTileEntity(BlockPosition blockposition) { diff --git a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java -index 260644bf0b..f2a19acd84 100644 +index 260644bf0..f2a19acd8 100644 --- a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java +++ b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java @@ -0,0 +0,0 @@ public class ChunkCoordIntPair { @@ -2089,7 +2457,7 @@ index 260644bf0b..f2a19acd84 100644 } diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 32c496fa88..2b0ad4226e 100644 +index 32c496fa8..2b0ad4226 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { @@ -2241,7 +2609,7 @@ index 32c496fa88..2b0ad4226e 100644 @Override public IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag) { diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java -index 7ca3a1d0c5..2edd9b8714 100644 +index 7ca3a1d0c..2edd9b871 100644 --- a/src/main/java/net/minecraft/server/DataBits.java +++ b/src/main/java/net/minecraft/server/DataBits.java @@ -0,0 +0,0 @@ public class DataBits { @@ -2253,7 +2621,7 @@ index 7ca3a1d0c5..2edd9b8714 100644 return this.a; } diff --git a/src/main/java/net/minecraft/server/DataPalette.java b/src/main/java/net/minecraft/server/DataPalette.java -index 75ba698868..45403fbe30 100644 +index 75ba69886..45403fbe3 100644 --- a/src/main/java/net/minecraft/server/DataPalette.java +++ b/src/main/java/net/minecraft/server/DataPalette.java @@ -0,0 +0,0 @@ import javax.annotation.Nullable; @@ -2270,7 +2638,7 @@ index 75ba698868..45403fbe30 100644 T a(int i); diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java -index 774a8f5434..d5f5a51872 100644 +index 774a8f543..d5f5a5187 100644 --- a/src/main/java/net/minecraft/server/DataPaletteBlock.java +++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java @@ -0,0 +0,0 @@ import java.util.stream.Collectors; @@ -2312,7 +2680,7 @@ index 774a8f5434..d5f5a51872 100644 this.a(); packetdataserializer.writeByte(this.i); diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java -index fe69161e5b..b40c8d2f83 100644 +index fe69161e5..b40c8d2f8 100644 --- a/src/main/java/net/minecraft/server/EntityCreature.java +++ b/src/main/java/net/minecraft/server/EntityCreature.java @@ -0,0 +0,0 @@ import org.bukkit.event.entity.EntityUnleashEvent; @@ -2325,7 +2693,7 @@ index fe69161e5b..b40c8d2f83 100644 super(entitytypes, world); } diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index bdfb173853..0b06fa2b66 100644 +index bdfb17385..0b06fa2b6 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { @@ -2337,7 +2705,7 @@ index bdfb173853..0b06fa2b66 100644 // CraftBukkit start - fire event setGoalTarget(entityliving, EntityTargetEvent.TargetReason.UNKNOWN, true); diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 3b1bcf3495..1f350e3352 100644 +index 3b1bcf349..1f350e335 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { @@ -2349,7 +2717,7 @@ index 3b1bcf3495..1f350e3352 100644 @Override public float getBukkitYaw() { diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java -index 00c3b666d7..e5322fbae5 100644 +index 00c3b666d..e5322fbae 100644 --- a/src/main/java/net/minecraft/server/EntityMonster.java +++ b/src/main/java/net/minecraft/server/EntityMonster.java @@ -0,0 +0,0 @@ import java.util.function.Predicate; @@ -2361,7 +2729,7 @@ index 00c3b666d7..e5322fbae5 100644 super(entitytypes, world); this.f = 5; diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index ce48210922..57ce9bde64 100644 +index ce4821092..57ce9bde6 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @@ -2383,7 +2751,7 @@ index ce48210922..57ce9bde64 100644 this.displayName = this.getName(); this.canPickUpLoot = true; diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index 29e776ca19..4328273b1f 100644 +index 29e776ca1..4328273b1 100644 --- a/src/main/java/net/minecraft/server/EntityTypes.java +++ b/src/main/java/net/minecraft/server/EntityTypes.java @@ -0,0 +0,0 @@ import com.mojang.datafixers.DataFixUtils; @@ -2406,7 +2774,7 @@ index 29e776ca19..4328273b1f 100644 } diff --git a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -index 1890c760f9..7e5ece9d50 100644 +index 1890c760f..7e5ece9d5 100644 --- a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java +++ b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java @@ -0,0 +0,0 @@ public abstract class IAsyncTaskHandler implements Mailbox h = new CompletableFuture(); diff --git a/src/main/java/net/minecraft/server/IWorldReader.java b/src/main/java/net/minecraft/server/IWorldReader.java -index ba315131e1..cbe2aa4c0a 100644 +index ba315131e..cbe2aa4c0 100644 --- a/src/main/java/net/minecraft/server/IWorldReader.java +++ b/src/main/java/net/minecraft/server/IWorldReader.java @@ -0,0 +0,0 @@ import javax.annotation.Nullable; @@ -2480,7 +2848,7 @@ index ba315131e1..cbe2aa4c0a 100644 IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag); diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index 75308712d0..aa7501d366 100644 +index 75308712d..aa7501d36 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -0,0 +0,0 @@ import org.bukkit.event.world.StructureGrowEvent; @@ -2540,7 +2908,7 @@ index 75308712d0..aa7501d366 100644 // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java new file mode 100644 -index 0000000000..de2bc8f6a6 +index 000000000..54c34cc2d --- /dev/null +++ b/src/main/java/net/minecraft/server/MCUtil.java @@ -0,0 +0,0 @@ @@ -2570,12 +2938,18 @@ index 0000000000..de2bc8f6a6 + + public static final long INVALID_CHUNK_KEY = getCoordinateKey(Integer.MAX_VALUE, Integer.MAX_VALUE); + ++ public static void ensureTickThread(final String reason) { ++ if (MinecraftServer.getServer().serverThread != Thread.currentThread()) { ++ throw new IllegalStateException(reason); ++ } ++ } ++ + public static long getCoordinateKey(final BlockPosition blockPos) { -+ return getCoordinateKey(blockPos.getX() >> 4, blockPos.getZ() >> 4); ++ return ((long)(blockPos.getZ() >> 4) << 32) | ((blockPos.getX() >> 4) & 0xFFFFFFFFL); + } + + public static long getCoordinateKey(final Entity entity) { -+ return getCoordinateKey(getChunkCoordinate(entity.locX()), getChunkCoordinate(entity.locZ())); ++ return ((long)(MCUtil.fastFloor(entity.locZ()) >> 4) << 32) | ((MCUtil.fastFloor(entity.locX()) >> 4) & 0xFFFFFFFFL); + } + + public static int fastFloor(double x) { @@ -2589,7 +2963,7 @@ index 0000000000..de2bc8f6a6 + } + + public static long getCoordinateKey(final ChunkCoordIntPair pair) { -+ return getCoordinateKey(pair.x, pair.z); ++ return ((long)pair.z << 32) | (pair.x & 0xFFFFFFFFL); + } + + public static long getCoordinateKey(final int x, final int z) { @@ -2617,7 +2991,7 @@ index 0000000000..de2bc8f6a6 + } + + public static long getBlockKey(final BlockPosition pos) { -+ return getBlockKey(pos.getX(), pos.getY(), pos.getZ()); ++ return ((long)pos.getX() & 0x7FFFFFF) | (((long)pos.getZ() & 0x7FFFFFF) << 27) | ((long)pos.getY() << 54); + } + + public static long getBlockKey(final Entity entity) { @@ -2929,7 +3303,7 @@ index 0000000000..de2bc8f6a6 + } +} diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java -index e85b24a327..75604dbc69 100644 +index e85b24a32..75604dbc6 100644 --- a/src/main/java/net/minecraft/server/NBTTagCompound.java +++ b/src/main/java/net/minecraft/server/NBTTagCompound.java @@ -0,0 +0,0 @@ public class NBTTagCompound implements NBTBase { @@ -2958,7 +3332,7 @@ index e85b24a327..75604dbc69 100644 return new UUID(this.getLong(s + "Most"), this.getLong(s + "Least")); } diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 6700582e36..3ccf166366 100644 +index 6700582e3..3ccf16636 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler> { @@ -2990,7 +3364,7 @@ index 6700582e36..3ccf166366 100644 public QueuedPacket(Packet packet, @Nullable GenericFutureListener> genericfuturelistener) { this.a = packet; diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java -index 81b6f4581f..d9574a9ace 100644 +index 81b6f4581..d9574a9ac 100644 --- a/src/main/java/net/minecraft/server/PacketDataSerializer.java +++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java @@ -0,0 +0,0 @@ public class PacketDataSerializer extends ByteBuf { @@ -3002,7 +3376,7 @@ index 81b6f4581f..d9574a9ace 100644 for (int j = 1; j < 5; ++j) { if ((i & -1 << j * 7) == 0) { diff --git a/src/main/java/net/minecraft/server/PacketEncoder.java b/src/main/java/net/minecraft/server/PacketEncoder.java -index 90223deae3..63c4dbd327 100644 +index 90223deae..63c4dbd32 100644 --- a/src/main/java/net/minecraft/server/PacketEncoder.java +++ b/src/main/java/net/minecraft/server/PacketEncoder.java @@ -0,0 +0,0 @@ public class PacketEncoder extends MessageToByteEncoder> { @@ -3014,7 +3388,7 @@ index 90223deae3..63c4dbd327 100644 throw new SkipEncodeException(throwable); } else { diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -index 677e3e5f68..3a1d0deb0d 100644 +index 677e3e5f6..3a1d0deb0 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java @@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet { @@ -3035,7 +3409,7 @@ index 677e3e5f68..3a1d0deb0d 100644 int j = 0; ChunkSection[] achunksection = chunk.getSections(); diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 5c5bf010d0..c4bbee7d6a 100644 +index 5c5bf010d..c4bbee7d6 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java @@ -0,0 +0,0 @@ public class PlayerChunk { @@ -3207,7 +3581,7 @@ index 5c5bf010d0..c4bbee7d6a 100644 } diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 7ad30548e2..93d838ec2d 100644 +index 7ad30548e..93d838ec2 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -3256,7 +3630,7 @@ index 7ad30548e2..93d838ec2d 100644 @Override diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 0c496ee0a0..6a681d694e 100644 +index 0c496ee0a..6a681d694 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -3273,7 +3647,7 @@ index 0c496ee0a0..6a681d694e 100644 private volatile int chatThrottle; private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle"); diff --git a/src/main/java/net/minecraft/server/PlayerInventory.java b/src/main/java/net/minecraft/server/PlayerInventory.java -index 08768a3c87..d103cfaace 100644 +index 08768a3c8..d103cfaac 100644 --- a/src/main/java/net/minecraft/server/PlayerInventory.java +++ b/src/main/java/net/minecraft/server/PlayerInventory.java @@ -0,0 +0,0 @@ public class PlayerInventory implements IInventory, INamableTileEntity { @@ -3286,7 +3660,7 @@ index 08768a3c87..d103cfaace 100644 public final EntityHuman player; private ItemStack carried; diff --git a/src/main/java/net/minecraft/server/PotionUtil.java b/src/main/java/net/minecraft/server/PotionUtil.java -index b3824898da..bf4172be52 100644 +index b3824898d..bf4172be5 100644 --- a/src/main/java/net/minecraft/server/PotionUtil.java +++ b/src/main/java/net/minecraft/server/PotionUtil.java @@ -0,0 +0,0 @@ public class PotionUtil { @@ -3298,7 +3672,7 @@ index b3824898da..bf4172be52 100644 MinecraftKey minecraftkey = IRegistry.POTION.getKey(potionregistry); diff --git a/src/main/java/net/minecraft/server/ProtoChunk.java b/src/main/java/net/minecraft/server/ProtoChunk.java -index 6e65306a27..39339fa275 100644 +index 6e65306a2..39339fa27 100644 --- a/src/main/java/net/minecraft/server/ProtoChunk.java +++ b/src/main/java/net/minecraft/server/ProtoChunk.java @@ -0,0 +0,0 @@ public class ProtoChunk implements IChunkAccess { @@ -3321,7 +3695,7 @@ index 6e65306a27..39339fa275 100644 public IBlockData getType(BlockPosition blockposition) { int i = blockposition.getY(); diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index 7b6e0e86b0..187c4e0f58 100644 +index 7b6e0e86b..187c4e0f5 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java @@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable { @@ -3333,7 +3707,7 @@ index 7b6e0e86b0..187c4e0f58 100644 public synchronized DataInputStream a(ChunkCoordIntPair chunkcoordintpair) throws IOException { int i = this.getOffset(chunkcoordintpair); diff --git a/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java b/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java -index 8c123f265e..9d0e8c2d43 100644 +index 8c123f265..9d0e8c2d4 100644 --- a/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java +++ b/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java @@ -0,0 +0,0 @@ public class RegionLimitedWorldAccess implements GeneratorAccess { @@ -3364,7 +3738,7 @@ index 8c123f265e..9d0e8c2d43 100644 public IBlockData getType(BlockPosition blockposition) { return this.getChunkAt(blockposition.getX() >> 4, blockposition.getZ() >> 4).getType(blockposition); diff --git a/src/main/java/net/minecraft/server/RegistryBlockID.java b/src/main/java/net/minecraft/server/RegistryBlockID.java -index 4efcb8b595..60948afa4e 100644 +index 4efcb8b59..60948afa4 100644 --- a/src/main/java/net/minecraft/server/RegistryBlockID.java +++ b/src/main/java/net/minecraft/server/RegistryBlockID.java @@ -0,0 +0,0 @@ public class RegistryBlockID implements Registry { @@ -3376,7 +3750,7 @@ index 4efcb8b595..60948afa4e 100644 return this.b.size(); } diff --git a/src/main/java/net/minecraft/server/SystemUtils.java b/src/main/java/net/minecraft/server/SystemUtils.java -index 7b92ecfff9..7e224ebeff 100644 +index 7b92ecfff..7e224ebef 100644 --- a/src/main/java/net/minecraft/server/SystemUtils.java +++ b/src/main/java/net/minecraft/server/SystemUtils.java @@ -0,0 +0,0 @@ public class SystemUtils { @@ -3389,7 +3763,7 @@ index 7b92ecfff9..7e224ebeff 100644 public static long getTimeMillis() { diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 2e1eabba14..2a4fa455ff 100644 +index 2e1eabba1..2a4fa455f 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.SpigotTimings; // Spigot @@ -3453,7 +3827,7 @@ index 2e1eabba14..2a4fa455ff 100644 return this.setTypeAndData(blockposition, fluid.getBlockData(), 3 | (flag ? 64 : 0)); diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index d5014abc9d..8a5ac6f69b 100644 +index d5014abc9..8a5ac6f69 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World { @@ -3473,7 +3847,7 @@ index d5014abc9d..8a5ac6f69b 100644 this.getScoreboard().a(entity); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -index e181df6f4d..4a9132c701 100644 +index e181df6f4..4a9132c70 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -0,0 +0,0 @@ public final class CraftItemStack extends ItemStack { @@ -3485,7 +3859,7 @@ index e181df6f4d..4a9132c701 100644 /** * Mirror diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java -index d8358a0f03..d0b813008c 100644 +index d8358a0f0..d0b813008 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java +++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java @@ -0,0 +0,0 @@ public class DummyGeneratorAccess implements GeneratorAccess { @@ -3512,7 +3886,7 @@ index d8358a0f03..d0b813008c 100644 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/util/UnsafeList.java b/src/main/java/org/bukkit/craftbukkit/util/UnsafeList.java -index 1aec70a1f1..f72c13beda 100644 +index 1aec70a1f..f72c13bed 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/UnsafeList.java +++ b/src/main/java/org/bukkit/craftbukkit/util/UnsafeList.java @@ -0,0 +0,0 @@ import java.util.RandomAccess; diff --git a/Spigot-Server-Patches/Mark-chunk-dirty-anytime-entities-change-to-guarante.patch b/Spigot-Server-Patches/Mark-chunk-dirty-anytime-entities-change-to-guarante.patch index 389cf792e0..4f2fd98f92 100644 --- a/Spigot-Server-Patches/Mark-chunk-dirty-anytime-entities-change-to-guarante.patch +++ b/Spigot-Server-Patches/Mark-chunk-dirty-anytime-entities-change-to-guarante.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Mark chunk dirty anytime entities change to guarantee it diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 3af311c6eb..68cde33565 100644 +index bb58fb796..54d48ef5e 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { diff --git a/Spigot-Server-Patches/Optimise-Chunk-getFluid.patch b/Spigot-Server-Patches/Optimise-Chunk-getFluid.patch index af7138946a..af7a306914 100644 --- a/Spigot-Server-Patches/Optimise-Chunk-getFluid.patch +++ b/Spigot-Server-Patches/Optimise-Chunk-getFluid.patch @@ -8,7 +8,7 @@ faster on its own, however removing the try catch makes it easier to inline due to code size diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 971c0315d5..2b0e431874 100644 +index 92bb009b8..719c6f3e7 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { @@ -48,7 +48,7 @@ index 971c0315d5..2b0e431874 100644 // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index 8b28fb5ee1..426221f7c3 100644 +index 8b28fb5ee..426221f7c 100644 --- a/src/main/java/net/minecraft/server/ChunkSection.java +++ b/src/main/java/net/minecraft/server/ChunkSection.java @@ -0,0 +0,0 @@ public class ChunkSection { diff --git a/Spigot-Server-Patches/Optimise-random-block-ticking.patch b/Spigot-Server-Patches/Optimise-random-block-ticking.patch index b1a3432922..0c41a7f646 100644 --- a/Spigot-Server-Patches/Optimise-random-block-ticking.patch +++ b/Spigot-Server-Patches/Optimise-random-block-ticking.patch @@ -20,7 +20,7 @@ remains the same. diff --git a/src/main/java/com/destroystokyo/paper/util/math/ThreadUnsafeRandom.java b/src/main/java/com/destroystokyo/paper/util/math/ThreadUnsafeRandom.java new file mode 100644 -index 0000000000..3edc8e52e0 +index 000000000..3edc8e52e --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/math/ThreadUnsafeRandom.java @@ -0,0 +0,0 @@ @@ -71,7 +71,7 @@ index 0000000000..3edc8e52e0 + } +} diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index e29ec958b3..e40375b67a 100644 +index e29ec958b..e40375b67 100644 --- a/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java @@ -0,0 +0,0 @@ public class Block implements IMaterial { @@ -86,7 +86,7 @@ index e29ec958b3..e40375b67a 100644 } diff --git a/src/main/java/net/minecraft/server/BlockFluids.java b/src/main/java/net/minecraft/server/BlockFluids.java -index 6d351f0979..a44f65f40d 100644 +index 6d351f097..a44f65f40 100644 --- a/src/main/java/net/minecraft/server/BlockFluids.java +++ b/src/main/java/net/minecraft/server/BlockFluids.java @@ -0,0 +0,0 @@ public class BlockFluids extends Block implements IFluidSource { @@ -99,7 +99,7 @@ index 6d351f0979..a44f65f40d 100644 @Override diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index e76528f199..e650a2e48d 100644 +index e76528f19..e650a2e48 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java @@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali @@ -111,7 +111,7 @@ index e76528f199..e650a2e48d 100644 return this.d(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ()); } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 38ab4197b2..971c0315d5 100644 +index 03c25eae7..92bb009b8 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { @@ -154,7 +154,7 @@ index 38ab4197b2..971c0315d5 100644 } diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index 4526527aca..8b28fb5ee1 100644 +index 4526527ac..8b28fb5ee 100644 --- a/src/main/java/net/minecraft/server/ChunkSection.java +++ b/src/main/java/net/minecraft/server/ChunkSection.java @@ -0,0 +0,0 @@ import javax.annotation.Nullable; @@ -259,7 +259,7 @@ index 4526527aca..8b28fb5ee1 100644 } diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java -index f9680b6830..a61cffa3f4 100644 +index f9680b683..a61cffa3f 100644 --- a/src/main/java/net/minecraft/server/DataBits.java +++ b/src/main/java/net/minecraft/server/DataBits.java @@ -0,0 +0,0 @@ public class DataBits { @@ -310,7 +310,7 @@ index f9680b6830..a61cffa3f4 100644 + // Paper end } diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java -index 44aed67274..fa664897fb 100644 +index 44aed6727..fa664897f 100644 --- a/src/main/java/net/minecraft/server/DataPaletteBlock.java +++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java @@ -0,0 +0,0 @@ public class DataPaletteBlock implements DataPaletteExpandable { @@ -329,7 +329,7 @@ index 44aed67274..fa664897fb 100644 public interface a { diff --git a/src/main/java/net/minecraft/server/EntityTurtle.java b/src/main/java/net/minecraft/server/EntityTurtle.java -index dd02cb3485..b24a5100b4 100644 +index dd02cb348..b24a5100b 100644 --- a/src/main/java/net/minecraft/server/EntityTurtle.java +++ b/src/main/java/net/minecraft/server/EntityTurtle.java @@ -0,0 +0,0 @@ public class EntityTurtle extends EntityAnimal { @@ -342,7 +342,7 @@ index dd02cb3485..b24a5100b4 100644 public final BlockPosition getHome() { return this.es(); } // Paper - OBFHELPER diff --git a/src/main/java/net/minecraft/server/IBlockData.java b/src/main/java/net/minecraft/server/IBlockData.java -index de43881653..e821c236b4 100644 +index de4388165..e821c236b 100644 --- a/src/main/java/net/minecraft/server/IBlockData.java +++ b/src/main/java/net/minecraft/server/IBlockData.java @@ -0,0 +0,0 @@ public class IBlockData extends BlockDataAbstract implements @@ -395,7 +395,7 @@ index de43881653..e821c236b4 100644 public final SoundEffectType getStepSound() { return this.r(); } // Paper - OBFHELPER diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 28b6c9a083..d554d4cf0f 100644 +index 28b6c9a08..d554d4cf0 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -420,7 +420,7 @@ index 28b6c9a083..d554d4cf0f 100644 public boolean isSavingDisabled() { diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 9211f996c0..eb99819e51 100644 +index dd4802095..b95dd3a92 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World { diff --git a/Spigot-Server-Patches/Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch b/Spigot-Server-Patches/Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch index 752a07e5d4..cc10d0a540 100644 --- a/Spigot-Server-Patches/Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch +++ b/Spigot-Server-Patches/Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch @@ -13,7 +13,7 @@ This should result in siginificant memory use reduction and improved GC behavior diff --git a/src/main/java/com/destroystokyo/paper/util/map/Long2ObjectLinkedOpenHashMapFastCopy.java b/src/main/java/com/destroystokyo/paper/util/map/Long2ObjectLinkedOpenHashMapFastCopy.java new file mode 100644 -index 0000000000..e0ad725b2e +index 000000000..e0ad725b2 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/map/Long2ObjectLinkedOpenHashMapFastCopy.java @@ -0,0 +0,0 @@ @@ -50,7 +50,7 @@ index 0000000000..e0ad725b2e + } +} diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 1dcd0980ec..e627440c41 100644 +index 1dcd0980e..e627440c4 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { @@ -63,7 +63,7 @@ index 1dcd0980ec..e627440c41 100644 if (optional.isPresent()) { diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index b9d5844520..9980e4c277 100644 +index 786e6c976..ffaf496ee 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java @@ -0,0 +0,0 @@ public final class MCUtil { @@ -76,7 +76,7 @@ index b9d5844520..9980e4c277 100644 List allChunks = new ArrayList<>(visibleChunks.values()); List players = world.players; diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index e1e4ea793a..e61ddeb1ff 100644 +index e1e4ea793..e61ddeb1f 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -213,7 +213,7 @@ index e1e4ea793a..e61ddeb1ff 100644 while (objectbidirectionaliterator.hasNext()) { Entry entry = (Entry) objectbidirectionaliterator.next(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 051506fce8..630d6470a4 100644 +index 051506fce..630d6470a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -0,0 +0,0 @@ import net.minecraft.server.GameRules; diff --git a/Spigot-Server-Patches/Optimize-isValidLocation-getType-and-getBlockData-fo.patch b/Spigot-Server-Patches/Optimize-isValidLocation-getType-and-getBlockData-fo.patch index c5945d185c..763fae7b3c 100644 --- a/Spigot-Server-Patches/Optimize-isValidLocation-getType-and-getBlockData-fo.patch +++ b/Spigot-Server-Patches/Optimize-isValidLocation-getType-and-getBlockData-fo.patch @@ -12,7 +12,7 @@ Replace all calls to the new place to the unnecessary forward. Optimize getType and getBlockData to manually inline and optimize the calls diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java -index a3b5793e48..71089442c1 100644 +index a3b5793e4..71089442c 100644 --- a/src/main/java/net/minecraft/server/BaseBlockPosition.java +++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java @@ -0,0 +0,0 @@ public class BaseBlockPosition implements Comparable { @@ -31,7 +31,7 @@ index a3b5793e48..71089442c1 100644 public BaseBlockPosition(int i, int j, int k) { this.a = i; diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index f3d20f214d..ee94f59e64 100644 +index ac11e214b..6e50efbf6 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { @@ -64,7 +64,7 @@ index f3d20f214d..ee94f59e64 100644 IBlockData iblockdata = null; diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index 652067757a..0d5deee365 100644 +index 652067757..0d5deee36 100644 --- a/src/main/java/net/minecraft/server/ChunkSection.java +++ b/src/main/java/net/minecraft/server/ChunkSection.java @@ -0,0 +0,0 @@ public class ChunkSection { @@ -77,7 +77,7 @@ index 652067757a..0d5deee365 100644 public ChunkSection(int i) { this(i, (short) 0, (short) 0, (short) 0); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index c2039d0e46..502da7f52d 100644 +index e7337fc36..6b1ff8f64 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { diff --git a/Spigot-Server-Patches/Option-to-remove-corrupt-tile-entities.patch b/Spigot-Server-Patches/Option-to-remove-corrupt-tile-entities.patch index 171994e11b..fd418a68cc 100644 --- a/Spigot-Server-Patches/Option-to-remove-corrupt-tile-entities.patch +++ b/Spigot-Server-Patches/Option-to-remove-corrupt-tile-entities.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Option to remove corrupt tile entities diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 8cf3076f4e..721eceeffc 100644 +index 8cf3076f4..721eceeff 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -19,7 +19,7 @@ index 8cf3076f4e..721eceeffc 100644 + } } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 4fe36bb71d..3af311c6eb 100644 +index 8963acb9f..bb58fb796 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { diff --git a/Spigot-Server-Patches/Remove-invalid-mob-spawner-tile-entities.patch b/Spigot-Server-Patches/Remove-invalid-mob-spawner-tile-entities.patch index affa35cf13..20bcd33772 100644 --- a/Spigot-Server-Patches/Remove-invalid-mob-spawner-tile-entities.patch +++ b/Spigot-Server-Patches/Remove-invalid-mob-spawner-tile-entities.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Remove invalid mob spawner tile entities diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 0b32179b79..9adb212790 100644 +index 87c5e09a5..14097d40d 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { diff --git a/Spigot-Server-Patches/Store-counts-for-each-Entity-Block-Entity-Type.patch b/Spigot-Server-Patches/Store-counts-for-each-Entity-Block-Entity-Type.patch index ba2380e4f2..43a4829bf6 100644 --- a/Spigot-Server-Patches/Store-counts-for-each-Entity-Block-Entity-Type.patch +++ b/Spigot-Server-Patches/Store-counts-for-each-Entity-Block-Entity-Type.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Store counts for each Entity/Block Entity Type Opens door for future patches to optimize performance diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 02b142fe8b..e58dd3e6df 100644 +index 061384b01..2b6fe2e01 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { diff --git a/Spigot-Server-Patches/Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch b/Spigot-Server-Patches/Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch index 89aa1ada90..f6c607913e 100644 --- a/Spigot-Server-Patches/Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch +++ b/Spigot-Server-Patches/Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch @@ -8,7 +8,7 @@ This enables us a fast reference to the entities current chunk instead of having to look it up by hashmap lookups. diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index af10c18d44..02b142fe8b 100644 +index c50fe1c24..061384b01 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { @@ -89,7 +89,7 @@ index af10c18d44..02b142fe8b 100644 } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 7899fd6d88..2890e8121d 100644 +index 7899fd6d8..2890e8121 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -155,7 +155,7 @@ index 7899fd6d88..2890e8121d 100644 private String entityKeyString; diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 9071bb7ece..820180ab3f 100644 +index 9071bb7ec..820180ab3 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java @@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject { // Paper @@ -175,7 +175,7 @@ index 9071bb7ece..820180ab3f 100644 @Nullable diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 63ecbcd47a..c82c213260 100644 +index 63ecbcd47..c82c21326 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -0,0 +0,0 @@ import net.minecraft.server.EntityZombieVillager; diff --git a/Spigot-Server-Patches/String-based-Action-Bar-API.patch b/Spigot-Server-Patches/String-based-Action-Bar-API.patch index 656844a541..1618c8bb66 100644 --- a/Spigot-Server-Patches/String-based-Action-Bar-API.patch +++ b/Spigot-Server-Patches/String-based-Action-Bar-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] String based Action Bar API diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index de2bc8f6a6..e42dc05504 100644 +index 54c34cc2d..cc495020e 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java @@ -0,0 +0,0 @@ package net.minecraft.server; @@ -42,7 +42,7 @@ index de2bc8f6a6..e42dc05504 100644 public static boolean isMainThread() { return MinecraftServer.getServer().isMainThread(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 060a21840f..d1745c4e93 100644 +index 060a21840..d1745c4e9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/Spigot-Server-Patches/Timings-v2.patch b/Spigot-Server-Patches/Timings-v2.patch index ca2175fc08..a98a92ff45 100644 --- a/Spigot-Server-Patches/Timings-v2.patch +++ b/Spigot-Server-Patches/Timings-v2.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Timings v2 diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java new file mode 100644 -index 0000000000..69e26a8267 +index 000000000..69e26a826 --- /dev/null +++ b/src/main/java/co/aikar/timings/MinecraftTimings.java @@ -0,0 +0,0 @@ @@ -153,7 +153,7 @@ index 0000000000..69e26a8267 +} diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java new file mode 100644 -index 0000000000..27ce4a828e +index 000000000..27ce4a828 --- /dev/null +++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java @@ -0,0 +0,0 @@ @@ -284,7 +284,7 @@ index 0000000000..27ce4a828e + } +} diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index b6d470e594..f402a29b09 100644 +index b6d470e59..f402a29b0 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -0,0 +0,0 @@ import java.util.concurrent.TimeUnit; @@ -331,7 +331,7 @@ index b6d470e594..f402a29b09 100644 + } } diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index cd72a9c845..5de881371a 100644 +index cd72a9c84..5de881371 100644 --- a/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java @@ -0,0 +0,0 @@ public class Block implements IMaterial { @@ -351,7 +351,7 @@ index cd72a9c845..5de881371a 100644 private final float frictionFactor; private final float f; diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index e58dd3e6df..0b32179b79 100644 +index 2b6fe2e01..87c5e09a5 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { @@ -371,7 +371,7 @@ index e58dd3e6df..0b32179b79 100644 } } diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 2b0ad4226e..a878f7c759 100644 +index 2b0ad4226..a878f7c75 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { @@ -468,7 +468,7 @@ index 2b0ad4226e..a878f7c759 100644 @Override diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index e16d30f2ca..4af5a230ba 100644 +index e16d30f2c..4af5a230b 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -0,0 +0,0 @@ @@ -506,7 +506,7 @@ index e16d30f2ca..4af5a230ba 100644 } diff --git a/src/main/java/net/minecraft/server/CustomFunction.java b/src/main/java/net/minecraft/server/CustomFunction.java -index 8d7a6d2403..707bd2600d 100644 +index 8d7a6d240..707bd2600 100644 --- a/src/main/java/net/minecraft/server/CustomFunction.java +++ b/src/main/java/net/minecraft/server/CustomFunction.java @@ -0,0 +0,0 @@ public class CustomFunction { @@ -533,7 +533,7 @@ index 8d7a6d2403..707bd2600d 100644 return this.b; } diff --git a/src/main/java/net/minecraft/server/CustomFunctionData.java b/src/main/java/net/minecraft/server/CustomFunctionData.java -index ba40d5fbb5..ee42e1dfa4 100644 +index ba40d5fbb..ee42e1dfa 100644 --- a/src/main/java/net/minecraft/server/CustomFunctionData.java +++ b/src/main/java/net/minecraft/server/CustomFunctionData.java @@ -0,0 +0,0 @@ public class CustomFunctionData implements IResourcePackListener { @@ -546,7 +546,7 @@ index ba40d5fbb5..ee42e1dfa4 100644 int k = 0; CustomFunction.c[] acustomfunction_c = customfunction.b(); diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 9eed98e379..d6646d7e61 100644 +index 9eed98e37..d6646d7e6 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -0,0 +0,0 @@ import java.util.List; @@ -634,7 +634,7 @@ index 9eed98e379..d6646d7e61 100644 } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 2890e8121d..e9d0a4eb90 100644 +index 2890e8121..e9d0a4eb9 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -0,0 +0,0 @@ import org.bukkit.command.CommandSender; @@ -673,7 +673,7 @@ index 2890e8121d..e9d0a4eb90 100644 protected BlockPosition ag() { diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 1f350e3352..35e3f1c78d 100644 +index 1f350e335..35e3f1c78 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ import org.bukkit.event.entity.EntityTeleportEvent; @@ -749,7 +749,7 @@ index 1f350e3352..35e3f1c78d 100644 } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index b4a0bd7951..4dc6917759 100644 +index b4a0bd795..4dc691775 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.CraftServer; @@ -925,7 +925,7 @@ index b4a0bd7951..4dc6917759 100644 this.methodProfiler.exit(); } diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 93d838ec2d..2a6955f855 100644 +index 93d838ec2..2a6955f85 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -0,0 +0,0 @@ @@ -1008,7 +1008,7 @@ index 93d838ec2d..2a6955f855 100644 protected void broadcast(Entity entity, Packet packet) { diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 6a681d694e..914366afcd 100644 +index 6a681d694..914366afc 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -0,0 +0,0 @@ import org.bukkit.inventory.CraftingInventory; @@ -1063,7 +1063,7 @@ index 6a681d694e..914366afcd 100644 // this.minecraftServer.getCommandDispatcher().a(this.player.getCommandListener(), s); // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/PlayerConnectionUtils.java b/src/main/java/net/minecraft/server/PlayerConnectionUtils.java -index 2c671629a4..eb3269e0ea 100644 +index 2c671629a..eb3269e0e 100644 --- a/src/main/java/net/minecraft/server/PlayerConnectionUtils.java +++ b/src/main/java/net/minecraft/server/PlayerConnectionUtils.java @@ -0,0 +0,0 @@ package net.minecraft.server; @@ -1090,7 +1090,7 @@ index 2c671629a4..eb3269e0ea 100644 PlayerConnectionUtils.LOGGER.debug("Ignoring packet due to disconnection: " + packet); } diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 94ed83baf0..f28be11eee 100644 +index 94ed83baf..f28be11ee 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -0,0 +0,0 @@ @@ -1114,7 +1114,7 @@ index 94ed83baf0..f28be11eee 100644 public WhiteList getWhitelist() { diff --git a/src/main/java/net/minecraft/server/TickListServer.java b/src/main/java/net/minecraft/server/TickListServer.java -index 00bbd34b6a..f533860bbe 100644 +index 00bbd34b6..f533860bb 100644 --- a/src/main/java/net/minecraft/server/TickListServer.java +++ b/src/main/java/net/minecraft/server/TickListServer.java @@ -0,0 +0,0 @@ public class TickListServer implements TickList { @@ -1164,7 +1164,7 @@ index 00bbd34b6a..f533860bbe 100644 this.g.clear(); } diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 820180ab3f..fa6400dccd 100644 +index 820180ab3..fa6400dcc 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java @@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer; @@ -1183,7 +1183,7 @@ index 820180ab3f..fa6400dccd 100644 private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry(); public CraftPersistentDataContainer persistentDataContainer; diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 2a4fa455ff..f572c5f227 100644 +index 2a4fa455f..f572c5f22 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ @@ -1239,7 +1239,7 @@ index 2a4fa455ff..f572c5f227 100644 CrashReport crashreport = CrashReport.a(throwable, "Ticking entity"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being ticked"); diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 8a5ac6f69b..6810d49b17 100644 +index 8a5ac6f69..6810d49b1 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -0,0 +0,0 @@ @@ -1384,7 +1384,7 @@ index 8a5ac6f69b..6810d49b17 100644 // CraftBukkit start - moved from MinecraftServer.saveChunks diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 8d1f066f00..f3eacb1819 100644 +index 8d1f066f0..f3eacb181 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -0,0 +0,0 @@ public final class CraftServer implements Server { @@ -1421,7 +1421,7 @@ index 8d1f066f00..f3eacb1819 100644 org.spigotmc.RestartCommand.restart(); diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java deleted file mode 100644 -index 2bd22a3698..0000000000 +index 2bd22a369..000000000 --- a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java +++ /dev/null @@ -0,0 +0,0 @@ @@ -1588,7 +1588,7 @@ index 2bd22a3698..0000000000 - } -} diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 4fed5dc92f..d7a4e50f23 100644 +index 4fed5dc92..d7a4e50f2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1607,7 +1607,7 @@ index 4fed5dc92f..d7a4e50f23 100644 public Player.Spigot spigot() diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index b90979c7ba..8823f94f7b 100644 +index b90979c7b..8823f94f7 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java @@ -0,0 +0,0 @@ @@ -1673,7 +1673,7 @@ index b90979c7ba..8823f94f7b 100644 private boolean isReady(final int currentTick) { diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java -index 3f55381c15..0d9a466809 100644 +index 3f55381c1..0d9a46680 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java @@ -0,0 +0,0 @@ @@ -1758,7 +1758,7 @@ index 3f55381c15..0d9a466809 100644 - // Spigot end } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java b/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java -index e52ef47b78..3d90b34268 100644 +index e52ef47b7..3d90b3426 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java @@ -0,0 +0,0 @@ import org.bukkit.util.CachedServerIcon; @@ -1770,7 +1770,7 @@ index e52ef47b78..3d90b34268 100644 this.value = value; } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 68728b4d86..02f3300533 100644 +index 68728b4d8..02f330053 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -1788,7 +1788,7 @@ index 68728b4d86..02f3300533 100644 * This helper class represents the different NBT Tags. *

diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index ca7789b5e0..4423839697 100644 +index ca7789b5e..442383969 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java @@ -0,0 +0,0 @@ import net.minecraft.server.EntityWither;