From 4ae089597b24c71ca4a86292d27ed102648d9b88 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 14 May 2020 04:58:47 -0400 Subject: [PATCH] Fix collision checks on spawning hanging entities and null on async chunk loads getCubes will now always load chunks getChunk with gen false will now not throw error Fixes #3368 Fixes #3364 --- ...90-Asynchronous-chunk-IO-and-loading.patch | 48 ++++++++++++------- ...etChunkIfLoadedImmediately-in-places.patch | 4 +- .../0392-Reduce-sync-loads.patch | 6 +-- ...ement-optional-per-player-mob-spawns.patch | 8 ++-- ...or-when-player-hand-set-to-empty-typ.patch | 4 +- ...e-getChunkAt-calls-for-loaded-chunks.patch | 6 +-- ...41-Prevent-teleporting-dead-entities.patch | 4 +- ...ptimize-Collision-to-not-load-chunks.patch | 34 +++++++++++-- ...hunkMap-memory-use-for-visibleChunks.patch | 4 +- ...asks-Speed-up-processing-of-chunk-lo.patch | 14 +++--- ...Priority-Urgency-System-for-World-Ge.patch | 8 ++-- ...imise-entity-hard-collision-checking.patch | 4 +- ...oviderServer-s-chunk-level-checking-.patch | 4 +- ...-Chunk-Post-Processing-deadlock-risk.patch | 4 +- ...Load-Chunks-for-Login-Asynchronously.patch | 8 ++-- ...pawn-point-if-spawn-in-unloaded-worl.patch | 4 +- ...m-duplication-issues-and-teleport-is.patch | 8 ++-- .../0493-Implement-Brigadier-Mojang-API.patch | 6 +-- ...PickItem-Packet-and-kick-for-invalid.patch | 4 +- .../0497-Sync-position-on-teleportation.patch | 4 +- ...tance-map-to-optimise-entity-tracker.patch | 4 +- ...-isOutsideRange-to-use-distance-maps.patch | 8 ++-- ...quid-s-Entity-Collision-optimisation.patch | 4 +- ...me-Streams-usage-in-Entity-Collision.patch | 12 ++--- ...sure-Entity-AABB-s-are-never-invalid.patch | 8 ++-- ...WorldBorder-collision-checks-and-air.patch | 10 ++-- 26 files changed, 135 insertions(+), 97 deletions(-) diff --git a/Spigot-Server-Patches/0390-Asynchronous-chunk-IO-and-loading.patch b/Spigot-Server-Patches/0390-Asynchronous-chunk-IO-and-loading.patch index 048f759f64..aced2e15cd 100644 --- a/Spigot-Server-Patches/0390-Asynchronous-chunk-IO-and-loading.patch +++ b/Spigot-Server-Patches/0390-Asynchronous-chunk-IO-and-loading.patch @@ -2305,10 +2305,10 @@ index 0000000000000000000000000000000000000000..2b20c159f6bb425be70201cf33159aa9 + +} diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 4c9c8e483974f8869d6711626620cfd7d814d956..5f91b311f3512233c3c21563832afbb408b20bde 100644 +index 4c9c8e483974f8869d6711626620cfd7d814d956..54325d9305953fa7520feec6c80e2931888141c2 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -299,11 +299,136 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -299,11 +299,137 @@ public class ChunkProviderServer extends IChunkProvider { return playerChunk.getAvailableChunkNow(); } @@ -2331,7 +2331,8 @@ index 4c9c8e483974f8869d6711626620cfd7d814d956..5f91b311f3512233c3c21563832afbb4 + } + + if (!com.destroystokyo.paper.PaperConfig.asyncChunks) { -+ return CompletableFuture.completedFuture(Either.left(getChunkAt(x, z, gen))); ++ Chunk chunk = getChunkAt(x, z, gen); ++ return CompletableFuture.completedFuture(chunk != null ? Either.left(chunk) : PlayerChunk.UNLOADED_CHUNK_ACCESS); + } + + long k = ChunkCoordIntPair.pair(x, z); @@ -2379,7 +2380,7 @@ index 4c9c8e483974f8869d6711626620cfd7d814d956..5f91b311f3512233c3c21563832afbb4 + + if (status != null && status != ChunkStatus.FULL) { + // does not exist on disk -+ return CompletableFuture.completedFuture(Either.left(null)); ++ return CompletableFuture.completedFuture(PlayerChunk.UNLOADED_CHUNK_ACCESS); + } + + if (status == ChunkStatus.FULL) { @@ -2394,7 +2395,7 @@ index 4c9c8e483974f8869d6711626620cfd7d814d956..5f91b311f3512233c3c21563832afbb4 + IChunkAccess chunk = either.left().orElse(null); + if (!(chunk instanceof ProtoChunkExtension) && !(chunk instanceof Chunk)) { + // the chunk on disk was not a full status chunk -+ return CompletableFuture.completedFuture(Either.left(null)); ++ return CompletableFuture.completedFuture(PlayerChunk.UNLOADED_CHUNK_ACCESS); + } + ; // bring to full status if required + return this.bringToFullStatusAsync(x, z, chunkPos, isUrgent); @@ -2445,7 +2446,7 @@ index 4c9c8e483974f8869d6711626620cfd7d814d956..5f91b311f3512233c3c21563832afbb4 if (Thread.currentThread() != this.serverThread) { return (IChunkAccess) CompletableFuture.supplyAsync(() -> { return this.getChunkAt(i, j, chunkstatus, flag); -@@ -326,11 +451,16 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -326,11 +452,16 @@ public class ChunkProviderServer extends IChunkProvider { } gameprofilerfiller.c("getChunkCacheMiss"); @@ -2463,7 +2464,7 @@ index 4c9c8e483974f8869d6711626620cfd7d814d956..5f91b311f3512233c3c21563832afbb4 this.world.timings.syncChunkLoad.stopTiming(); // Paper } // Paper ichunkaccess = (IChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { -@@ -396,6 +526,11 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -396,6 +527,11 @@ public class ChunkProviderServer extends IChunkProvider { } private CompletableFuture> getChunkFutureMainThread(int i, int j, ChunkStatus chunkstatus, boolean flag) { @@ -2475,7 +2476,7 @@ index 4c9c8e483974f8869d6711626620cfd7d814d956..5f91b311f3512233c3c21563832afbb4 ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j); long k = chunkcoordintpair.pair(); int l = 33 + ChunkStatus.a(chunkstatus); -@@ -835,11 +970,12 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -835,11 +971,12 @@ public class ChunkProviderServer extends IChunkProvider { protected boolean executeNext() { // CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task try { @@ -2989,25 +2990,18 @@ index ed8c4a87b52e6375e354a28316f8f24608082417..996c8326387b5a7fe62db6a76e000144 return this.a == null ? new NibbleArray() : new NibbleArray((byte[]) this.a.clone()); } diff --git a/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java b/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java -index 4c52c57c02571353f71772e3650932f314da62ca..631106920cdca4162b2e039e631d86a4c1b92ce1 100644 +index 4c52c57c02571353f71772e3650932f314da62ca..71daa0cb08d69c16bded510d1a49053477faf600 100644 --- a/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java +++ b/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java -@@ -12,13 +12,13 @@ public class PacketPlayInTabComplete implements Packet { +@@ -12,7 +12,7 @@ public class PacketPlayInTabComplete implements Packet { @Override public void a(PacketDataSerializer packetdataserializer) throws IOException { this.a = packetdataserializer.i(); - this.b = packetdataserializer.e(32500); -+ this.b = packetdataserializer.e(256); ++ this.b = packetdataserializer.e(2048); } @Override - public void b(PacketDataSerializer packetdataserializer) throws IOException { - packetdataserializer.d(this.a); -- packetdataserializer.a(this.b, 32500); -+ packetdataserializer.a(this.b, 256); - } - - public void a(PacketListenerPlayIn packetlistenerplayin) { diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java index 040d4b41ea2223937ca22de2d40560f97b310f9a..bf592125f4ce5d7ea6e802e637ee3bfbe25d23aa 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java @@ -3542,6 +3536,24 @@ index 94b0c54d9d4d77b724087be55ffe6ce464a0bbe7..963ce3eeec6f9eea087054ea48b714ee protected VillagePlace h() { return this.m; } +diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +index 65c171cec3cc7c7c7433c63b3718fa7e1c16f148..0a06ed36795afad00839174fc1a7e7f7b9e4a8c8 100644 +--- a/src/main/java/net/minecraft/server/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/PlayerConnection.java +@@ -541,6 +541,13 @@ public class PlayerConnection implements PacketListenerPlayIn { + minecraftServer.scheduleOnMain(() -> this.disconnect(new ChatMessage("disconnect.spam", new Object[0]))); // Paper + return; + } ++ // Paper start ++ String str = packetplayintabcomplete.c(); int index = -1; ++ if (str.length() > 64 && ((index = str.indexOf(' ')) == -1 || index >= 64)) { ++ minecraftServer.scheduleOnMain(() -> this.disconnect(new ChatMessage("disconnect.spam", new Object[0]))); // Paper ++ return; ++ } ++ // Paper end + // CraftBukkit end + StringReader stringreader = new StringReader(packetplayintabcomplete.c()); + diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java index d37abf2cf304f81405e570588c8accbc44a629f4..df728e2c0a2bf660a91e0bd6342c4b4b1471dcb7 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java diff --git a/Spigot-Server-Patches/0391-Use-getChunkIfLoadedImmediately-in-places.patch b/Spigot-Server-Patches/0391-Use-getChunkIfLoadedImmediately-in-places.patch index 6d1c00d535..8f04073351 100644 --- a/Spigot-Server-Patches/0391-Use-getChunkIfLoadedImmediately-in-places.patch +++ b/Spigot-Server-Patches/0391-Use-getChunkIfLoadedImmediately-in-places.patch @@ -8,10 +8,10 @@ ticket level 33 (yes getChunkIfLoaded will actually perform a chunk load in that case). diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 65c171cec3cc7c7c7433c63b3718fa7e1c16f148..f00653dfe7a769992069582f1743b477edb47eb9 100644 +index 0a06ed36795afad00839174fc1a7e7f7b9e4a8c8..cf3e15e70ac22bbdd39153956cfdc6d2f8f44e2b 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -989,7 +989,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -996,7 +996,7 @@ public class PlayerConnection implements PacketListenerPlayIn { speed = player.abilities.walkSpeed * 10f; } // Paper start - Prevent moving into unloaded chunks diff --git a/Spigot-Server-Patches/0392-Reduce-sync-loads.patch b/Spigot-Server-Patches/0392-Reduce-sync-loads.patch index 61c27ff914..5c0e826bf5 100644 --- a/Spigot-Server-Patches/0392-Reduce-sync-loads.patch +++ b/Spigot-Server-Patches/0392-Reduce-sync-loads.patch @@ -285,10 +285,10 @@ index 0000000000000000000000000000000000000000..59aec103295f747793fdc0a52eb45f41 + } +} diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index cabe2a5908dd9ee721c13c1825e65a37f72361d4..61640d814426732a03d8bb3394c2cd3414a27a6c 100644 +index 54325d9305953fa7520feec6c80e2931888141c2..32bea1dea9ebb05ed94f5b47e6ad2145f6319431 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -458,6 +458,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -459,6 +459,7 @@ public class ChunkProviderServer extends IChunkProvider { this.world.asyncChunkTaskManager.raisePriority(x, z, com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGHEST_PRIORITY); com.destroystokyo.paper.io.chunk.ChunkTaskManager.pushChunkWait(this.world, x, z); // Paper end @@ -328,7 +328,7 @@ index 311685180fe720706dfb6c82b1b54f9876187b73..568e04faa314552e14286efdfcdfb79e if (chunk != null) { chunk.a(oclass, axisalignedbb, list, predicate); diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 30dbf95a02bd8e68471400245b46189f8e0560cc..4fea35783caa4d93de83e256b565f0e80212e9a5 100644 +index f84248ad9f90aaaf02afa35a4147fb11f703fdcb..befdabc38edfcdffb588c4cdbe52908afe8a9c04 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -154,6 +154,12 @@ public class WorldServer extends World { diff --git a/Spigot-Server-Patches/0396-implement-optional-per-player-mob-spawns.patch b/Spigot-Server-Patches/0396-implement-optional-per-player-mob-spawns.patch index 6eedef1099..17b2122c1d 100644 --- a/Spigot-Server-Patches/0396-implement-optional-per-player-mob-spawns.patch +++ b/Spigot-Server-Patches/0396-implement-optional-per-player-mob-spawns.patch @@ -545,10 +545,10 @@ index 0000000000000000000000000000000000000000..4f13d3ff8391793a99f067189f854078 + } +} diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index a77b756fdfe404d364823daa90f005cfc5d09f20..bdd5060851ea553f1a0b56c8f8e95208b8dfd757 100644 +index 32bea1dea9ebb05ed94f5b47e6ad2145f6319431..7a4e2c350e78b22dc035471ad0d7191dfd7afede 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -745,7 +745,22 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -746,7 +746,22 @@ public class ChunkProviderServer extends IChunkProvider { this.world.timings.countNaturalMobs.startTiming(); // Paper - timings int l = this.chunkMapDistance.b(); EnumCreatureType[] aenumcreaturetype = EnumCreatureType.values(); @@ -572,7 +572,7 @@ index a77b756fdfe404d364823daa90f005cfc5d09f20..bdd5060851ea553f1a0b56c8f8e95208 this.world.timings.countNaturalMobs.stopTiming(); // Paper - timings this.world.getMethodProfiler().exit(); -@@ -813,8 +828,23 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -814,8 +829,23 @@ public class ChunkProviderServer extends IChunkProvider { if (enumcreaturetype != EnumCreatureType.MISC && (!enumcreaturetype.c() || this.allowAnimals) && (enumcreaturetype.c() || this.allowMonsters) && (!enumcreaturetype.d() || flag2)) { int k1 = limit * l / ChunkProviderServer.b; // CraftBukkit - use per-world limits @@ -755,7 +755,7 @@ index fdac5bb3a2d4a73035e1d914979b87fc224b6b20..58bbf2f9d2ec91715051d40e108e1606 @Nullable diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index b5b8fdcab1c84b52d56ed67bbded745763915ff7..33819510e43d91025cb0c4eae45d840fb9d456ff 100644 +index 469f4e718ba123c65b9743877555f14d8d218589..1838add259a1a2919a80cc5d773ed89ed5d73c01 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -1031,7 +1031,20 @@ public class WorldServer extends World { diff --git a/Spigot-Server-Patches/0408-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch b/Spigot-Server-Patches/0408-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch index 9b0de986d9..00795377c5 100644 --- a/Spigot-Server-Patches/0408-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch +++ b/Spigot-Server-Patches/0408-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch @@ -19,10 +19,10 @@ index 24594aa0e9b8741811acfc9f84f4db7552832bd2..aada8d3b08b437f81f68f8e988412c10 if (enumhand == EnumHand.MAIN_HAND) { return this.getEquipment(EnumItemSlot.MAINHAND); diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index f00653dfe7a769992069582f1743b477edb47eb9..71d045ee00d1f172d88f076d15cf82bae2527ae8 100644 +index cf3e15e70ac22bbdd39153956cfdc6d2f8f44e2b..fd2b5148f885b79d7779ee1a04bfc4a445b2b618 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1430,6 +1430,10 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1437,6 +1437,10 @@ public class PlayerConnection implements PacketListenerPlayIn { if (cancelled) { this.player.getBukkitEntity().updateInventory(); // SPIGOT-2524 } else { diff --git a/Spigot-Server-Patches/0431-Optimise-getChunkAt-calls-for-loaded-chunks.patch b/Spigot-Server-Patches/0431-Optimise-getChunkAt-calls-for-loaded-chunks.patch index 62dd00bf9f..2f66ea3500 100644 --- a/Spigot-Server-Patches/0431-Optimise-getChunkAt-calls-for-loaded-chunks.patch +++ b/Spigot-Server-Patches/0431-Optimise-getChunkAt-calls-for-loaded-chunks.patch @@ -7,10 +7,10 @@ bypass the need to get a player chunk, then get the either, then unwrap it... diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index cbaf14b24b3d941f0912788c87c3eab5aad7f5f0..ea85f40f4d40f687f3feaf161d2248f2bcc39af2 100644 +index 7a4e2c350e78b22dc035471ad0d7191dfd7afede..4f65c3aca4e1c299114c03339605e0749a969653 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -434,6 +434,12 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -435,6 +435,12 @@ public class ChunkProviderServer extends IChunkProvider { return this.getChunkAt(i, j, chunkstatus, flag); }, this.serverThreadQueue).join(); } else { @@ -23,7 +23,7 @@ index cbaf14b24b3d941f0912788c87c3eab5aad7f5f0..ea85f40f4d40f687f3feaf161d2248f2 GameProfilerFiller gameprofilerfiller = this.world.getMethodProfiler(); gameprofilerfiller.c("getChunk"); -@@ -484,39 +490,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -485,39 +491,7 @@ public class ChunkProviderServer extends IChunkProvider { if (Thread.currentThread() != this.serverThread) { return null; } else { diff --git a/Spigot-Server-Patches/0441-Prevent-teleporting-dead-entities.patch b/Spigot-Server-Patches/0441-Prevent-teleporting-dead-entities.patch index 34aad718c7..70c177306b 100644 --- a/Spigot-Server-Patches/0441-Prevent-teleporting-dead-entities.patch +++ b/Spigot-Server-Patches/0441-Prevent-teleporting-dead-entities.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent teleporting dead entities diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 71d045ee00d1f172d88f076d15cf82bae2527ae8..2e81f3a1d93d66c94e9f0d425f9cee6db4940913 100644 +index fd2b5148f885b79d7779ee1a04bfc4a445b2b618..f675892e45b033cac5cbb6d86b70ba38bf67ebb3 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1209,6 +1209,10 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1216,6 +1216,10 @@ public class PlayerConnection implements PacketListenerPlayIn { } private void internalTeleport(double d0, double d1, double d2, float f, float f1, Set set) { diff --git a/Spigot-Server-Patches/0453-Optimize-Collision-to-not-load-chunks.patch b/Spigot-Server-Patches/0453-Optimize-Collision-to-not-load-chunks.patch index 26667627ad..564e388cb7 100644 --- a/Spigot-Server-Patches/0453-Optimize-Collision-to-not-load-chunks.patch +++ b/Spigot-Server-Patches/0453-Optimize-Collision-to-not-load-chunks.patch @@ -13,11 +13,37 @@ If that serting is not enabled, collisions will be ignored for players, since movement will load only the chunk the player enters anyways and avoids loading massive amounts of surrounding chunks due to large AABB lookups. +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index 7434f859f7f9acff0f881ff594c8dffdfa249c76..7fb34a86dc35cb4bf51e1ce5220e56642096fece 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -80,6 +80,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + private CraftEntity bukkitEntity; + + PlayerChunkMap.EntityTracker tracker; // Paper ++ boolean collisionLoadChunks = false; // Paper + Throwable addedToWorldStack; // Paper - entity debug + public CraftEntity getBukkitEntity() { + if (bukkitEntity == null) { diff --git a/src/main/java/net/minecraft/server/ICollisionAccess.java b/src/main/java/net/minecraft/server/ICollisionAccess.java -index f851ed11df14fd9aa8017f44d82fb6cfc3bde345..8b0670b8db0bb739fb54fee368a53eadeb72937e 100644 +index f851ed11df14fd9aa8017f44d82fb6cfc3bde345..667e6c8f94162b620a7157c7d3caba9369c37de1 100644 --- a/src/main/java/net/minecraft/server/ICollisionAccess.java +++ b/src/main/java/net/minecraft/server/ICollisionAccess.java -@@ -83,19 +83,33 @@ public interface ICollisionAccess extends IBlockAccess { +@@ -39,7 +39,12 @@ public interface ICollisionAccess extends IBlockAccess { + } + + default boolean getCubes(Entity entity, AxisAlignedBB axisalignedbb) { +- return this.a(entity, axisalignedbb, Collections.emptySet()); ++ // Paper start - load chunks for getCubes ++ entity.collisionLoadChunks = true; ++ boolean result = this.a(entity, axisalignedbb, Collections.emptySet()); ++ entity.collisionLoadChunks = false; ++ return result; ++ // Paper end + } + + default boolean a(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Set set) { +@@ -83,19 +88,33 @@ public interface ICollisionAccess extends IBlockAccess { } while (cursorposition.a()) { @@ -44,7 +70,7 @@ index f851ed11df14fd9aa8017f44d82fb6cfc3bde345..8b0670b8db0bb739fb54fee368a53ead + blockposition_mutableblockposition.setValues(x, y, z); + + boolean isRegionLimited = ICollisionAccess.this instanceof RegionLimitedWorldAccess; -+ IBlockData iblockdata = isRegionLimited ? Blocks.VOID_AIR.getBlockData() : (!far && entity instanceof EntityPlayer ++ IBlockData iblockdata = isRegionLimited ? Blocks.VOID_AIR.getBlockData() : ((!far && entity instanceof EntityPlayer) || (entity != null && entity.collisionLoadChunks) + ? ICollisionAccess.this.getType(blockposition_mutableblockposition) + : ICollisionAccess.this.getTypeIfLoaded(blockposition_mutableblockposition) + ); @@ -62,7 +88,7 @@ index f851ed11df14fd9aa8017f44d82fb6cfc3bde345..8b0670b8db0bb739fb54fee368a53ead if ((j2 != 1 || iblockdata.f()) && (j2 != 2 || iblockdata.getBlock() == Blocks.MOVING_PISTON)) { VoxelShape voxelshape2 = iblockdata.b((IBlockAccess) ICollisionAccess.this, blockposition_mutableblockposition, voxelshapecollision); diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 909d86e14c7860cd6d8a6f38ef4aedb183acae3f..b2c2d56e2be893dac5eb13d6648c5df65eb3ea4e 100644 +index b5389cc46bf7afffe59522149e3d5567ad455ef3..90a491491272cfc6787e7ac778c23def0cf4b33a 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -677,6 +677,7 @@ public abstract class PlayerList { diff --git a/Spigot-Server-Patches/0456-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch b/Spigot-Server-Patches/0456-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch index 49a29d43ff..71ba807c1b 100644 --- a/Spigot-Server-Patches/0456-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch +++ b/Spigot-Server-Patches/0456-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch @@ -50,10 +50,10 @@ index 0000000000000000000000000000000000000000..e0ad725b2e63ffd329fc4725d15290cb + } +} diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 7da40ea2fbc1aace8ca9fd8556501ad580efd240..1ee69b5c657feb468ec2834536c2cd178e0526f3 100644 +index fd998e4fb1534690a2ef8c1bca55e0ae9fe855f9..8f849d83d08b39f1cd9184f484a2089a7a3124ef 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -754,7 +754,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -755,7 +755,7 @@ public class ChunkProviderServer extends IChunkProvider { entityPlayer.playerNaturallySpawnedEvent.callEvent(); }; // Paper end diff --git a/Spigot-Server-Patches/0459-Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch b/Spigot-Server-Patches/0459-Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch index 7d78cef22d..6aa92c7107 100644 --- a/Spigot-Server-Patches/0459-Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch +++ b/Spigot-Server-Patches/0459-Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch @@ -56,10 +56,10 @@ index 647f6fc8efb350fbd0bc4c40358a998f8b89b96a..9f1662ece533f5ea744662b718e2d89a + } } diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 1ee69b5c657feb468ec2834536c2cd178e0526f3..3cda1c4fad1bd2c2220bd8b23964f556c8747f0b 100644 +index 8f849d83d08b39f1cd9184f484a2089a7a3124ef..5806ca545191e609bab04e522e358948cf32b21c 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -687,6 +687,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -688,6 +688,7 @@ public class ChunkProviderServer extends IChunkProvider { this.world.getMethodProfiler().enter("purge"); this.world.timings.doChunkMap.startTiming(); // Spigot this.chunkMapDistance.purgeTickets(); @@ -67,7 +67,7 @@ index 1ee69b5c657feb468ec2834536c2cd178e0526f3..3cda1c4fad1bd2c2220bd8b23964f556 this.tickDistanceManager(); this.world.timings.doChunkMap.stopTiming(); // Spigot this.world.getMethodProfiler().exitEnter("chunks"); -@@ -696,6 +697,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -697,6 +698,7 @@ public class ChunkProviderServer extends IChunkProvider { this.world.timings.doChunkUnload.startTiming(); // Spigot this.world.getMethodProfiler().exitEnter("unload"); this.playerChunkMap.unloadChunks(booleansupplier); @@ -75,7 +75,7 @@ index 1ee69b5c657feb468ec2834536c2cd178e0526f3..3cda1c4fad1bd2c2220bd8b23964f556 this.world.timings.doChunkUnload.stopTiming(); // Spigot this.world.getMethodProfiler().exit(); this.clearCache(); -@@ -754,7 +756,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -755,7 +757,7 @@ public class ChunkProviderServer extends IChunkProvider { entityPlayer.playerNaturallySpawnedEvent.callEvent(); }; // Paper end @@ -84,7 +84,7 @@ index 1ee69b5c657feb468ec2834536c2cd178e0526f3..3cda1c4fad1bd2c2220bd8b23964f556 Optional optional = ((Either) playerchunk.b().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); if (optional.isPresent()) { -@@ -837,6 +839,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -838,6 +840,7 @@ public class ChunkProviderServer extends IChunkProvider { this.world.timings.chunkTicks.startTiming(); // Spigot // Paper this.world.a(chunk, k); this.world.timings.chunkTicks.stopTiming(); // Spigot // Paper @@ -92,7 +92,7 @@ index 1ee69b5c657feb468ec2834536c2cd178e0526f3..3cda1c4fad1bd2c2220bd8b23964f556 } } }); -@@ -978,6 +981,41 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -979,6 +982,41 @@ public class ChunkProviderServer extends IChunkProvider { super.executeTask(runnable); } @@ -226,7 +226,7 @@ index 77adc64e30cbc1d4542eb8f4a446788c1fdc61be..3c25436f158316d2e09cbf4673365edd // Spigot Start CrashReport crashreport; diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 3979f151f067a62e45211c9f11e47e36dbe16b31..83fb6f71d2ce4e3a2a2750c953cfc1f1ef5e88ec 100644 +index c1e3c5ad7bbadedf01f7bd9162602398b81005a2..a4a2882d32d0167738f8367209dbfd3ca4f5b953 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -432,6 +432,7 @@ public class WorldServer extends World { diff --git a/Spigot-Server-Patches/0463-Implement-Chunk-Priority-Urgency-System-for-World-Ge.patch b/Spigot-Server-Patches/0463-Implement-Chunk-Priority-Urgency-System-for-World-Ge.patch index 74708610a6..8d3ae85e54 100644 --- a/Spigot-Server-Patches/0463-Implement-Chunk-Priority-Urgency-System-for-World-Ge.patch +++ b/Spigot-Server-Patches/0463-Implement-Chunk-Priority-Urgency-System-for-World-Ge.patch @@ -16,10 +16,10 @@ lots of chunks already. This massively reduces the lag spikes from sync chunk gens. diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 3cda1c4fad1bd2c2220bd8b23964f556c8747f0b..ca94bd901b266e722bb22e8662e6cd8dfbfef35b 100644 +index 5806ca545191e609bab04e522e358948cf32b21c..4cef51b68984f83b8153ee1f017a2c597194df19 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -468,6 +468,10 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -469,6 +469,10 @@ public class ChunkProviderServer extends IChunkProvider { if (!completablefuture.isDone()) { // Paper // Paper start - async chunk io/loading @@ -30,7 +30,7 @@ index 3cda1c4fad1bd2c2220bd8b23964f556c8747f0b..ca94bd901b266e722bb22e8662e6cd8d this.world.asyncChunkTaskManager.raisePriority(x, z, com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGHEST_PRIORITY); com.destroystokyo.paper.io.chunk.ChunkTaskManager.pushChunkWait(this.world, x, z); // Paper end -@@ -477,6 +481,10 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -478,6 +482,10 @@ public class ChunkProviderServer extends IChunkProvider { com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug this.world.timings.syncChunkLoad.stopTiming(); // Paper } // Paper @@ -41,7 +41,7 @@ index 3cda1c4fad1bd2c2220bd8b23964f556c8747f0b..ca94bd901b266e722bb22e8662e6cd8d ichunkaccess = (IChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { return ichunkaccess1; }, (playerchunk_failure) -> { -@@ -540,6 +548,11 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -541,6 +549,11 @@ public class ChunkProviderServer extends IChunkProvider { } } } diff --git a/Spigot-Server-Patches/0477-Optimise-entity-hard-collision-checking.patch b/Spigot-Server-Patches/0477-Optimise-entity-hard-collision-checking.patch index da450aa956..757dc5573f 100644 --- a/Spigot-Server-Patches/0477-Optimise-entity-hard-collision-checking.patch +++ b/Spigot-Server-Patches/0477-Optimise-entity-hard-collision-checking.patch @@ -88,10 +88,10 @@ index 33456b0bb421d253aa8366210f41a9da7dcd1699..750fb07756f7e40b21f8ab0925f2e842 } if (entity instanceof EntityItem) { diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 0dbe2dce111673f94d0618c7ac80262189f2926f..324fd07bcee9fed7bdb5b2b47ef01ce341282c93 100644 +index 7fb34a86dc35cb4bf51e1ce5220e56642096fece..f20f798f0f7bb765ffdab8672f4bf77a60fa52d2 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -210,6 +210,40 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -211,6 +211,40 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } // CraftBukkit end diff --git a/Spigot-Server-Patches/0478-Optimize-ChunkProviderServer-s-chunk-level-checking-.patch b/Spigot-Server-Patches/0478-Optimize-ChunkProviderServer-s-chunk-level-checking-.patch index d399056cdb..95ee649661 100644 --- a/Spigot-Server-Patches/0478-Optimize-ChunkProviderServer-s-chunk-level-checking-.patch +++ b/Spigot-Server-Patches/0478-Optimize-ChunkProviderServer-s-chunk-level-checking-.patch @@ -9,10 +9,10 @@ so inline where possible, and avoid the abstraction of the Either class. diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index fb315503b0aad2cb52cb70b5b033d33fcecd1d22..edf0cf3680e5d2212f35c9d4464b22e0f3e87342 100644 +index 4cef51b68984f83b8153ee1f017a2c597194df19..fe93e8cd892688a7cb407ef051eb7cac719a7f5b 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -618,27 +618,37 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -619,27 +619,37 @@ public class ChunkProviderServer extends IChunkProvider { public final boolean isInEntityTickingChunk(Entity entity) { return this.a(entity); } // Paper - OBFHELPER @Override public boolean a(Entity entity) { diff --git a/Spigot-Server-Patches/0481-Fix-Chunk-Post-Processing-deadlock-risk.patch b/Spigot-Server-Patches/0481-Fix-Chunk-Post-Processing-deadlock-risk.patch index 02000ab735..0106c9408b 100644 --- a/Spigot-Server-Patches/0481-Fix-Chunk-Post-Processing-deadlock-risk.patch +++ b/Spigot-Server-Patches/0481-Fix-Chunk-Post-Processing-deadlock-risk.patch @@ -25,10 +25,10 @@ This successfully fixed a reoccurring and highly reproduceable crash for heightmaps. diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index edf0cf3680e5d2212f35c9d4464b22e0f3e87342..c3528212ae1bfbdbe6910bcd775990b9b638afaf 100644 +index fe93e8cd892688a7cb407ef051eb7cac719a7f5b..99be314307071e7b85ba444dcab923dd4edf0ddb 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -1051,6 +1051,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -1052,6 +1052,7 @@ public class ChunkProviderServer extends IChunkProvider { return super.executeNext() || execChunkTask; // Paper } } finally { diff --git a/Spigot-Server-Patches/0485-Load-Chunks-for-Login-Asynchronously.patch b/Spigot-Server-Patches/0485-Load-Chunks-for-Login-Asynchronously.patch index 3045928639..191a97c0bd 100644 --- a/Spigot-Server-Patches/0485-Load-Chunks-for-Login-Asynchronously.patch +++ b/Spigot-Server-Patches/0485-Load-Chunks-for-Login-Asynchronously.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Load Chunks for Login Asynchronously diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 1a97e7aeb9b9dcf0611139ddc69e90354194708f..7df66f0399d3ce346ba205f941f9e0bdc65f3781 100644 +index f20f798f0f7bb765ffdab8672f4bf77a60fa52d2..9eab570e48817e18d10ddde95b3f80f7e4ea4766 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1383,7 +1383,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1384,7 +1384,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke this.pitch = MathHelper.a(f1, -90.0F, 90.0F) % 360.0F; this.lastYaw = this.yaw; this.lastPitch = this.pitch; @@ -60,7 +60,7 @@ index f1222fcb2bd52b8781d0f92c94e1472fa7b1e493..28f48f22522ef8c3c66381abcf017f08 if (entityplayer != null) { this.g = LoginListener.EnumProtocolState.DELAY_ACCEPT; diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 2e81f3a1d93d66c94e9f0d425f9cee6db4940913..d77b28ab4a5fc93a325a0d5594f66f4f143bd318 100644 +index f675892e45b033cac5cbb6d86b70ba38bf67ebb3..51d6ef69e7256dda2491837b5edf8f83cd0346ea 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -69,6 +69,7 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -97,7 +97,7 @@ index 2e81f3a1d93d66c94e9f0d425f9cee6db4940913..d77b28ab4a5fc93a325a0d5594f66f4f this.minecraftServer.getMethodProfiler().enter("keepAlive"); // Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 6a4e4f93eb36ca388523a36abf38bcae3ad375e8..61c7f5f9528ceea34af8dbf4503b9c320b7f67a1 100644 +index e5177bb6a20e5f5952b2fcad201a166c2c51510b..9a9c124e6af1fb40255ffaa38d0a4e024ad72436 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -52,11 +52,12 @@ public abstract class PlayerList { diff --git a/Spigot-Server-Patches/0486-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch b/Spigot-Server-Patches/0486-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch index cab0160c8c..3e1193387b 100644 --- a/Spigot-Server-Patches/0486-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch +++ b/Spigot-Server-Patches/0486-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch @@ -7,10 +7,10 @@ The code following this has better support for null worlds to move them back to the world spawn. diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 7df66f0399d3ce346ba205f941f9e0bdc65f3781..c4f56fc4ba0e6da5e24ab3c1ac4e4a15235442bc 100644 +index 9eab570e48817e18d10ddde95b3f80f7e4ea4766..0a7e4449407104fe6c0ff7d00bd1f32eb074e10a 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1791,9 +1791,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1792,9 +1792,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke bworld = server.getWorld(worldName); } diff --git a/Spigot-Server-Patches/0492-Fix-numerous-item-duplication-issues-and-teleport-is.patch b/Spigot-Server-Patches/0492-Fix-numerous-item-duplication-issues-and-teleport-is.patch index 1635277aac..f84bff743e 100644 --- a/Spigot-Server-Patches/0492-Fix-numerous-item-duplication-issues-and-teleport-is.patch +++ b/Spigot-Server-Patches/0492-Fix-numerous-item-duplication-issues-and-teleport-is.patch @@ -16,10 +16,10 @@ So even if something NEW comes up, it would be impossible to drop the same item twice because the source was destroyed. diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index c4f56fc4ba0e6da5e24ab3c1ac4e4a15235442bc..08895dfa7ad856f66c8577834dc875d115896216 100644 +index 0a7e4449407104fe6c0ff7d00bd1f32eb074e10a..6dea557fa32fd44674bf01e2f7429c9691c315b8 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1967,11 +1967,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1968,11 +1968,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } else { // CraftBukkit start - Capture drops for death event if (this instanceof EntityLiving && !((EntityLiving) this).forceDrops) { @@ -34,7 +34,7 @@ index c4f56fc4ba0e6da5e24ab3c1ac4e4a15235442bc..08895dfa7ad856f66c8577834dc875d1 entityitem.defaultPickupDelay(); // CraftBukkit start -@@ -2634,6 +2635,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2635,6 +2636,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @Nullable public Entity teleportTo(DimensionManager dimensionmanager, BlockPosition location) { // CraftBukkit end @@ -47,7 +47,7 @@ index c4f56fc4ba0e6da5e24ab3c1ac4e4a15235442bc..08895dfa7ad856f66c8577834dc875d1 if (!this.world.isClientSide && !this.dead) { this.world.getMethodProfiler().enter("changeDimension"); MinecraftServer minecraftserver = this.getMinecraftServer(); -@@ -2759,7 +2766,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2760,7 +2767,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } public boolean canPortal() { diff --git a/Spigot-Server-Patches/0493-Implement-Brigadier-Mojang-API.patch b/Spigot-Server-Patches/0493-Implement-Brigadier-Mojang-API.patch index d587f00167..257973d359 100644 --- a/Spigot-Server-Patches/0493-Implement-Brigadier-Mojang-API.patch +++ b/Spigot-Server-Patches/0493-Implement-Brigadier-Mojang-API.patch @@ -69,10 +69,10 @@ index 0b23a0548d52a30c064d624e39a896a9791aab3b..c988c929f1063b417d10d84b0c131277 public boolean hasPermission(int i) { // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 0ad23cd1f79621e64fa25582b36b1b26301e2264..13b4bab38203eccf09d805c441615f61bc796190 100644 +index 0deb0c17259d53c12f0e26e19a0a08666e38f871..0fd2c17f8c4b556364e359b72d6e56a5c93d727f 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -574,8 +574,12 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -581,8 +581,12 @@ public class PlayerConnection implements PacketListenerPlayIn { ParseResults parseresults = this.minecraftServer.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener()); this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { @@ -87,7 +87,7 @@ index 0ad23cd1f79621e64fa25582b36b1b26301e2264..13b4bab38203eccf09d805c441615f61 }); }); // Paper - This needs to be on main } -@@ -585,7 +589,11 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -592,7 +596,11 @@ public class PlayerConnection implements PacketListenerPlayIn { builder = builder.createOffset(builder.getInput().lastIndexOf(' ') + 1); completions.forEach(builder::suggest); diff --git a/Spigot-Server-Patches/0495-Validate-PickItem-Packet-and-kick-for-invalid.patch b/Spigot-Server-Patches/0495-Validate-PickItem-Packet-and-kick-for-invalid.patch index 630b79977d..889cf6cd23 100644 --- a/Spigot-Server-Patches/0495-Validate-PickItem-Packet-and-kick-for-invalid.patch +++ b/Spigot-Server-Patches/0495-Validate-PickItem-Packet-and-kick-for-invalid.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Validate PickItem Packet and kick for invalid diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 13b4bab38203eccf09d805c441615f61bc796190..76df4bdf8831f993d52bb6561ff5e05c774811e7 100644 +index 0fd2c17f8c4b556364e359b72d6e56a5c93d727f..066438f4ace35310d363e856a22e2f8b48445768 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -689,7 +689,14 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -696,7 +696,14 @@ public class PlayerConnection implements PacketListenerPlayIn { @Override public void a(PacketPlayInPickItem packetplayinpickitem) { PlayerConnectionUtils.ensureMainThread(packetplayinpickitem, this, this.player.getWorldServer()); diff --git a/Spigot-Server-Patches/0497-Sync-position-on-teleportation.patch b/Spigot-Server-Patches/0497-Sync-position-on-teleportation.patch index 4df9429ea5..23b911b349 100644 --- a/Spigot-Server-Patches/0497-Sync-position-on-teleportation.patch +++ b/Spigot-Server-Patches/0497-Sync-position-on-teleportation.patch @@ -13,7 +13,7 @@ it is triggering a massive movement velocity. This will ensure that the servers position is synchronized anytime player is teleported. diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 76df4bdf8831f993d52bb6561ff5e05c774811e7..10155fcfa5936c6fce2300e21352c5a56b75de6c 100644 +index 066438f4ace35310d363e856a22e2f8b48445768..38775d0eec4b6e25f5b2b39e85463190dee92515 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -498,6 +498,7 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -24,7 +24,7 @@ index 76df4bdf8831f993d52bb6561ff5e05c774811e7..10155fcfa5936c6fce2300e21352c5a5 if (this.player.H()) { this.player.I(); } -@@ -1269,6 +1270,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1276,6 +1277,7 @@ public class PlayerConnection implements PacketListenerPlayIn { this.A = this.e; this.player.setLocation(d0, d1, d2, f, f1); diff --git a/Spigot-Server-Patches/0502-Use-distance-map-to-optimise-entity-tracker.patch b/Spigot-Server-Patches/0502-Use-distance-map-to-optimise-entity-tracker.patch index 8eecf7244d..5894f56ccd 100644 --- a/Spigot-Server-Patches/0502-Use-distance-map-to-optimise-entity-tracker.patch +++ b/Spigot-Server-Patches/0502-Use-distance-map-to-optimise-entity-tracker.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Use distance map to optimise entity tracker Use the distance map to find candidate players for tracking. diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 14ba037c1dc042f81123b3f31ad5c3485e59b773..8820e4b6506f645b98d23fe6eab044cc6cd54427 100644 +index 6dea557fa32fd44674bf01e2f7429c9691c315b8..c005734f835fd07b121fdb885d981e55f8be81b4 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -244,6 +244,21 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -245,6 +245,21 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } // Paper end diff --git a/Spigot-Server-Patches/0503-Optimize-isOutsideRange-to-use-distance-maps.patch b/Spigot-Server-Patches/0503-Optimize-isOutsideRange-to-use-distance-maps.patch index 614314c4ce..e752c51535 100644 --- a/Spigot-Server-Patches/0503-Optimize-isOutsideRange-to-use-distance-maps.patch +++ b/Spigot-Server-Patches/0503-Optimize-isOutsideRange-to-use-distance-maps.patch @@ -77,10 +77,10 @@ index 279c7a85fb5b4bff91fba1c9797c902bd68d8539..7cd4e2912351eae35b46dba1c8a471af public String c() { diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index c3528212ae1bfbdbe6910bcd775990b9b638afaf..89017e002f4381ffdae1678349d674474088fb4f 100644 +index 99be314307071e7b85ba444dcab923dd4edf0ddb..8ca6adbac2d2e43bf597c405134c1c5c1b430e63 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -736,6 +736,36 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -737,6 +737,36 @@ public class ChunkProviderServer extends IChunkProvider { boolean flag1 = this.world.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING) && !world.getPlayers().isEmpty(); // CraftBukkit if (!flag) { @@ -117,7 +117,7 @@ index c3528212ae1bfbdbe6910bcd775990b9b638afaf..89017e002f4381ffdae1678349d67447 this.world.getMethodProfiler().enter("pollingChunks"); int k = this.world.getGameRules().getInt(GameRules.RANDOM_TICK_SPEED); BlockPosition blockposition = this.world.getSpawn(); -@@ -770,15 +800,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -771,15 +801,7 @@ public class ChunkProviderServer extends IChunkProvider { this.world.timings.countNaturalMobs.stopTiming(); // Paper - timings this.world.getMethodProfiler().exit(); @@ -134,7 +134,7 @@ index c3528212ae1bfbdbe6910bcd775990b9b638afaf..89017e002f4381ffdae1678349d67447 final int[] chunksTicked = {0}; this.playerChunkMap.forEachVisibleChunk((playerchunk) -> { // Paper - safe iterator incase chunk loads, also no wrapping Optional optional = ((Either) playerchunk.b().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); -@@ -792,10 +814,10 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -793,10 +815,10 @@ public class ChunkProviderServer extends IChunkProvider { this.world.getMethodProfiler().exit(); ChunkCoordIntPair chunkcoordintpair = playerchunk.i(); diff --git a/Spigot-Server-Patches/0513-Implement-JellySquid-s-Entity-Collision-optimisation.patch b/Spigot-Server-Patches/0513-Implement-JellySquid-s-Entity-Collision-optimisation.patch index 50824c0845..efa4daee41 100644 --- a/Spigot-Server-Patches/0513-Implement-JellySquid-s-Entity-Collision-optimisation.patch +++ b/Spigot-Server-Patches/0513-Implement-JellySquid-s-Entity-Collision-optimisation.patch @@ -9,10 +9,10 @@ Original code by JellySquid, licensed under GNU Lesser General Public License v3 you can find the original code on https://github.com/jellysquid3/lithium-fabric/tree/1.15.x/fabric (Yarn mappings) diff --git a/src/main/java/net/minecraft/server/ICollisionAccess.java b/src/main/java/net/minecraft/server/ICollisionAccess.java -index 8b0670b8db0bb739fb54fee368a53eadeb72937e..c501dad733b6e6fe89673b35a307e02d474570b6 100644 +index 667e6c8f94162b620a7157c7d3caba9369c37de1..ace1bb5bb89be256a7dc716f97429ee64b3c575f 100644 --- a/src/main/java/net/minecraft/server/ICollisionAccess.java +++ b/src/main/java/net/minecraft/server/ICollisionAccess.java -@@ -113,11 +113,24 @@ public interface ICollisionAccess extends IBlockAccess { +@@ -118,11 +118,24 @@ public interface ICollisionAccess extends IBlockAccess { if ((j2 != 1 || iblockdata.f()) && (j2 != 2 || iblockdata.getBlock() == Blocks.MOVING_PISTON)) { VoxelShape voxelshape2 = iblockdata.b((IBlockAccess) ICollisionAccess.this, blockposition_mutableblockposition, voxelshapecollision); diff --git a/Spigot-Server-Patches/0514-Remove-some-Streams-usage-in-Entity-Collision.patch b/Spigot-Server-Patches/0514-Remove-some-Streams-usage-in-Entity-Collision.patch index 60043775c0..7aa2130957 100644 --- a/Spigot-Server-Patches/0514-Remove-some-Streams-usage-in-Entity-Collision.patch +++ b/Spigot-Server-Patches/0514-Remove-some-Streams-usage-in-Entity-Collision.patch @@ -21,10 +21,10 @@ index e865a5694f78fb9273a0625ab2c30b87d0711a90..5648ba73c533f622c35c808decdb305f default Stream b(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Set set) { return IEntityAccess.super.b(entity, axisalignedbb, set); diff --git a/src/main/java/net/minecraft/server/ICollisionAccess.java b/src/main/java/net/minecraft/server/ICollisionAccess.java -index c501dad733b6e6fe89673b35a307e02d474570b6..b98037a1af4cce52fb85867ed778c4e9aadced0b 100644 +index ace1bb5bb89be256a7dc716f97429ee64b3c575f..0295e563aa027be5ca1a7eb78727aacf18729025 100644 --- a/src/main/java/net/minecraft/server/ICollisionAccess.java +++ b/src/main/java/net/minecraft/server/ICollisionAccess.java -@@ -43,18 +43,39 @@ public interface ICollisionAccess extends IBlockAccess { +@@ -48,18 +48,39 @@ public interface ICollisionAccess extends IBlockAccess { } default boolean a(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Set set) { @@ -66,7 +66,7 @@ index c501dad733b6e6fe89673b35a307e02d474570b6..b98037a1af4cce52fb85867ed778c4e9 int i = MathHelper.floor(axisalignedbb.minX - 1.0E-7D) - 1; int j = MathHelper.floor(axisalignedbb.maxX + 1.0E-7D) + 1; int k = MathHelper.floor(axisalignedbb.minY - 1.0E-7D) - 1; -@@ -66,19 +87,19 @@ public interface ICollisionAccess extends IBlockAccess { +@@ -71,19 +92,19 @@ public interface ICollisionAccess extends IBlockAccess { final BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); final VoxelShape voxelshape = VoxelShapes.a(axisalignedbb); @@ -94,7 +94,7 @@ index c501dad733b6e6fe89673b35a307e02d474570b6..b98037a1af4cce52fb85867ed778c4e9 } } -@@ -102,9 +123,8 @@ public interface ICollisionAccess extends IBlockAccess { +@@ -107,9 +128,8 @@ public interface ICollisionAccess extends IBlockAccess { ); if (iblockdata == null) { if (!(entity instanceof EntityPlayer) || entity.world.paperConfig.preventMovingIntoUnloadedChunks) { @@ -106,7 +106,7 @@ index c501dad733b6e6fe89673b35a307e02d474570b6..b98037a1af4cce52fb85867ed778c4e9 } } else { //blockposition_mutableblockposition.d(k1, l1, i2); // moved up -@@ -121,14 +141,14 @@ public interface ICollisionAccess extends IBlockAccess { +@@ -126,14 +146,14 @@ public interface ICollisionAccess extends IBlockAccess { if (voxelshape2 == VoxelShapes.fullCube()) { if (axisalignedbb.intersects(x, y, z, x + 1.0D, y + 1.0D, z + 1.0D)) { @@ -125,7 +125,7 @@ index c501dad733b6e6fe89673b35a307e02d474570b6..b98037a1af4cce52fb85867ed778c4e9 } // Paper end } -@@ -137,8 +157,9 @@ public interface ICollisionAccess extends IBlockAccess { +@@ -142,8 +162,9 @@ public interface ICollisionAccess extends IBlockAccess { } } diff --git a/Spigot-Server-Patches/0515-Ensure-Entity-AABB-s-are-never-invalid.patch b/Spigot-Server-Patches/0515-Ensure-Entity-AABB-s-are-never-invalid.patch index d7dd3f6ff6..940e4508c4 100644 --- a/Spigot-Server-Patches/0515-Ensure-Entity-AABB-s-are-never-invalid.patch +++ b/Spigot-Server-Patches/0515-Ensure-Entity-AABB-s-are-never-invalid.patch @@ -11,10 +11,10 @@ This guarantees any time we set the entities position, we also update their AABB. diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index cd2c183828c884ae6f9350009475a7a83982a2f8..149c22e6d5c5974250b04a20dd2a8c8379a8f7c3 100644 +index c005734f835fd07b121fdb885d981e55f8be81b4..c5adac15d726dd03853cef10758a21e5ce690567 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -415,10 +415,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -416,10 +416,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke public void setPosition(double d0, double d1, double d2) { this.setPositionRaw(d0, d1, d2); @@ -30,7 +30,7 @@ index cd2c183828c884ae6f9350009475a7a83982a2f8..149c22e6d5c5974250b04a20dd2a8c83 if (valid) ((WorldServer) world).chunkCheck(this); // CraftBukkit } -@@ -2980,6 +2981,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2981,6 +2982,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke return new AxisAlignedBB(vec3d, vec3d1); } @@ -38,7 +38,7 @@ index cd2c183828c884ae6f9350009475a7a83982a2f8..149c22e6d5c5974250b04a20dd2a8c83 public void a(AxisAlignedBB axisalignedbb) { // CraftBukkit start - block invalid bounding boxes double minX = axisalignedbb.minX, -@@ -3438,6 +3440,14 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -3439,6 +3441,14 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } public void setPositionRaw(double d0, double d1, double d2) { diff --git a/Spigot-Server-Patches/0518-Optimize-WorldBorder-collision-checks-and-air.patch b/Spigot-Server-Patches/0518-Optimize-WorldBorder-collision-checks-and-air.patch index 8123fb6daf..c7f9d8af06 100644 --- a/Spigot-Server-Patches/0518-Optimize-WorldBorder-collision-checks-and-air.patch +++ b/Spigot-Server-Patches/0518-Optimize-WorldBorder-collision-checks-and-air.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimize WorldBorder collision checks and air diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 149c22e6d5c5974250b04a20dd2a8c8379a8f7c3..182b08677728f1bbd19e415d4b434604ef7a0638 100644 +index c5adac15d726dd03853cef10758a21e5ce690567..14b83940080e934dcc3622cc90e623ad48c0b1d1 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -844,7 +844,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -845,7 +845,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke AxisAlignedBB axisalignedbb = this.getBoundingBox(); VoxelShapeCollision voxelshapecollision = VoxelShapeCollision.a(this); VoxelShape voxelshape = this.world.getWorldBorder().a(); @@ -18,10 +18,10 @@ index 149c22e6d5c5974250b04a20dd2a8c8379a8f7c3..182b08677728f1bbd19e415d4b434604 StreamAccumulator streamaccumulator = new StreamAccumulator<>(Stream.concat(stream1, stream)); Vec3D vec3d1 = vec3d.g() == 0.0D ? vec3d : a(this, vec3d, axisalignedbb, this.world, voxelshapecollision, streamaccumulator); diff --git a/src/main/java/net/minecraft/server/ICollisionAccess.java b/src/main/java/net/minecraft/server/ICollisionAccess.java -index b98037a1af4cce52fb85867ed778c4e9aadced0b..72d0840c4f8ca85645fb659a7ec642a9af2bbf15 100644 +index 0295e563aa027be5ca1a7eb78727aacf18729025..dae8dd67bb7a94132ff421eff40fed73aa649c67 100644 --- a/src/main/java/net/minecraft/server/ICollisionAccess.java +++ b/src/main/java/net/minecraft/server/ICollisionAccess.java -@@ -93,12 +93,12 @@ public interface ICollisionAccess extends IBlockAccess { +@@ -98,12 +98,12 @@ public interface ICollisionAccess extends IBlockAccess { if (true) { //public boolean tryAdvance(Consumer consumer) {*/ // Paper if (entity != null) { // Paper end @@ -38,7 +38,7 @@ index b98037a1af4cce52fb85867ed778c4e9aadced0b..72d0840c4f8ca85645fb659a7ec642a9 if (returnFast) return collisions; } } -@@ -131,7 +131,7 @@ public interface ICollisionAccess extends IBlockAccess { +@@ -136,7 +136,7 @@ public interface ICollisionAccess extends IBlockAccess { //IBlockData iblockdata = iblockaccess.getType(blockposition_mutableblockposition); // moved up // Paper end