mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-27 13:06:02 +01:00
85 lines
4.3 KiB
Diff
85 lines
4.3 KiB
Diff
From 8a13d0f677be4842ed291347c14892c2932d500d 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!
|
|
---
|
|
src/main/java/net/minecraft/server/PlayerChunkMap.java | 2 +-
|
|
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 +
|
|
4 files changed, 8 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
|
index f788a62..98d6dd2 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
|
@@ -23,7 +23,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 {
|
|
this.e = i;
|
|
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
|
index 05b2d6d..9902506 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
|
@@ -51,7 +51,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 9343d46..f81ca3e 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
@@ -118,6 +118,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 int aggregateTicks = 4;
|
|
public double itemMergeRadius = 3.5;
|
|
public double expMergeRadius = 3.5;
|
|
+ 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 87f9f1c..35fbd06 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
|
|
|