mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 17:01:56 +01:00
Add missing null check for structure start chunk access
Spigot made structure start not load chunks, but forgot to null check the result... This likely never blew up before due to the chunk leak issue, but now that leaky chunks are cleaned up, it was identified.
This commit is contained in:
parent
db9534bfdf
commit
1b23cf5819
1 changed files with 21 additions and 0 deletions
|
@ -21,6 +21,14 @@ diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/m
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
}
|
||||
}
|
||||
// Paper start
|
||||
+ if (playerchunk != null) playerchunk.lastActivity = world.getTime(); // Paper
|
||||
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> future = this.a(playerchunk, l) ? PlayerChunk.UNLOADED_CHUNK_ACCESS_FUTURE : playerchunk.a(chunkstatus, this.playerChunkMap);
|
||||
if (isUrgent) {
|
||||
future.thenAccept(either -> this.chunkMapDistance.clearUrgent(chunkcoordintpair));
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
if (chunksTicked[0]++ % 10 == 0) this.world.getMinecraftServer().midTickLoadChunks(); // Paper
|
||||
}
|
||||
|
@ -104,3 +112,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
PlayerChunk playerchunk = (PlayerChunk) this.updatingChunks.remove(j);
|
||||
|
||||
if (playerchunk != null) {
|
||||
diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/StructureGenerator.java
|
||||
+++ b/src/main/java/net/minecraft/server/StructureGenerator.java
|
||||
@@ -0,0 +0,0 @@ public abstract class StructureGenerator<C extends WorldGenFeatureConfiguration>
|
||||
while (longiterator.hasNext()) {
|
||||
long k = longiterator.nextLong();
|
||||
IChunkAccess ichunkaccess1 = generatoraccess.getChunkAt(ChunkCoordIntPair.getX(k), ChunkCoordIntPair.getZ(k), ChunkStatus.STRUCTURE_STARTS, false); // CraftBukkit - don't load chunks
|
||||
- StructureStart structurestart = ichunkaccess1.a(this.b());
|
||||
+ StructureStart structurestart = ichunkaccess1 != null ? ichunkaccess1.a(this.b()) : null; // Paper - make sure not null
|
||||
|
||||
if (structurestart != null) {
|
||||
list.add(structurestart);
|
||||
|
|
Loading…
Reference in a new issue