Paper 1.9.4 Update

This commit is contained in:
Aikar
2016-05-11 22:07:46 -04:00
parent 324bde1f10
commit 34fcd8ccc2
62 changed files with 209 additions and 1262 deletions

View File

@@ -48,7 +48,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ for (int k = i - viewDistance; k <= i + viewDistance; ++k) {
+ for (int l = j - viewDistance; l <= j + viewDistance; ++l) {
+ // Paper end
PlayerChunk playerchunk = this.b(k, l);
PlayerChunk playerchunk = this.getChunk(k, l);
if (playerchunk != null) {
@@ -0,0 +0,0 @@ public class PlayerChunkMap {
@@ -81,35 +81,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ final int oldViewDistance = player.getViewDistance();
+
+ int viewDistance = MathHelper.clamp(toSet, 3, 32);
+ if (viewDistance != oldViewDistance) {
+ int cx = (int) player.locX >> 4;
+ int cz = (int) player.locZ >> 4;
+
+ if (viewDistance - oldViewDistance > 0) {
+ for (int x = cx - viewDistance; x <= cx + viewDistance; ++x) {
+ for (int z = cz - viewDistance; z <= cz + viewDistance; ++z) {
+ PlayerChunk playerchunkmap_playerchunk = this.c(x, z);
+
+ if (!playerchunkmap_playerchunk.c.contains(player)) {
+ playerchunkmap_playerchunk.a(player);
+ }
+ }
+ }
+ } else {
+ for (int x = cx - oldViewDistance; x <= cx + oldViewDistance; ++x) {
+ for (int z = cz - oldViewDistance; z <= cz + oldViewDistance; ++z) {
+ if (!this.a(x, z, cx, cz, viewDistance)) {
+ this.c(x, z).b(player);
+ }
+ }
+ }
+ }
+
+ player.setViewDistance(viewDistance);
+ if (toSet < 0) {
+ viewDistance = -1;
+ }
+
+ if (toSet == -1) {
+ player.setViewDistance(-1);
+ if (viewDistance != oldViewDistance) {
+ removePlayer(player);
+ player.setViewDistance(viewDistance);
+ addPlayer(player);
+ }
+ }
+ // Paper end