2014-04-14 00:40:29 +00:00
From f32fdf0a346328efdfa057b39d0e7503dd0d1713 Mon Sep 17 00:00:00 2001
2013-03-22 22:55:21 +00: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
2014-04-12 04:18:37 +00:00
index ae53635..cc1b095 100644
2013-03-22 22:55:21 +00:00
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
2014-03-23 00:06:43 +00:00
@@ -26,9 +26,9 @@ public class PlayerChunkMap {
private final int[][] i = new int[][] { { 1, 0}, { 0, 1}, { -1, 0}, { 0, -1}};
private boolean wasNotEmpty; // CraftBukkit - add field
- public PlayerChunkMap(WorldServer worldserver) {
+ public PlayerChunkMap(WorldServer worldserver, int viewDistance /* Spigot */) {
this.world = worldserver;
2014-04-12 04:18:37 +00:00
- this.a(worldserver.getMinecraftServer().getPlayerList().s());
2014-03-23 00:06:43 +00:00
+ this.a(viewDistance); // Spigot
}
public WorldServer a() {
2013-03-22 22:55:21 +00:00
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
2014-04-12 04:18:37 +00:00
index 01d7105..0192dc5 100644
2013-03-22 22:55:21 +00:00
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
2014-04-12 04:18:37 +00:00
@@ -55,7 +55,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
2013-03-22 22:55:21 +00:00
// CraftBukkit end
this.server = minecraftserver;
this.tracker = new EntityTracker(this);
2014-03-23 00:06:43 +00:00
- this.manager = new PlayerChunkMap(this);
2013-06-20 08:52:23 +00:00
+ this.manager = new PlayerChunkMap(this, spigotConfig.viewDistance); // Spigot
2013-03-22 22:55:21 +00:00
if (this.entitiesById == null) {
this.entitiesById = new IntHashMap();
}
2013-06-20 08:52:23 +00:00
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
2014-03-09 22:14:45 +00:00
index 1545a61..6cc3a91 100644
2013-06-20 08:52:23 +00:00
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
2014-01-14 08:16:43 +00:00
@@ -124,4 +124,11 @@ public class SpigotWorldConfig
2013-06-21 07:30:13 +00:00
expMerge = getDouble("merge-radius.exp", 3.0 );
2013-06-20 08:52:23 +00:00
log( "Experience Merge Radius: " + expMerge );
}
2013-03-22 22:55:21 +00:00
+
2013-06-20 08:52:23 +00:00
+ public int viewDistance;
+ private void viewDistance()
+ {
+ viewDistance = getInt( "view-distance", Bukkit.getViewDistance() );
+ log( "View Distance: " + viewDistance );
+ }
}
2013-03-22 22:55:21 +00:00
--
2014-04-12 04:18:37 +00:00
1.8.3.2
2013-03-22 22:55:21 +00:00