Fix issue with setting player view distance

This commit is contained in:
totokaka 2016-06-18 20:52:11 -05:00 committed by Zach Brown
parent c8643cef2e
commit 4d7917a87d
No known key found for this signature in database
GPG key ID: CC9DA35FC5450B76
2 changed files with 25 additions and 11 deletions

View file

@ -1,4 +1,4 @@
From 46f5d6421b1810d3697ca89d3fb027608a9a74a2 Mon Sep 17 00:00:00 2001
From 7d7c82acdf08a76fa3f6a7fd6102d8b753df457c Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Wed, 2 Mar 2016 14:35:27 -0600
Subject: [PATCH] Add player view distance API
@ -25,7 +25,7 @@ index 522c7f2..4950db4 100644
// CraftBukkit start
public String displayName;
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 797a84f..d554d7d 100644
index 797a84f..df6801f 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -47,7 +47,7 @@ public class PlayerChunkMap {
@ -37,7 +37,21 @@ index 797a84f..d554d7d 100644
private long k;
private boolean l = true;
private boolean m = true;
@@ -303,8 +303,11 @@ public class PlayerChunkMap {
@@ -283,8 +283,11 @@ public class PlayerChunkMap {
// CraftBukkit start - Load nearby chunks first
List<ChunkCoordIntPair> chunkList = new LinkedList<ChunkCoordIntPair>();
- for (int k = i - this.j; k <= i + this.j; ++k) {
- for (int l = j - this.j; l <= j + this.j; ++l) {
+ // Paper start - Player view distance API
+ int viewDistance = entityplayer.getViewDistance();
+ for (int k = i - viewDistance; k <= i + viewDistance; ++k) {
+ for (int l = j - viewDistance; l <= j + viewDistance; ++l) {
+ // Paper end
chunkList.add(new ChunkCoordIntPair(k, l));
}
}
@@ -303,8 +306,11 @@ public class PlayerChunkMap {
int i = (int) entityplayer.d >> 4;
int j = (int) entityplayer.e >> 4;
@ -51,7 +65,7 @@ index 797a84f..d554d7d 100644
PlayerChunk playerchunk = this.getChunk(k, l);
if (playerchunk != null) {
@@ -334,7 +337,9 @@ public class PlayerChunkMap {
@@ -334,7 +340,9 @@ public class PlayerChunkMap {
if (d2 >= 64.0D) {
int k = (int) entityplayer.d >> 4;
int l = (int) entityplayer.e >> 4;
@ -62,7 +76,7 @@ index 797a84f..d554d7d 100644
int j1 = i - k;
int k1 = j - l;
@@ -343,7 +348,7 @@ public class PlayerChunkMap {
@@ -343,7 +351,7 @@ public class PlayerChunkMap {
if (j1 != 0 || k1 != 0) {
for (int l1 = i - i1; l1 <= i + i1; ++l1) {
for (int i2 = j - i1; i2 <= j + i1; ++i2) {
@ -71,7 +85,7 @@ index 797a84f..d554d7d 100644
// this.c(l1, i2).a(entityplayer);
chunksToLoad.add(new ChunkCoordIntPair(l1, i2)); // CraftBukkit
}
@@ -495,4 +500,20 @@ public class PlayerChunkMap {
@@ -495,4 +503,20 @@ public class PlayerChunkMap {
}
}
// CraftBukkit end
@ -114,5 +128,5 @@ index eac8062..9955de3 100644
private final Player.Spigot spigot = new Player.Spigot()
{
--
2.8.3
2.8.3.windows.1

View file

@ -1,14 +1,14 @@
From c8b7428f7fa5295dc445811bc21c9a24c7422330 Mon Sep 17 00:00:00 2001
From e38307270e2a1c0c6595dc760f79a198635bdf5b Mon Sep 17 00:00:00 2001
From: Daniel Ennis <dennis@icontact.com>
Date: Sun, 20 Mar 2016 15:22:42 -0400
Subject: [PATCH] Catch Async PlayerChunkMap operations
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index d554d7d..20a8a80 100644
index df6801f..6320247 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -437,10 +437,12 @@ public class PlayerChunkMap {
@@ -440,10 +440,12 @@ public class PlayerChunkMap {
}
public void a(PlayerChunk playerchunk) {
@ -22,5 +22,5 @@ index d554d7d..20a8a80 100644
long i = d(chunkcoordintpair.x, chunkcoordintpair.z);
--
2.8.3
2.8.3.windows.1