From bf478c36c74f99c1095e81f57731810d25bd24b9 Mon Sep 17 00:00:00 2001 From: Spottedleaf <Spottedleaf@users.noreply.github.com> Date: Fri, 26 Jun 2020 20:05:12 -0700 Subject: [PATCH] fix async chunk loading disregardling light data --- ...78-Asynchronous-chunk-IO-and-loading.patch | 23 +++++++++--------- .../0411-Tracking-Range-Improvements.patch | 4 ++-- ...-PlayerChunkMap-adds-crashing-server.patch | 4 ++-- ...hunkMap-memory-use-for-visibleChunks.patch | 4 ++-- ...-Chunk-Post-Processing-deadlock-risk.patch | 4 ++-- ...g-Broken-behavior-of-PlayerJoinEvent.patch | 4 ++-- ...tance-map-to-optimise-entity-tracker.patch | 16 ++++++------- ...-isOutsideRange-to-use-distance-maps.patch | 4 ++-- ...No-Tick-view-distance-implementation.patch | 24 +++++++++---------- ...llocation-of-Vec3D-by-entity-tracker.patch | 4 ++-- ...ound-for-Client-Lag-Spikes-MC-162253.patch | 4 ++-- ...k-Priority-Urgency-System-for-Chunks.patch | 6 ++--- ...mprove-Chunk-Status-Transition-Speed.patch | 4 ++-- 13 files changed, 53 insertions(+), 52 deletions(-) diff --git a/Spigot-Server-Patches/0378-Asynchronous-chunk-IO-and-loading.patch b/Spigot-Server-Patches/0378-Asynchronous-chunk-IO-and-loading.patch index 24c69d24a1..77ee8c6d09 100644 --- a/Spigot-Server-Patches/0378-Asynchronous-chunk-IO-and-loading.patch +++ b/Spigot-Server-Patches/0378-Asynchronous-chunk-IO-and-loading.patch @@ -3046,7 +3046,7 @@ index 3e1c1253ad5e2fa68fd8a0bac100c2e7536ea080..b6868b6b23a09e8e0dfe7a5e378dca22 completablefuture = (CompletableFuture) this.statusFutures.get(i); if (completablefuture != null) { diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 24f3e8a6866bb416f04aca342514fa5dd3d314c8..cdb72b225226083ca45ade798f54989422e5281c 100644 +index 24f3e8a6866bb416f04aca342514fa5dd3d314c8..a10006efc52f093196e7d67a3281a87d4c5df19b 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -64,7 +64,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -3224,7 +3224,7 @@ index 24f3e8a6866bb416f04aca342514fa5dd3d314c8..cdb72b225226083ca45ade798f549894 this.lightEngine.a(ichunkaccess.getPos()); this.lightEngine.queueUpdate(); this.worldLoadListener.a(ichunkaccess.getPos(), (ChunkStatus) null); -@@ -573,19 +641,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -573,19 +641,21 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } private CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> f(ChunkCoordIntPair chunkcoordintpair) { @@ -3241,6 +3241,7 @@ index 24f3e8a6866bb416f04aca342514fa5dd3d314c8..cdb72b225226083ca45ade798f549894 + if (ioThrowable != null) { + com.destroystokyo.paper.util.SneakyThrow.sneaky(ioThrowable); + } ++ chunkHolder.tasks.forEach(Runnable::run); + // Paper end - if (nbttagcompound != null) {try (Timing ignored2 = this.world.timings.chunkLoadLevelTimer.startTimingIfSync()) { // Paper start - timings @@ -3254,7 +3255,7 @@ index 24f3e8a6866bb416f04aca342514fa5dd3d314c8..cdb72b225226083ca45ade798f549894 protochunk.setLastSaved(this.world.getTime()); this.a(chunkcoordintpair, protochunk.getChunkStatus().getType()); -@@ -609,7 +678,32 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -609,7 +679,32 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.g(chunkcoordintpair); return Either.left(new ProtoChunk(chunkcoordintpair, ChunkConverter.a, this.world)); // Paper - Anti-Xray - Add parameter @@ -3288,7 +3289,7 @@ index 24f3e8a6866bb416f04aca342514fa5dd3d314c8..cdb72b225226083ca45ade798f549894 } private void g(ChunkCoordIntPair chunkcoordintpair) { -@@ -836,6 +930,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -836,6 +931,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } public boolean saveChunk(IChunkAccess ichunkaccess) { @@ -3296,7 +3297,7 @@ index 24f3e8a6866bb416f04aca342514fa5dd3d314c8..cdb72b225226083ca45ade798f549894 this.m.a(ichunkaccess.getPos()); if (!ichunkaccess.isNeedsSaving()) { return false; -@@ -848,6 +943,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -848,6 +944,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { ChunkStatus chunkstatus = ichunkaccess.getChunkStatus(); if (chunkstatus.getType() != ChunkStatus.Type.LEVELCHUNK) { @@ -3304,7 +3305,7 @@ index 24f3e8a6866bb416f04aca342514fa5dd3d314c8..cdb72b225226083ca45ade798f549894 if (this.h(chunkcoordintpair)) { return false; } -@@ -855,12 +951,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -855,12 +952,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { if (chunkstatus == ChunkStatus.EMPTY && ichunkaccess.h().values().stream().noneMatch(StructureStart::e)) { return false; } @@ -3327,7 +3328,7 @@ index 24f3e8a6866bb416f04aca342514fa5dd3d314c8..cdb72b225226083ca45ade798f549894 this.a(chunkcoordintpair, chunkstatus.getType()); return true; } catch (Exception exception) { -@@ -869,6 +973,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -869,6 +974,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return false; } } @@ -3335,7 +3336,7 @@ index 24f3e8a6866bb416f04aca342514fa5dd3d314c8..cdb72b225226083ca45ade798f549894 } private boolean h(ChunkCoordIntPair chunkcoordintpair) { -@@ -998,6 +1103,35 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -998,6 +1104,35 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } } @@ -3371,7 +3372,7 @@ index 24f3e8a6866bb416f04aca342514fa5dd3d314c8..cdb72b225226083ca45ade798f549894 @Nullable public NBTTagCompound readChunkData(ChunkCoordIntPair chunkcoordintpair) throws IOException { // Paper - private -> public NBTTagCompound nbttagcompound = this.read(chunkcoordintpair); -@@ -1019,33 +1153,55 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1019,33 +1154,55 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { // Paper start - chunk status cache "api" public ChunkStatus getChunkStatusOnDiskIfCached(ChunkCoordIntPair chunkPos) { @@ -3438,7 +3439,7 @@ index 24f3e8a6866bb416f04aca342514fa5dd3d314c8..cdb72b225226083ca45ade798f549894 } public IChunkAccess getUnloadingChunk(int chunkX, int chunkZ) { -@@ -1054,6 +1210,39 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1054,6 +1211,39 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } // Paper end @@ -3478,7 +3479,7 @@ index 24f3e8a6866bb416f04aca342514fa5dd3d314c8..cdb72b225226083ca45ade798f549894 boolean isOutsideOfRange(ChunkCoordIntPair chunkcoordintpair) { // Spigot start return isOutsideOfRange(chunkcoordintpair, false); -@@ -1399,6 +1588,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1399,6 +1589,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } diff --git a/Spigot-Server-Patches/0411-Tracking-Range-Improvements.patch b/Spigot-Server-Patches/0411-Tracking-Range-Improvements.patch index 04e1d99662..cb8dc9afe4 100644 --- a/Spigot-Server-Patches/0411-Tracking-Range-Improvements.patch +++ b/Spigot-Server-Patches/0411-Tracking-Range-Improvements.patch @@ -8,10 +8,10 @@ Sets tracking range of watermobs to animals instead of misc and simplifies code Also ignores Enderdragon, defaulting it to Mojang's setting diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index cdb72b225226083ca45ade798f54989422e5281c..0e9de6f12b56db5eb8759798a686ba6c68172323 100644 +index a10006efc52f093196e7d67a3281a87d4c5df19b..89d3890ab80da90fea2fb6e0a871bae2ff5f5ef1 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -1716,6 +1716,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1717,6 +1717,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); int j = entity.getEntityType().getChunkRange() * 16; diff --git a/Spigot-Server-Patches/0433-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch b/Spigot-Server-Patches/0433-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch index 1cc643236e..6a77ce981e 100644 --- a/Spigot-Server-Patches/0433-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch +++ b/Spigot-Server-Patches/0433-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch @@ -7,10 +7,10 @@ Suspected case would be around the technique used in .stopRiding Stack will identify any causer of this and warn instead of crashing. diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 0e9de6f12b56db5eb8759798a686ba6c68172323..00de0d10842006f4fe9f64e136d03fd06fef6d1b 100644 +index 89d3890ab80da90fea2fb6e0a871bae2ff5f5ef1..1379c65d0b07544242d5ee32841b208ace43197f 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -1423,6 +1423,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1424,6 +1424,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { protected void addEntity(Entity entity) { org.spigotmc.AsyncCatcher.catchOp("entity track"); // Spigot diff --git a/Spigot-Server-Patches/0437-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch b/Spigot-Server-Patches/0437-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch index 8d21720384..a56b084a09 100644 --- a/Spigot-Server-Patches/0437-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch +++ b/Spigot-Server-Patches/0437-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch @@ -83,7 +83,7 @@ index 9615c4d324e42f7f91a7e60b6151c16d20e9c739..a68e4fc411ae84f12b1ca7443fa66f63 List<PlayerChunk> allChunks = new ArrayList<>(visibleChunks.values()); List<EntityPlayer> players = world.players; diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 00de0d10842006f4fe9f64e136d03fd06fef6d1b..ad4a07283a67ed4db770c59bb5884b9fa3f92b21 100644 +index 1379c65d0b07544242d5ee32841b208ace43197f..31f72f0c0f00a62f9e636a9cd0362c7b7a9759b4 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -56,8 +56,33 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -227,7 +227,7 @@ index 00de0d10842006f4fe9f64e136d03fd06fef6d1b..ad4a07283a67ed4db770c59bb5884b9f this.updatingChunksModified = false; return true; } -@@ -1061,12 +1143,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1062,12 +1144,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } protected Iterable<PlayerChunk> f() { diff --git a/Spigot-Server-Patches/0459-Fix-Chunk-Post-Processing-deadlock-risk.patch b/Spigot-Server-Patches/0459-Fix-Chunk-Post-Processing-deadlock-risk.patch index 24ea52cc26..1265cee4b7 100644 --- a/Spigot-Server-Patches/0459-Fix-Chunk-Post-Processing-deadlock-risk.patch +++ b/Spigot-Server-Patches/0459-Fix-Chunk-Post-Processing-deadlock-risk.patch @@ -37,7 +37,7 @@ index e24f3711017aa5194ef7bf4e8d90f150cfb083ff..7af4c3e2aaf0775640d51f88b3cf821b } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 295c8e7eeb4fc634aaa2ca788e6540a647755f88..26230476a107e3f9c12b9ede628173e900d28f18 100644 +index 517d752f96b595ce26092616cb9087e356c194b7..372b4d9ce7325f3d158f8199d1ec0dd2670f57ce 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -132,6 +132,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -49,7 +49,7 @@ index 295c8e7eeb4fc634aaa2ca788e6540a647755f88..26230476a107e3f9c12b9ede628173e9 // Paper start - distance maps private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets<EntityPlayer> pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>(); -@@ -976,7 +978,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -977,7 +979,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return Either.left(chunk); }); }, (runnable) -> { diff --git a/Spigot-Server-Patches/0462-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch b/Spigot-Server-Patches/0462-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch index 1de373fe31..fb57339bb1 100644 --- a/Spigot-Server-Patches/0462-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch +++ b/Spigot-Server-Patches/0462-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch @@ -40,10 +40,10 @@ index 41ec990baa4a2ca149cd6edd16943a9ac27cde91..6f26d468bcb68328a3e0ee7f627dc8f2 // CraftBukkit end public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 26230476a107e3f9c12b9ede628173e900d28f18..d0a5335b6315f3c8f8b431f53ad69a53caf9fd63 100644 +index 372b4d9ce7325f3d158f8199d1ec0dd2670f57ce..ccd11698b13e771cd1d90dc73108b055f4e4f53c 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -1515,6 +1515,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1516,6 +1516,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { .printStackTrace(); return; } diff --git a/Spigot-Server-Patches/0478-Use-distance-map-to-optimise-entity-tracker.patch b/Spigot-Server-Patches/0478-Use-distance-map-to-optimise-entity-tracker.patch index 8c97ee6ece..d018e82224 100644 --- a/Spigot-Server-Patches/0478-Use-distance-map-to-optimise-entity-tracker.patch +++ b/Spigot-Server-Patches/0478-Use-distance-map-to-optimise-entity-tracker.patch @@ -56,7 +56,7 @@ index 57f7dfc6a5316cfec5cce9c60e7b91d94c505f50..735beaf6fa6e6ccf2137b64a0b5179ad return i; } diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 3355e2110d98c7ca514a1abf9461f1bb13ab7a30..d0459c862f16cdd942148ffd888aeccd2367073c 100644 +index 1009ad80c6cd869c1f2b77b7bc1570907af983cf..43209c7392f675f3b9301f654b53b3fceb9ddacf 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -144,21 +144,55 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -162,7 +162,7 @@ index 3355e2110d98c7ca514a1abf9461f1bb13ab7a30..d0459c862f16cdd942148ffd888aeccd } private static double a(ChunkCoordIntPair chunkcoordintpair, Entity entity) { -@@ -1412,17 +1485,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1413,17 +1486,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } public void movePlayer(EntityPlayer entityplayer) { @@ -181,7 +181,7 @@ index 3355e2110d98c7ca514a1abf9461f1bb13ab7a30..d0459c862f16cdd942148ffd888aeccd int i = MathHelper.floor(entityplayer.locX()) >> 4; int j = MathHelper.floor(entityplayer.locZ()) >> 4; -@@ -1538,7 +1601,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1539,7 +1602,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker this.trackedEntities.put(entity.getId(), playerchunkmap_entitytracker); @@ -190,7 +190,7 @@ index 3355e2110d98c7ca514a1abf9461f1bb13ab7a30..d0459c862f16cdd942148ffd888aeccd if (entity instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer) entity; -@@ -1581,7 +1644,37 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1582,7 +1645,37 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { entity.tracker = null; // Paper - We're no longer tracked } @@ -228,7 +228,7 @@ index 3355e2110d98c7ca514a1abf9461f1bb13ab7a30..d0459c862f16cdd942148ffd888aeccd List<EntityPlayer> list = Lists.newArrayList(); List<EntityPlayer> list1 = this.world.getPlayers(); -@@ -1649,23 +1742,31 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1650,23 +1743,31 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { PacketDebug.a(this.world, chunk.getPos()); List<Entity> list = Lists.newArrayList(); List<Entity> list1 = Lists.newArrayList(); @@ -272,7 +272,7 @@ index 3355e2110d98c7ca514a1abf9461f1bb13ab7a30..d0459c862f16cdd942148ffd888aeccd Iterator iterator; Entity entity1; -@@ -1703,7 +1804,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1704,7 +1805,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { public class EntityTracker { @@ -281,7 +281,7 @@ index 3355e2110d98c7ca514a1abf9461f1bb13ab7a30..d0459c862f16cdd942148ffd888aeccd private final Entity tracker; private final int trackingDistance; private SectionPosition e; -@@ -1720,6 +1821,42 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1721,6 +1822,42 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.e = SectionPosition.a(entity); } @@ -324,7 +324,7 @@ index 3355e2110d98c7ca514a1abf9461f1bb13ab7a30..d0459c862f16cdd942148ffd888aeccd public boolean equals(Object object) { return object instanceof PlayerChunkMap.EntityTracker ? ((PlayerChunkMap.EntityTracker) object).tracker.getId() == this.tracker.getId() : false; } -@@ -1820,7 +1957,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1821,7 +1958,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { int j = entity.getEntityType().getChunkRange() * 16; j = org.spigotmc.TrackingRange.getEntityTrackingRange(entity, j); // Paper diff --git a/Spigot-Server-Patches/0479-Optimize-isOutsideRange-to-use-distance-maps.patch b/Spigot-Server-Patches/0479-Optimize-isOutsideRange-to-use-distance-maps.patch index ebbeb73be7..f7d0899a1a 100644 --- a/Spigot-Server-Patches/0479-Optimize-isOutsideRange-to-use-distance-maps.patch +++ b/Spigot-Server-Patches/0479-Optimize-isOutsideRange-to-use-distance-maps.patch @@ -191,7 +191,7 @@ index 9cb2ff09da0b8832e58eed4d70741853a25c9011..7f660d3c528f5fb4150e4ee8b2991343 // Paper start diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index d0459c862f16cdd942148ffd888aeccd2367073c..74f3ce59cd1e00b5aa330a8f0240626f382d0bc9 100644 +index 43209c7392f675f3b9301f654b53b3fceb9ddacf..31ab5510fcaaf9640098d9ab1f56185cec1eb680 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -158,6 +158,17 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -302,7 +302,7 @@ index d0459c862f16cdd942148ffd888aeccd2367073c..74f3ce59cd1e00b5aa330a8f0240626f } if (playerchunk != null) { -@@ -1414,30 +1469,53 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1415,30 +1470,53 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return isOutsideOfRange(chunkcoordintpair, false); } diff --git a/Spigot-Server-Patches/0481-No-Tick-view-distance-implementation.patch b/Spigot-Server-Patches/0481-No-Tick-view-distance-implementation.patch index 10e726035d..33df15d7aa 100644 --- a/Spigot-Server-Patches/0481-No-Tick-view-distance-implementation.patch +++ b/Spigot-Server-Patches/0481-No-Tick-view-distance-implementation.patch @@ -221,7 +221,7 @@ index 7f660d3c528f5fb4150e4ee8b29913436f125b06..40347212ad1bcf857d5b8ddb0ee6a698 public CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> a(ChunkStatus chunkstatus, PlayerChunkMap playerchunkmap) { diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 74f3ce59cd1e00b5aa330a8f0240626f382d0bc9..82ea333f1889d683cf8d5228f18d1d275cc71da3 100644 +index 31ab5510fcaaf9640098d9ab1f56185cec1eb680..03e94dbd750ee3181472bb74c3fbc7de5757f380 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -95,7 +95,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -354,7 +354,7 @@ index 74f3ce59cd1e00b5aa330a8f0240626f382d0bc9..82ea333f1889d683cf8d5228f18d1d27 } private static double getDistanceSquaredFromChunk(ChunkCoordIntPair chunkPos, Entity entity) { return a(chunkPos, entity); } // Paper - OBFHELPER -@@ -1120,15 +1206,11 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1121,15 +1207,11 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { completablefuture1.thenAcceptAsync((either) -> { either.mapLeft((chunk) -> { this.u.getAndIncrement(); @@ -372,7 +372,7 @@ index 74f3ce59cd1e00b5aa330a8f0240626f382d0bc9..82ea333f1889d683cf8d5228f18d1d27 }); return completablefuture1; } -@@ -1223,32 +1305,38 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1224,32 +1306,38 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } } @@ -426,7 +426,7 @@ index 74f3ce59cd1e00b5aa330a8f0240626f382d0bc9..82ea333f1889d683cf8d5228f18d1d27 protected void sendChunk(EntityPlayer entityplayer, ChunkCoordIntPair chunkcoordintpair, Packet<?>[] apacket, boolean flag, boolean flag1) { if (entityplayer.world == this.world) { -@@ -1256,7 +1344,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1257,7 +1345,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { PlayerChunk playerchunk = this.getVisibleChunk(chunkcoordintpair.pair()); if (playerchunk != null) { @@ -435,7 +435,7 @@ index 74f3ce59cd1e00b5aa330a8f0240626f382d0bc9..82ea333f1889d683cf8d5228f18d1d27 if (chunk != null) { this.a(entityplayer, apacket, chunk); -@@ -1517,6 +1605,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1518,6 +1606,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } // Paper end - optimise isOutsideOfRange @@ -443,7 +443,7 @@ index 74f3ce59cd1e00b5aa330a8f0240626f382d0bc9..82ea333f1889d683cf8d5228f18d1d27 private boolean b(EntityPlayer entityplayer) { return entityplayer.isSpectator() && !this.world.getGameRules().getBoolean(GameRules.SPECTATORS_GENERATE_CHUNKS); } -@@ -1544,13 +1633,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1545,13 +1634,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.removePlayerFromDistanceMaps(entityplayer); // Paper - distance maps } @@ -458,7 +458,7 @@ index 74f3ce59cd1e00b5aa330a8f0240626f382d0bc9..82ea333f1889d683cf8d5228f18d1d27 } -@@ -1558,7 +1641,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1559,7 +1642,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { SectionPosition sectionposition = SectionPosition.a((Entity) entityplayer); entityplayer.a(sectionposition); @@ -467,7 +467,7 @@ index 74f3ce59cd1e00b5aa330a8f0240626f382d0bc9..82ea333f1889d683cf8d5228f18d1d27 return sectionposition; } -@@ -1603,6 +1686,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1604,6 +1687,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { int k1; int l1; @@ -475,7 +475,7 @@ index 74f3ce59cd1e00b5aa330a8f0240626f382d0bc9..82ea333f1889d683cf8d5228f18d1d27 if (Math.abs(i1 - i) <= this.viewDistance * 2 && Math.abs(j1 - j) <= this.viewDistance * 2) { k1 = Math.min(i, i1) - this.viewDistance; l1 = Math.min(j, j1) - this.viewDistance; -@@ -1640,7 +1724,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1641,7 +1725,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.sendChunk(entityplayer, chunkcoordintpair1, new Packet[2], false, true); } } @@ -484,7 +484,7 @@ index 74f3ce59cd1e00b5aa330a8f0240626f382d0bc9..82ea333f1889d683cf8d5228f18d1d27 this.updateMaps(entityplayer); // Paper - distance maps -@@ -1648,11 +1732,46 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1649,11 +1733,46 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @Override public Stream<EntityPlayer> a(ChunkCoordIntPair chunkcoordintpair, boolean flag) { @@ -535,7 +535,7 @@ index 74f3ce59cd1e00b5aa330a8f0240626f382d0bc9..82ea333f1889d683cf8d5228f18d1d27 } protected void addEntity(Entity entity) { -@@ -1810,6 +1929,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1811,6 +1930,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } @@ -543,7 +543,7 @@ index 74f3ce59cd1e00b5aa330a8f0240626f382d0bc9..82ea333f1889d683cf8d5228f18d1d27 private void a(EntityPlayer entityplayer, Packet<?>[] apacket, Chunk chunk) { if (apacket[0] == null) { apacket[0] = new PacketPlayOutMapChunk(chunk, 65535, true); -@@ -1995,7 +2115,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1996,7 +2116,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(this.tracker.chunkX, this.tracker.chunkZ); PlayerChunk playerchunk = PlayerChunkMap.this.getVisibleChunk(chunkcoordintpair.pair()); diff --git a/Spigot-Server-Patches/0493-Reduce-allocation-of-Vec3D-by-entity-tracker.patch b/Spigot-Server-Patches/0493-Reduce-allocation-of-Vec3D-by-entity-tracker.patch index a66e9b0b8f..f0b118d867 100644 --- a/Spigot-Server-Patches/0493-Reduce-allocation-of-Vec3D-by-entity-tracker.patch +++ b/Spigot-Server-Patches/0493-Reduce-allocation-of-Vec3D-by-entity-tracker.patch @@ -39,10 +39,10 @@ index 0c46297e6ff229538d77b2f481e4ab13ea14c48e..f75c09d44a19f84588f21a55ea8f0dd8 if (!flag4 && this.o <= 400 && !this.q && this.r == this.tracker.isOnGround()) { diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index fa0d4b0eda8d722503dd1732bf14e4a5c1e6f948..ece6ae302519ceddab0594d12ec40ec7a9b84209 100644 +index 6fe15ed9440cb34829052aee13b175398b2f4e8a..e272567d8bf064802d2ce434397d0d2c8595bcce 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -2111,9 +2111,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -2112,9 +2112,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { public void updatePlayer(EntityPlayer entityplayer) { org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot if (entityplayer != this.tracker) { diff --git a/Spigot-Server-Patches/0496-Workaround-for-Client-Lag-Spikes-MC-162253.patch b/Spigot-Server-Patches/0496-Workaround-for-Client-Lag-Spikes-MC-162253.patch index 7583d69a1f..c6ccac7cf5 100644 --- a/Spigot-Server-Patches/0496-Workaround-for-Client-Lag-Spikes-MC-162253.patch +++ b/Spigot-Server-Patches/0496-Workaround-for-Client-Lag-Spikes-MC-162253.patch @@ -37,10 +37,10 @@ index 860dc98ab4f84c470b27726314943936d23fcb79..8d45588ecfa33b8c7335df3db58ed686 return chunksection == Chunk.a || chunksection.c(); } diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index ece6ae302519ceddab0594d12ec40ec7a9b84209..7cba79ce0b3718b73fd7fd839732d1a7ef85941e 100644 +index e272567d8bf064802d2ce434397d0d2c8595bcce..dcbc97e5b00ffaf12984cd9b34fb513403822132 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -1936,12 +1936,112 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1937,12 +1937,112 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } diff --git a/Spigot-Server-Patches/0497-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch b/Spigot-Server-Patches/0497-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch index 893a3db060..8517bd072b 100644 --- a/Spigot-Server-Patches/0497-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch +++ b/Spigot-Server-Patches/0497-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch @@ -882,7 +882,7 @@ index e5751adde516544722b95016f64b2a46c16e77ce..04dea2c9fd9337631a6289c7242338e1 } diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 7cba79ce0b3718b73fd7fd839732d1a7ef85941e..9419cb575fde265718eafe20bbe8a592e862f6d5 100644 +index dcbc97e5b00ffaf12984cd9b34fb513403822132..0f0f6b73b97fc9eef95cf680b85d7ac2618adf9e 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -51,6 +51,7 @@ import org.apache.commons.lang3.mutable.MutableBoolean; @@ -1094,7 +1094,7 @@ index 7cba79ce0b3718b73fd7fd839732d1a7ef85941e..9419cb575fde265718eafe20bbe8a592 list.add(completablefuture); } -@@ -1008,14 +1145,22 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1009,14 +1146,22 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { }; CompletableFuture<NBTTagCompound> chunkSaveFuture = this.world.asyncChunkTaskManager.getChunkSaveFuture(chunkcoordintpair.x, chunkcoordintpair.z); @@ -1122,7 +1122,7 @@ index 7cba79ce0b3718b73fd7fd839732d1a7ef85941e..9419cb575fde265718eafe20bbe8a592 return ret; // Paper end } -@@ -1152,7 +1297,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1153,7 +1298,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { long i = playerchunk.i().pair(); playerchunk.getClass(); diff --git a/Spigot-Server-Patches/0500-Improve-Chunk-Status-Transition-Speed.patch b/Spigot-Server-Patches/0500-Improve-Chunk-Status-Transition-Speed.patch index 58a948c24c..92fe8aa19c 100644 --- a/Spigot-Server-Patches/0500-Improve-Chunk-Status-Transition-Speed.patch +++ b/Spigot-Server-Patches/0500-Improve-Chunk-Status-Transition-Speed.patch @@ -54,7 +54,7 @@ index 04dea2c9fd9337631a6289c7242338e166d6bc1e..446c401b3139f8c6c0e70d883340f014 // Paper start - no-tick view distance public final Chunk getSendingChunk() { diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 9419cb575fde265718eafe20bbe8a592e862f6d5..bf60b43bf3cb75b7545193958e5508415fa55986 100644 +index 0f0f6b73b97fc9eef95cf680b85d7ac2618adf9e..77e804086f52527c43499af44d59aebb5b246f61 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -721,7 +721,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -84,7 +84,7 @@ index 9419cb575fde265718eafe20bbe8a592e862f6d5..bf60b43bf3cb75b7545193958e550841 } } -@@ -1205,6 +1205,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1206,6 +1206,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return CompletableFuture.completedFuture(Either.right(playerchunk_failure)); }); }, (runnable) -> {