Paper/CraftBukkit-Patches/0011-View-Distance.patch

53 lines
2.3 KiB
Diff
Raw Normal View History

2013-12-22 07:05:27 +08:00
From 4ddb7d7d8e92f0f4a333d80a3e3ced37b409bb4b Mon Sep 17 00:00:00 2001
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
2013-07-02 11:03:56 +08:00
index 4e0398c..ae4ca63 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
2013-07-02 11:03:56 +08:00
@@ -24,7 +24,7 @@ public class PlayerChunkMap {
public PlayerChunkMap(WorldServer worldserver, int i) {
if (i > 15) {
throw new IllegalArgumentException("Too big view radius!");
- } else if (i < 3) {
+ } else if (i < 1) {
throw new IllegalArgumentException("Too small view radius!");
} else {
2013-07-02 11:03:56 +08:00
this.f = i;
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
2013-12-01 11:40:53 +08:00
index 812e887..9f09a3d 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
2013-12-01 11:40:53 +08:00
@@ -54,7 +54,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
// CraftBukkit end
this.server = minecraftserver;
this.tracker = new EntityTracker(this);
- this.manager = new PlayerChunkMap(this, minecraftserver.getPlayerList().o());
2013-06-20 16:52:23 +08:00
+ this.manager = new PlayerChunkMap(this, spigotConfig.viewDistance); // Spigot
if (this.entitiesById == null) {
this.entitiesById = new IntHashMap();
}
2013-06-20 16:52:23 +08:00
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
2013-12-03 06:05:49 +08:00
index 9f07e71..97d56bd 100644
2013-06-20 16:52:23 +08:00
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
2013-12-03 06:05:49 +08:00
@@ -120,4 +120,11 @@ public class SpigotWorldConfig
2013-06-21 15:30:13 +08:00
expMerge = getDouble("merge-radius.exp", 3.0 );
2013-06-20 16:52:23 +08:00
log( "Experience Merge Radius: " + expMerge );
}
+
2013-06-20 16:52:23 +08:00
+ public int viewDistance;
+ private void viewDistance()
+ {
+ viewDistance = getInt( "view-distance", Bukkit.getViewDistance() );
+ log( "View Distance: " + viewDistance );
+ }
}
--
2013-12-01 11:40:53 +08:00
1.8.3.2