PaperSpigot-Parent/CraftBukkit-Patches/0009-Per-world-view-distance.patch
2013-01-19 19:22:25 +11:00

70 lines
3.4 KiB
Diff

From 9b45e7ed5ccba94e2730105b6234da7945fa8be3 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@bigpond.com>
Date: Sat, 12 Jan 2013 19:57:45 +1100
Subject: [PATCH] Per world view distance.
---
src/main/java/net/minecraft/server/WorldServer.java | 2 +-
src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 5 +++++
src/main/resources/configurations/bukkit.yml | 1 +
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 6de6b12..6e5434b 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -49,7 +49,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());
+ 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
index 3544aa3..856307f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -114,6 +114,9 @@ public class CraftWorld implements World {
treeGrowthModifier = configuration.getInt("world-settings." + name + ".tree-growth-modifier", treeGrowthModifier);
mushroomGrowthModifier = configuration.getInt("world-settings." + name + ".mushroom-growth-modifier", mushroomGrowthModifier);
+ viewDistance = Bukkit.getServer().getViewDistance();
+ viewDistance = configuration.getInt("world-settings." + name + ".view-distance", viewDistance);
+
server.getLogger().info("-------------- Spigot ----------------");
server.getLogger().info("-------- World Settings For [" + name + "] --------");
server.getLogger().info("Growth Per Chunk: " + growthPerTick);
@@ -129,6 +132,7 @@ public class CraftWorld implements World {
server.getLogger().info("Sugar Growth Modifier: " + sugarGrowthModifier);
server.getLogger().info("Tree Growth Modifier: " + treeGrowthModifier);
server.getLogger().info("Mushroom Growth Modifier: " + mushroomGrowthModifier);
+ server.getLogger().info("View distance: " + viewDistance);
server.getLogger().info("-------------------------------------------------");
// Spigot end
}
@@ -139,6 +143,7 @@ public class CraftWorld implements World {
public boolean randomLightingUpdates = false;
public int mobSpawnRange = 4;
public int aggregateTicks = 4;
+ public int viewDistance;
//Crop growth rates:
public int wheatGrowthModifier = 100;
public int cactusGrowthModifier = 100;
diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml
index 78134f9..c41fac1 100644
--- a/src/main/resources/configurations/bukkit.yml
+++ b/src/main/resources/configurations/bukkit.yml
@@ -52,6 +52,7 @@ world-settings:
world:
growth-chunks-per-tick: 1000
world_nether:
+ view-distance: 5
growth-chunks-per-tick: 0
random-light-updates: true
water-creatures-per-chunk: 0
--
1.8.1-rc2