From 76af8264cfaab9954e9733d2822a35a9ab28817b Mon Sep 17 00:00:00 2001 From: md_5 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 index 13d47d7..8ef7eb2 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -49,9 +49,9 @@ public class PlayerChunkMap { private boolean m = true; private boolean wasNotEmpty; // CraftBukkit - add field - public PlayerChunkMap(WorldServer worldserver) { + public PlayerChunkMap(WorldServer worldserver, int viewDistance /* Spigot */) { this.world = worldserver; - this.a(worldserver.getMinecraftServer().getPlayerList().s()); + this.a(viewDistance); // Spigot } public WorldServer getWorld() { diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java index c65e557..59b78bb 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -57,7 +57,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { // CraftBukkit end this.server = minecraftserver; this.tracker = new EntityTracker(this); - this.manager = new PlayerChunkMap(this); + this.manager = new PlayerChunkMap(this, spigotConfig.viewDistance); // Spigot this.worldProvider.a((World) this); this.chunkProvider = this.n(); this.portalTravelAgent = new org.bukkit.craftbukkit.CraftTravelAgent(this); // CraftBukkit diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index d4fb83c..86300d6 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -115,4 +115,11 @@ public class SpigotWorldConfig 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 ); + } } -- 2.5.0