Fix implementations of ChunkHolder#getChunkIfPresent
Implementations for ChunkStatuses below FULL are supposed to always return ProtoChunk instances. However, since we used the last completed status, it could return LevelChunk. To resolve this, follow Vanilla behavior of tracking chunk completions by status and replace old ProtoChunk statuses with ImposterProtoChunk when the chunk generates to FULL. Additionally, implement an optimisation for retrieving full chunks by storing a map of pos -> LevelChunk. This requires only a simple map lookup to occur for full chunks which are loaded.
This commit is contained in:
parent
d9111ccec2
commit
f8ee0a06c5
8 changed files with 194 additions and 133 deletions
|
@ -2009,7 +2009,7 @@ index 0000000000000000000000000000000000000000..33cd90c30c22200a4e1ae64f40a0bf78
|
|||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index bac8deab8f703c2e0ecbc11bf218319bb52e0cd4..fb0db51493e343c781876b9db773fa3fc9a8d666 100644
|
||||
index 7f07bb16fc56d5cd754f94676ceb3d302e35cc0d..b81ac6db8ba1ee0722e9e85f8de8ef91169a3198 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -228,6 +228,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
|
@ -2020,7 +2020,7 @@ index bac8deab8f703c2e0ecbc11bf218319bb52e0cd4..fb0db51493e343c781876b9db773fa3f
|
|||
|
||||
public LevelChunk getChunkIfLoaded(int x, int z) {
|
||||
return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately
|
||||
@@ -2397,6 +2398,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
@@ -2396,6 +2397,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
return crashreportsystemdetails;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue