From 5e62aca6c99dfd4e2f60d7e8b047c1df9912e656 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Sun, 13 Jun 2021 20:06:11 -0700 Subject: [PATCH] small fixes --- .../0365-implement-optional-per-player-mob-spawns.patch | 6 +++--- ...-multiple-callbacks-to-schedule-for-Callback-Ex.patch | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/patches/server/0365-implement-optional-per-player-mob-spawns.patch b/patches/server/0365-implement-optional-per-player-mob-spawns.patch index 8d1082349a..1ca06b50fd 100644 --- a/patches/server/0365-implement-optional-per-player-mob-spawns.patch +++ b/patches/server/0365-implement-optional-per-player-mob-spawns.patch @@ -41,7 +41,7 @@ index be4a36df28d4f16727daad1270d5c3a84ae94613..16f013ffe992a934e9d0b32e764a14a8 diff --git a/src/main/java/com/destroystokyo/paper/util/PlayerMobDistanceMap.java b/src/main/java/com/destroystokyo/paper/util/PlayerMobDistanceMap.java new file mode 100644 -index 0000000000000000000000000000000000000000..2a87599922d7075a9f888f48a2deb35ed3eb7c54 +index 0000000000000000000000000000000000000000..72063ba7fb0d04594043cb07034590d597c3d77e --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/PlayerMobDistanceMap.java @@ -0,0 +1,252 @@ @@ -92,7 +92,7 @@ index 0000000000000000000000000000000000000000..2a87599922d7075a9f888f48a2deb35e + + gone.remove(player); + -+ final SectionPos newPosition = player.getPlayerMapSection(); ++ final SectionPos newPosition = player.getLastSectionPos(); + final SectionPos oldPosition = this.players.put(player, newPosition); + + if (oldPosition == null) { @@ -117,7 +117,7 @@ index 0000000000000000000000000000000000000000..2a87599922d7075a9f888f48a2deb35e + int expectedEntries = (2 * viewDistance + 1); + expectedEntries *= expectedEntries; + -+ final SectionPos currPosition = player.getPlayerMapSection(); ++ final SectionPos currPosition = player.getLastSectionPos(); + + final int centerX = currPosition.getX(); + final int centerZ = currPosition.getZ(); diff --git a/patches/server/0413-Allow-multiple-callbacks-to-schedule-for-Callback-Ex.patch b/patches/server/0413-Allow-multiple-callbacks-to-schedule-for-Callback-Ex.patch index 2dc86442f7..9ced634f50 100644 --- a/patches/server/0413-Allow-multiple-callbacks-to-schedule-for-Callback-Ex.patch +++ b/patches/server/0413-Allow-multiple-callbacks-to-schedule-for-Callback-Ex.patch @@ -14,10 +14,10 @@ Use an ArrayDeque to store this Queue We make sure to also implement a pattern that is recursion safe too. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 6c763b5407425b764839b921f4dc9e18d76442cd..f81c7a6bf2ba1564874a7865cde3c4f36e28055a 100644 +index 6c763b5407425b764839b921f4dc9e18d76442cd..f9fcf99ec7151b4f00ef2c40b0cbc2fd3a8e002c 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -174,15 +174,27 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -174,17 +174,29 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public final CallbackExecutor callbackExecutor = new CallbackExecutor(); public static final class CallbackExecutor implements java.util.concurrent.Executor, Runnable { @@ -44,5 +44,8 @@ index 6c763b5407425b764839b921f4dc9e18d76442cd..f81c7a6bf2ba1564874a7865cde3c4f3 + this.queue = null; + // Paper end Runnable task; - while ((task = this.queue.poll()) != null) { +- while ((task = this.queue.poll()) != null) { ++ while ((task = queue.poll()) != null) { // Paper task.run(); + } + }