Update the view distance before scheduling chunk loads (#5269)

This commit is contained in:
froobynooby 2021-04-15 18:21:27 +09:30
parent 3d9382e8ac
commit ab75d99f1c

View File

@ -309,6 +309,35 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit end
@@ -0,0 +0,0 @@ public abstract class ChunkMapDistance {
class c extends ChunkMapDistance.b {
- private int e = 0;
+ private int e = 0; private int getViewDistance() { return e; } private void setViewDistance(int value) { this.e = value; } // Paper - OBFHELPER
private final Long2IntMap f = Long2IntMaps.synchronize(new Long2IntOpenHashMap());
private final LongSet g = new LongOpenHashSet();
@@ -0,0 +0,0 @@ public abstract class ChunkMapDistance {
public void a(int i) {
ObjectIterator objectiterator = this.a.long2ByteEntrySet().iterator();
+ // Paper start - set the view distance before scheduling chunk loads/unloads
+ int lastViewDistance = getViewDistance();
+ setViewDistance(i);
+ // Paper end
while (objectiterator.hasNext()) {
Long2ByteMap.Entry it_unimi_dsi_fastutil_longs_long2bytemap_entry = (Long2ByteMap.Entry) objectiterator.next(); // Paper - decompile fix
byte b0 = it_unimi_dsi_fastutil_longs_long2bytemap_entry.getByteValue();
long j = it_unimi_dsi_fastutil_longs_long2bytemap_entry.getLongKey();
- this.a(j, b0, this.c(b0), b0 <= i - 2);
+ this.a(j, b0, b0 <= lastViewDistance - 2, this.c(b0)); // Paper
}
- this.e = i;
+ //this.e = i; // Paper - view distance is now set further up
}
private void a(long i, int j, boolean flag, boolean flag1) {
if (flag != flag1) {
- Ticket<?> ticket = new Ticket<>(TicketType.PLAYER, 33, new ChunkCoordIntPair(i)); // Paper - no-tick view distance