2016-05-21 00:32:50 +02:00
|
|
|
From 61779a525b1be7b2561a7445fc1bd1f471a340a5 Mon Sep 17 00:00:00 2001
|
2016-04-03 23:34:15 +02:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Sat, 13 Sep 2014 23:14:43 -0400
|
|
|
|
Subject: [PATCH] Configurable Keep Spawn Loaded range per world
|
|
|
|
|
|
|
|
This lets you disable it for some worlds and lower it for others.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2016-05-17 04:07:12 +02:00
|
|
|
index ee67628..4f94b04 100644
|
2016-04-03 23:34:15 +02:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2016-05-17 04:07:12 +02:00
|
|
|
@@ -309,4 +309,10 @@ public class PaperWorldConfig {
|
2016-04-03 23:34:15 +02:00
|
|
|
grassUpdateRate = Math.max(0, getInt("grass-spread-tick-rate", grassUpdateRate));
|
|
|
|
log("Grass Spread Tick Rate: " + grassUpdateRate);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public short keepLoadedRange;
|
|
|
|
+ private void keepLoadedRange() {
|
2016-04-04 05:08:13 +02:00
|
|
|
+ keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 8)) * 16);
|
2016-04-03 23:34:15 +02:00
|
|
|
+ log( "Keep Spawn Loaded Range: " + (keepLoadedRange/16));
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
2016-05-16 00:48:39 +02:00
|
|
|
index 842e364..e1c0c0b 100644
|
2016-04-03 23:34:15 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
2016-05-16 00:48:39 +02:00
|
|
|
@@ -353,8 +353,9 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
2016-04-03 23:34:15 +02:00
|
|
|
long j = av();
|
|
|
|
i = 0;
|
|
|
|
|
|
|
|
- for (int k = -192; k <= 192 && this.isRunning(); k += 16) {
|
|
|
|
- for (int l = -192; l <= 192 && this.isRunning(); l += 16) {
|
|
|
|
+ short radius = worldserver.paperConfig.keepLoadedRange; // Paper
|
|
|
|
+ for (int k = -radius; k <= radius && this.isRunning(); k += 16) { // Paper
|
|
|
|
+ for (int l = -radius; l <= radius && this.isRunning(); l += 16) { // Paper
|
|
|
|
long i1 = av();
|
|
|
|
|
|
|
|
if (i1 - j > 1000L) {
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
2016-05-16 00:48:39 +02:00
|
|
|
index 5223785..7bfb735 100644
|
2016-04-03 23:34:15 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
2016-05-16 00:48:39 +02:00
|
|
|
@@ -3228,7 +3228,7 @@ public abstract class World implements IBlockAccess {
|
2016-04-03 23:34:15 +02:00
|
|
|
BlockPosition blockposition = this.getSpawn();
|
|
|
|
int k = i * 16 + 8 - blockposition.getX();
|
|
|
|
int l = j * 16 + 8 - blockposition.getZ();
|
|
|
|
- short short0 = 128;
|
|
|
|
+ short short0 = paperConfig.keepLoadedRange; // Paper
|
|
|
|
|
|
|
|
return k >= -short0 && k <= short0 && l >= -short0 && l <= short0 && this.keepSpawnInMemory; // CraftBukkit - Added 'this.keepSpawnInMemory'
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
2016-05-21 00:32:50 +02:00
|
|
|
index a0478f2..975a036 100644
|
2016-04-03 23:34:15 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
2016-05-21 00:32:50 +02:00
|
|
|
@@ -946,7 +946,7 @@ public final class CraftServer implements Server {
|
2016-04-03 23:34:15 +02:00
|
|
|
System.out.print("Preparing start region for level " + (console.worlds.size() - 1) + " (Seed: " + internal.getSeed() + ")");
|
|
|
|
|
|
|
|
if (internal.getWorld().getKeepSpawnInMemory()) {
|
|
|
|
- short short1 = 196;
|
|
|
|
+ short short1 = internal.paperConfig.keepLoadedRange; // Paper
|
|
|
|
long i = System.currentTimeMillis();
|
|
|
|
for (int j = -short1; j <= short1; j += 16) {
|
|
|
|
for (int k = -short1; k <= short1; k += 16) {
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
2016-05-12 04:07:46 +02:00
|
|
|
index 46648bf..1adfc03 100644
|
2016-04-03 23:34:15 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
2016-05-12 04:07:46 +02:00
|
|
|
@@ -1259,8 +1259,9 @@ public class CraftWorld implements World {
|
2016-04-03 23:34:15 +02:00
|
|
|
int chunkCoordX = chunkcoordinates.getX() >> 4;
|
|
|
|
int chunkCoordZ = chunkcoordinates.getZ() >> 4;
|
|
|
|
// Cycle through the 25x25 Chunks around it to load/unload the chunks.
|
|
|
|
- for (int x = -12; x <= 12; x++) {
|
|
|
|
- for (int z = -12; z <= 12; z++) {
|
|
|
|
+ int radius = world.paperConfig.keepLoadedRange / 16; // Paper
|
|
|
|
+ for (int x = -radius; x <= radius; x++) { // Paper
|
|
|
|
+ for (int z = -radius; z <= radius; z++) { // Paper
|
|
|
|
if (keepLoaded) {
|
|
|
|
loadChunk(chunkCoordX + x, chunkCoordZ + z);
|
|
|
|
} else {
|
|
|
|
--
|
2016-05-12 04:07:46 +02:00
|
|
|
2.8.2
|
2016-04-03 23:34:15 +02:00
|
|
|
|