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
|
2024-07-17 19:24:53 +02:00
|
|
|
index 055650b315d53b56798ded7af2054c3e8e3ee319..c72687fb23e8d01639cce7d79e3f97805d51e01f 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
|
2024-06-14 01:32:45 +02:00
|
|
|
@@ -231,7 +231,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
2024-01-21 17:39:05 +01:00
|
|
|
public boolean hasEntityMoveEvent; // Paper - Add EntityMoveEvent
|
2021-07-02 21:04:29 +02:00
|
|
|
|
2024-01-23 14:34:17 +01:00
|
|
|
public LevelChunk getChunkIfLoaded(int x, int z) {
|
2021-07-02 21:04:29 +02:00
|
|
|
- return this.chunkSource.getChunk(x, z, false);
|
2024-01-19 13:22:30 +01:00
|
|
|
+ return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately
|
2021-07-02 21:04:29 +02:00
|
|
|
}
|
|
|
|
|
2021-11-25 00:26:29 +01:00
|
|
|
@Override
|
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
|
2024-08-09 22:05:50 +02:00
|
|
|
index 144d243e0d6ba3ae3f0b0bf457fa516e2b4f416f..20a14b4163807b806bf2ce5a88d3c35098bed929 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
|
2024-06-14 01:32:45 +02:00
|
|
|
@@ -180,6 +180,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
2021-07-02 21:04:29 +02:00
|
|
|
return (CraftServer) Bukkit.getServer();
|
|
|
|
}
|
|
|
|
|
2024-01-19 13:22:30 +01:00
|
|
|
+ // Paper start - Use getChunkIfLoadedImmediately
|
2021-07-02 21:04:29 +02:00
|
|
|
+ @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
|
|
|
+ }
|
2024-01-19 13:22:30 +01:00
|
|
|
+ // Paper end - Use getChunkIfLoadedImmediately
|
2021-07-02 21:04:29 +02:00
|
|
|
+
|
2021-11-25 00:26:29 +01:00
|
|
|
public abstract ResourceKey<LevelStem> getTypeKey();
|
|
|
|
|
2024-01-23 15:43:48 +01:00
|
|
|
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, 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) { // Paper - create paper world config
|
2022-12-07 21:16:54 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java b/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java
|
2024-04-24 16:29:12 +02:00
|
|
|
index 13b34e89bd3e55df1bb1d4d0cf013bafae43f502..df6c97be1b278c97a20390be5d3e60f429383702 100644
|
2022-12-07 21:16:54 +01:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java
|
2024-04-24 16:29:12 +02:00
|
|
|
@@ -56,7 +56,7 @@ public class GameEventDispatcher {
|
2022-12-07 21:16:54 +01:00
|
|
|
|
|
|
|
for (int l1 = j; l1 <= i1; ++l1) {
|
|
|
|
for (int i2 = l; i2 <= k1; ++i2) {
|
|
|
|
- LevelChunk chunk = this.level.getChunkSource().getChunkNow(l1, i2);
|
2024-01-19 13:22:30 +01:00
|
|
|
+ LevelChunk chunk = (LevelChunk) this.level.getChunkIfLoadedImmediately(l1, i2); // Paper - Use getChunkIfLoadedImmediately
|
2022-12-07 21:16:54 +01:00
|
|
|
|
|
|
|
if (chunk != null) {
|
|
|
|
for (int j2 = k; j2 <= j1; ++j2) {
|