papermc/CraftBukkit-Patches/0009-View-Distance.patch

56 lines
2.5 KiB
Diff
Raw Normal View History

2016-03-01 00:23:45 +00:00
From 76af8264cfaab9954e9733d2822a35a9ab28817b 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
2016-02-29 21:33:06 +00:00
index 13d47d7..8ef7eb2 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
2016-02-29 21:33:06 +00:00
@@ -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;
2015-02-28 11:36:22 +00:00
- this.a(worldserver.getMinecraftServer().getPlayerList().s());
+ this.a(viewDistance); // Spigot
}
2016-02-29 21:33:06 +00:00
public WorldServer getWorld() {
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
2016-02-29 21:33:06 +00:00
index c65e557..59b78bb 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
2016-02-29 21:33:06 +00:00
@@ -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
2016-02-29 21:33:06 +00:00
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
2016-02-29 21:33:06 +00:00
index d4fb83c..86300d6 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
2016-02-29 21:33:06 +00:00
@@ -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 );
+ }
}
--
2016-02-29 21:33:06 +00:00
2.5.0