2016-02-29 22:33:06 +01:00
From 64c0667e827ec6dc583a7b346be5601838c4dd51 Mon Sep 17 00:00:00 2001
2014-07-21 22:46:54 +02:00
From: md_5 <md_5@live.com.au>
Date: Sat, 23 Mar 2013 09:52:41 +1100
Subject: [PATCH] View Distance
This commit allows the user to select per world view distances, and view distances below 3. Be wary of the issues selecting a view distance of 1 or 2 may cause!
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
2016-02-29 22:33:06 +01:00
index 13d47d7..8ef7eb2 100644
2014-07-21 22:46:54 +02:00
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
2016-02-29 22:33:06 +01:00
@@ -49,9 +49,9 @@ public class PlayerChunkMap {
private boolean m = true;
2014-07-21 22:46:54 +02:00
private boolean wasNotEmpty; // CraftBukkit - add field
- public PlayerChunkMap(WorldServer worldserver) {
+ public PlayerChunkMap(WorldServer worldserver, int viewDistance /* Spigot */) {
this.world = worldserver;
2015-02-28 12:36:22 +01:00
- this.a(worldserver.getMinecraftServer().getPlayerList().s());
2014-07-21 22:46:54 +02:00
+ this.a(viewDistance); // Spigot
}
2016-02-29 22:33:06 +01:00
public WorldServer getWorld() {
2014-07-21 22:46:54 +02:00
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
2016-02-29 22:33:06 +01:00
index c65e557..59b78bb 100644
2014-07-21 22:46:54 +02:00
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
2016-02-29 22:33:06 +01:00
@@ -57,7 +57,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
2014-07-21 22:46:54 +02:00
// CraftBukkit end
this.server = minecraftserver;
this.tracker = new EntityTracker(this);
- this.manager = new PlayerChunkMap(this);
+ this.manager = new PlayerChunkMap(this, spigotConfig.viewDistance); // Spigot
2016-02-29 22:33:06 +01:00
this.worldProvider.a((World) this);
this.chunkProvider = this.n();
this.portalTravelAgent = new org.bukkit.craftbukkit.CraftTravelAgent(this); // CraftBukkit
2014-07-21 22:46:54 +02:00
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
2016-02-29 22:33:06 +01:00
index d4fb83c..86300d6 100644
2014-07-21 22:46:54 +02:00
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
2016-02-29 22:33:06 +01:00
@@ -115,4 +115,11 @@ public class SpigotWorldConfig
2014-07-21 22:46:54 +02:00
expMerge = getDouble("merge-radius.exp", 3.0 );
log( "Experience Merge Radius: " + expMerge );
}
+
+ public int viewDistance;
+ private void viewDistance()
+ {
+ viewDistance = getInt( "view-distance", Bukkit.getViewDistance() );
+ log( "View Distance: " + viewDistance );
+ }
}
--
2016-02-29 22:33:06 +01:00
2.5.0
2014-07-21 22:46:54 +02:00