From dfc10448bbddf418fed8d39748cc647009a18136 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Sat, 11 Jun 2022 07:58:17 -0700 Subject: [PATCH] Fix keep spawn loaded patch Needs to be in blocks --- ...rable-Keep-Spawn-Loaded-range-per-world.patch | 16 ++++++++-------- patches/server/0321-Chunk-debug-command.patch | 4 ++-- ...hangeEvent-not-firing-for-all-use-cases.patch | 6 +++--- ...0857-Replace-player-chunk-loader-system.patch | 8 ++++---- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/patches/server/0319-Configurable-Keep-Spawn-Loaded-range-per-world.patch b/patches/server/0319-Configurable-Keep-Spawn-Loaded-range-per-world.patch index 5100a6791..531f7c450 100644 --- a/patches/server/0319-Configurable-Keep-Spawn-Loaded-range-per-world.patch +++ b/patches/server/0319-Configurable-Keep-Spawn-Loaded-range-per-world.patch @@ -6,7 +6,7 @@ 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/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 97e964030a5cc449543252933f8a7b4800833e69..feba451e86ef49e5edcc5dc60fae18537a95ee71 100644 +index 97e964030a5cc449543252933f8a7b4800833e69..40aa6abf0d3a814de194d754d5b136f3ef67d378 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -726,31 +726,34 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop - License: LGPLv2.1 */ diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index 162aa7718488a74980843944e0d026ccfd5a65a5..aebfcd07170109b9cf058df0d4e285b0d95fedb5 100644 +index 162aa7718488a74980843944e0d026ccfd5a65a5..4e29c0a983727fc839a4bcde01d3286396b3587d 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java @@ -9,13 +9,27 @@ import net.minecraft.core.BlockPos; @@ -363,7 +363,7 @@ index 162aa7718488a74980843944e0d026ccfd5a65a5..aebfcd07170109b9cf058df0d4e285b0 + worldData.addProperty("name", world.getWorld().getName()); + worldData.addProperty("view-distance", world.spigotConfig.viewDistance); + worldData.addProperty("keep-spawn-loaded", world.keepSpawnInMemory); -+ worldData.addProperty("keep-spawn-loaded-range", world.paperConfig().spawn.keepSpawnLoadedRange); ++ worldData.addProperty("keep-spawn-loaded-range", world.paperConfig().spawn.keepSpawnLoadedRange * 16); + worldData.addProperty("visible-chunk-count", visibleChunks.size()); + worldData.addProperty("loaded-chunk-count", chunkMap.entitiesInLevel.size()); + worldData.addProperty("verified-fully-loaded-chunks", fullLoadedChunks); diff --git a/patches/server/0478-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch b/patches/server/0478-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch index 14b31523b..b4a400084 100644 --- a/patches/server/0478-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch +++ b/patches/server/0478-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix SpawnChangeEvent not firing for all use-cases diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 69611eaafe2edc0e937f54b63bfbf3a23ca7a857..924fbf224ae04cba02cf41f37caa9424dfa69d1d 100644 +index 980eda5fb86381f0c54e22e94d273bd5639f1a3b..b763d925a9db7deb5d6a0090498370355bc17554 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1850,6 +1850,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -15,9 +15,9 @@ index 69611eaafe2edc0e937f54b63bfbf3a23ca7a857..924fbf224ae04cba02cf41f37caa9424 + new org.bukkit.event.world.SpawnChangeEvent(getWorld(), MCUtil.toLocation(this, prevSpawn)).callEvent(); // Paper if (this.keepSpawnInMemory) { // if this keepSpawnInMemory is false a plugin has already removed our tickets, do not re-add - this.removeTicketsForSpawn(this.paperConfig().spawn.keepSpawnLoadedRange, prevSpawn); + this.removeTicketsForSpawn(this.paperConfig().spawn.keepSpawnLoadedRange * 16, prevSpawn); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 324498a6add5288f175510ddd754ea2199d37cb7..880aeefbda1cba04accf9075240c88c027b5763c 100644 +index cb89a0c83a3c307f99581b7838308f70eccb774d..edf538cfa6f73bce65b5d50d014d8fd2fbca5d3d 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -258,11 +258,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0857-Replace-player-chunk-loader-system.patch b/patches/server/0857-Replace-player-chunk-loader-system.patch index 0d6cda2f7..f89b1eda1 100644 --- a/patches/server/0857-Replace-player-chunk-loader-system.patch +++ b/patches/server/0857-Replace-player-chunk-loader-system.patch @@ -1272,7 +1272,7 @@ index 0e5f05d091710da9078021eb6e1a26a22e2d63dd..c1e8d8674738eebaaf7bd918eacb5227 // Paper end diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index 48ec2f7a3813f8ce2baf32667a09f377e2764710..33ccab88b93f93993b6e17d5e0a2539b08235f78 100644 +index 1eb71004a19866590a3d27fa6e72842934989177..7034af8ad42940c5af6b9032b9873ce36c55a2a7 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java @@ -647,7 +647,8 @@ public final class MCUtil { @@ -1283,7 +1283,7 @@ index 48ec2f7a3813f8ce2baf32667a09f377e2764710..33ccab88b93f93993b6e17d5e0a2539b + worldData.addProperty("view-distance", world.getChunkSource().chunkMap.playerChunkManager.getTargetNoTickViewDistance()); // Paper - replace chunk loader system + worldData.addProperty("tick-view-distance", world.getChunkSource().chunkMap.playerChunkManager.getTargetTickViewDistance()); // Paper - replace chunk loader system worldData.addProperty("keep-spawn-loaded", world.keepSpawnInMemory); - worldData.addProperty("keep-spawn-loaded-range", world.paperConfig().spawn.keepSpawnLoadedRange); + worldData.addProperty("keep-spawn-loaded-range", world.paperConfig().spawn.keepSpawnLoadedRange * 16); worldData.addProperty("visible-chunk-count", visibleChunks.size()); diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java index 5482be03a667939ff009b6810d5cc90c8601e983..11cd31691307749e925930c4b6e10e3f3b4fad25 100644 @@ -1855,7 +1855,7 @@ index 96a232f22b1c270b91635ce9c7c6cacc63b026cc..59acbf6249f8f5285504c0ddea448a34 return true; } else { diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 3b2a3f5e6db4685c3f8d95dc46c85a2ba7b5ec7c..bcfa1959c2ffd9ee31804c5a00a84133599cbbc4 100644 +index 68267114d6e54323258483d59e8971b0e031218c..da1533ade2d51a6a978ba4334d07b07681421693 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -676,7 +676,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2079,7 +2079,7 @@ index 0de0519c01886a39399233b275db44b95e2f3d96..c46cbbf9ac4c5661933b03bc0b2559f7 @Nullable diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index d908eb6b1208cf69f2f1282ddf1c20dc04d092d1..bc387765a9d96f3901dd2e1db751262b1fdd4829 100644 +index 6594d7dd2d21cca438530af7cc789bfbac265238..131f40a7defc87a01f6a554f7c7819d34e84fe1d 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -2201,43 +2201,56 @@ public class CraftWorld extends CraftRegionAccessor implements World {