2019-07-11 16:59:21 +00:00
From 258e62129db2aeb3cdabadfeaf0baf682ab9d983 Mon Sep 17 00:00:00 2001
2019-06-19 22:48:48 +00:00
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Sun, 16 Jun 2019 23:30:25 -0700
Subject: [PATCH] Fix MC-154214
Avoid adding player tickets when they're out of range of the closest player
diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java
2019-07-11 16:59:21 +00:00
index 99c7537ef..757b505ea 100644
2019-06-19 22:48:48 +00:00
--- a/src/main/java/net/minecraft/server/ChunkMapDistance.java
+++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java
2019-07-11 16:59:21 +00:00
@@ -359,12 +359,18 @@ public abstract class ChunkMapDistance {
2019-06-19 22:48:48 +00:00
}
private void a(long i, int j, boolean flag, boolean flag1) {
+ final long chunkPosition = i; // Paper - conflict on variable change
if (flag != flag1) {
Ticket<?> ticket = new Ticket<>(TicketType.PLAYER, ChunkMapDistance.b, new ChunkCoordIntPair(i), ChunkMapDistance.this.currentTick);
if (flag1) {
2019-07-11 16:59:21 +00:00
ChunkMapDistance.this.j.a(ChunkTaskQueueSorter.a(() -> { // Craftbukkit - decompile error
2019-06-25 01:47:58 +00:00
ChunkMapDistance.this.m.execute(() -> {
2019-06-19 22:48:48 +00:00
+ // Paper start - Fix MC-154214
+ if (!this.inRange(this.getNearestDistanceFromPlayerMap().get(chunkPosition))) {
+ return;
+ }
+ // Paper end
ChunkMapDistance.this.a(i, ticket);
2019-06-25 01:47:58 +00:00
ChunkMapDistance.this.l.add(i);
2019-06-19 22:48:48 +00:00
});
2019-07-11 16:59:21 +00:00
@@ -408,6 +414,7 @@ public abstract class ChunkMapDistance {
2019-06-19 22:48:48 +00:00
}
+ private final boolean inRange(int distance) { return this.c(distance); } // Paper - OBFHELPER
private boolean c(int i) {
return i <= this.e - 2;
}
2019-07-11 16:59:21 +00:00
@@ -415,7 +422,7 @@ public abstract class ChunkMapDistance {
2019-06-19 22:48:48 +00:00
class b extends ChunkMap {
- protected final Long2ByteMap a = new Long2ByteOpenHashMap();
+ protected final Long2ByteMap a = new Long2ByteOpenHashMap(); protected final Long2ByteMap getNearestDistanceFromPlayerMap() { return this.a; } // Paper - OBFHELPER
protected final int b;
protected b(int i) {
--
2019-06-25 01:47:58 +00:00
2.22.0
2019-06-19 22:48:48 +00:00