Paper/CraftBukkit-Patches/0008-Per-world-view-distance.patch

70 lines
3.4 KiB
Diff
Raw Normal View History

From 8a6dee291c36ec103e28624da71583f6eb863dde Mon Sep 17 00:00:00 2001
From: md_5 <md_5@bigpond.com>
Date: Sat, 12 Jan 2013 19:57:45 +1100
2013-01-19 09:22:25 +01:00
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 7032c61..4aa2a19 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 45217cd..94e07fe 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -116,6 +116,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);
@@ -131,6 +134,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
}
@@ -141,6 +145,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 f44d5d0..0c92b66 100644
--- a/src/main/resources/configurations/bukkit.yml
+++ b/src/main/resources/configurations/bukkit.yml
@@ -49,6 +49,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