small fixes

This commit is contained in:
Jason Penilla 2021-06-13 20:06:11 -07:00
parent 3d7b0490c0
commit 5e62aca6c9
No known key found for this signature in database
GPG key ID: 0E75A301420E48F8
2 changed files with 9 additions and 6 deletions

View file

@ -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();

View file

@ -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();
}
}