2021-07-02 21:04:29 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
|
|
Date: Mon, 8 Jul 2019 00:13:36 -0700
|
|
|
|
Subject: [PATCH] Use getChunkIfLoadedImmediately in places
|
|
|
|
|
|
|
|
This prevents us from hitting chunk loads for chunks at or less-than
|
|
|
|
ticket level 33 (yes getChunkIfLoaded will actually perform a chunk
|
|
|
|
load in that case).
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
2022-07-03 23:55:56 +02:00
|
|
|
index a19be39c5b4552ebfa74634c0cc004f9de0a9eff..8c61dc53f4874ab7013938abdf5d65a608369474 100644
|
2021-07-02 21:04:29 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
2022-06-10 03:20:47 +02:00
|
|
|
@@ -221,7 +221,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
2021-07-02 21:04:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
|
|
|
|
- return this.chunkSource.getChunk(x, z, false);
|
|
|
|
+ return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper
|
|
|
|
}
|
|
|
|
|
2021-11-25 00:26:29 +01:00
|
|
|
@Override
|
2022-06-10 03:20:47 +02:00
|
|
|
@@ -1436,7 +1436,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
2022-06-08 11:31:06 +02:00
|
|
|
|
|
|
|
for (int l1 = j; l1 <= i1; ++l1) {
|
|
|
|
for (int i2 = l; i2 <= k1; ++i2) {
|
|
|
|
- LevelChunk chunk = this.getChunkSource().getChunkNow(l1, i2);
|
|
|
|
+ LevelChunk chunk = (LevelChunk) this.getChunkIfLoadedImmediately(l1, i2); // Paper
|
|
|
|
|
|
|
|
if (chunk != null) {
|
|
|
|
for (int j2 = k; j2 <= j1; ++j2) {
|
2021-07-02 21:04:29 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
2022-06-09 10:51:45 +02:00
|
|
|
index 646e40b01a4df143802dc981a5594a17c37e5d10..91a36884e10c278f6e0efb4fbed1352492b38200 100644
|
2021-07-02 21:04:29 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
2022-06-09 10:51:45 +02:00
|
|
|
@@ -200,6 +200,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
2021-07-02 21:04:29 +02:00
|
|
|
return (CraftServer) Bukkit.getServer();
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start
|
|
|
|
+ @Override
|
|
|
|
+ public boolean hasChunk(int chunkX, int chunkZ) {
|
2021-11-25 00:26:29 +01:00
|
|
|
+ return this.getChunkIfLoaded(chunkX, chunkZ) != null;
|
2021-07-02 21:04:29 +02:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
2021-11-25 00:26:29 +01:00
|
|
|
public abstract ResourceKey<LevelStem> getTypeKey();
|
|
|
|
|
2022-06-09 10:51:45 +02:00
|
|
|
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor
|