Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
b62dfa0bf9
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 39ce5d3a SPIGOT-4399: ItemMeta.equals broken with AttributeModifiers CraftBukkit Changes:1cf8b5dc
SPIGOT-4400: Populators running on existing chunks116cb9a1
SPIGOT-4399: Add attribute modifier equality test5ee1c18a
SPIGOT-4398: Set ASM7_EXPERIMENTAL flag
112 Zeilen
6.1 KiB
Diff
112 Zeilen
6.1 KiB
Diff
From ba5a11cd178572ea41951140c92c56790a210921 Mon Sep 17 00:00:00 2001
|
|
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
|
|
index 17755108a8..6fe3c0ea8a 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -244,4 +244,10 @@ public class PaperWorldConfig {
|
|
grassUpdateRate = Math.max(0, getInt("grass-spread-tick-rate", grassUpdateRate));
|
|
log("Grass Spread Tick Rate: " + grassUpdateRate);
|
|
}
|
|
+
|
|
+ public short keepLoadedRange;
|
|
+ private void keepLoadedRange() {
|
|
+ keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 8)) * 16);
|
|
+ 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
|
|
index abed6bb977..8056dc40df 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -490,13 +490,21 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
|
ArrayList arraylist = Lists.newArrayList();
|
|
Set set = Sets.newConcurrentHashSet();
|
|
|
|
- for (int i = -192; i <= 192 && this.isRunning(); i += 16) {
|
|
- for (int j = -192; j <= 192 && this.isRunning(); j += 16) {
|
|
+ // Paper start
|
|
+ short radius = worldserver.paperConfig.keepLoadedRange;
|
|
+ for (int i = -radius; i <= radius && this.isRunning(); i += 16) {
|
|
+ for (int j = -radius; j <= radius && this.isRunning(); j += 16) {
|
|
+ // Paper end
|
|
arraylist.add(new ChunkCoordIntPair(blockposition.getX() + i >> 4, blockposition.getZ() + j >> 4));
|
|
}
|
|
+ } // Paper
|
|
+ if (this.isRunning()) { // Paper
|
|
+ int expected = arraylist.size(); // Paper
|
|
+
|
|
|
|
CompletableFuture completablefuture = worldserver.getChunkProviderServer().a((Iterable) arraylist, (chunk) -> {
|
|
set.add(chunk.getPos());
|
|
+ if (set.size() < expected && set.size() % 25 == 0) this.a(new ChatMessage("menu.preparingSpawn", new Object[0]), set.size() * 100 / expected); // Paper
|
|
});
|
|
|
|
while (!completablefuture.isDone()) {
|
|
@@ -511,11 +519,11 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
|
|
|
throw new RuntimeException(executionexception.getCause());
|
|
} catch (TimeoutException timeoutexception) {
|
|
- this.a(new ChatMessage("menu.preparingSpawn", new Object[0]), set.size() * 100 / 625);
|
|
+ this.a(new ChatMessage("menu.preparingSpawn", new Object[0]), set.size() * 100 / expected); // Paper
|
|
}
|
|
}
|
|
|
|
- this.a(new ChatMessage("menu.preparingSpawn", new Object[0]), set.size() * 100 / 625);
|
|
+ this.a(new ChatMessage("menu.preparingSpawn", new Object[0]), set.size() * 100 / expected); // Paper
|
|
}
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
|
index b8fcfb6092..411cfedd25 100644
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
|
@@ -2881,8 +2881,9 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
|
int k = i * 16 + 8 - blockposition.getX();
|
|
int l = j * 16 + 8 - blockposition.getZ();
|
|
boolean flag = true;
|
|
+ short keepLoadedRange = paperConfig.keepLoadedRange; // Paper
|
|
|
|
- return k >= -128 && k <= 128 && l >= -128 && l <= 128 && this.keepSpawnInMemory; // CraftBukkit - Added 'this.keepSpawnInMemory'
|
|
+ return k >= -keepLoadedRange && k <= keepLoadedRange && l >= -keepLoadedRange && l <= keepLoadedRange && this.keepSpawnInMemory; // CraftBukkit - Added 'this.keepSpawnInMemory' // Paper - Re-add range var
|
|
}
|
|
|
|
public LongSet ag() {
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
index eb17d5e957..ffa6a46b78 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -1001,7 +1001,7 @@ public final class CraftServer implements Server {
|
|
System.out.println("Preparing start region for level " + (console.worldServer.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
|
|
index 9756ca3a4f..72d1a0f51d 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
@@ -1280,8 +1280,9 @@ public class CraftWorld implements World {
|
|
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 {
|
|
--
|
|
2.19.0
|
|
|