2013-06-16 13:45:21 +02:00
From 7b1f1f56d04030711b34d012ffc342f5fe9c9bb4 Mon Sep 17 00:00:00 2001
2013-03-22 23:55:21 +01: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
2013-03-25 08:57:00 +01:00
index 0dfd190..c543bed 100644
2013-03-22 23:55:21 +01:00
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
2013-03-25 08:57:00 +01:00
@@ -22,7 +22,7 @@ public class PlayerChunkMap {
2013-03-22 23:55:21 +01:00
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 {
this.e = i;
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
2013-06-15 14:01:15 +02:00
index 4a8d3f4..5375cb3 100644
2013-03-22 23:55:21 +01:00
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
2013-06-11 05:14:01 +02:00
@@ -49,7 +49,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
2013-03-22 23:55:21 +01:00
// CraftBukkit end
this.server = minecraftserver;
this.tracker = new EntityTracker(this);
- this.manager = new PlayerChunkMap(this, minecraftserver.getPlayerList().o());
+ this.manager = new PlayerChunkMap(this, getWorld().viewDistance); // Spigot
if (this.entitiesById == null) {
this.entitiesById = new IntHashMap();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
2013-06-15 14:01:15 +02:00
index d49393d..4d022bd 100644
2013-03-22 23:55:21 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
2013-06-11 05:14:01 +02:00
@@ -83,6 +83,7 @@ public class CraftWorld implements World {
// Merge radius:
public double itemMergeRadius = 3.5;
public double expMergeRadius = 3.5;
+ public int viewDistance;
// Spigot end
2013-06-15 14:01:15 +02:00
// Spigot start
@@ -136,6 +137,9 @@ public class CraftWorld implements World {
2013-06-11 05:14:01 +02:00
itemMergeRadius = configuration.getDouble("world-settings." + name + ".item-merge-radius", itemMergeRadius);
expMergeRadius = configuration.getDouble("world-settings." + name + ".exp-merge-radius", expMergeRadius);
2013-03-22 23:55:21 +01:00
+ viewDistance = Bukkit.getServer().getViewDistance();
2013-06-11 05:14:01 +02:00
+ viewDistance = configuration.getInt( "world-settings." + name + ".view-distance", viewDistance );
2013-03-22 23:55:21 +01:00
+
2013-06-11 05:14:01 +02:00
if ( info )
{
server.getLogger().info( "-------------- Spigot ----------------" );
2013-06-15 14:01:15 +02:00
@@ -153,6 +157,7 @@ public class CraftWorld implements World {
2013-06-11 05:14:01 +02:00
server.getLogger().info( "Mushroom Growth Modifier: " + mushroomGrowthModifier );
server.getLogger().info( "Item Merge Radius: " + itemMergeRadius );
server.getLogger().info( "Exp Merge Radius: " + expMergeRadius );
+ server.getLogger().info( "View distance: " + viewDistance );
server.getLogger().info( "-------------------------------------------------" );
}
2013-03-22 23:55:21 +01:00
// Spigot end
diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml
2013-06-11 04:10:31 +02:00
index 56873b6..fe257e2 100644
2013-03-22 23:55:21 +01:00
--- a/src/main/resources/configurations/bukkit.yml
+++ b/src/main/resources/configurations/bukkit.yml
2013-03-23 10:15:20 +01:00
@@ -50,6 +50,7 @@ world-settings:
2013-03-22 23:55:21 +01:00
world:
growth-chunks-per-tick: 1000
world_nether:
+ view-distance: 5
growth-chunks-per-tick: 0
random-light-updates: true
2013-06-11 04:10:31 +02:00
spawn-limits:
2013-03-22 23:55:21 +01:00
--
2013-06-02 07:15:15 +02:00
1.8.1.2
2013-03-22 23:55:21 +01:00