#1038: Removed the no longer needed getChunkUnchecked method from ChunkProviderServer.

This method was added in 373ed1ddd5 to fix SPIGOT-5228. But since Minecraft 1.17 changed how entities are added and removed from chunks, this method has no longer been used.

By: blablubbabc <lukas@wirsindwir.de>
This commit is contained in:
CraftBukkit/Spigot 2022-03-27 16:24:09 +11:00
parent 475d10469d
commit 813ab8f174

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/ChunkProviderServer.java
+++ b/net/minecraft/server/level/ChunkProviderServer.java
@@ -83,6 +83,24 @@
@@ -83,6 +83,16 @@
this.clearCache();
}
@ -12,20 +12,12 @@
+ }
+ return chunk.getFullChunkNow() != null;
+ }
+
+ public Chunk getChunkUnchecked(int chunkX, int chunkZ) {
+ PlayerChunk chunk = this.chunkMap.getUpdatingChunkIfPresent(ChunkCoordIntPair.asLong(chunkX, chunkZ));
+ if (chunk == null) {
+ return null;
+ }
+ return chunk.getFullChunkNowUnchecked();
+ }
+ // CraftBukkit end
+
@Override
public LightEngineThreaded getLightEngine() {
return this.lightEngine;
@@ -127,7 +145,7 @@
@@ -127,7 +137,7 @@
for (int l = 0; l < 4; ++l) {
if (k == this.lastChunkPos[l] && chunkstatus == this.lastChunkStatus[l]) {
ichunkaccess = this.lastChunk[l];
@ -34,7 +26,7 @@
return ichunkaccess;
}
}
@@ -175,12 +193,12 @@
@@ -175,12 +185,12 @@
if (playerchunk == null) {
return null;
} else {
@ -49,7 +41,7 @@
if (ichunkaccess1 != null) {
this.storeInCache(k, ichunkaccess1, ChunkStatus.FULL);
@@ -228,7 +246,15 @@
@@ -228,7 +238,15 @@
int l = 33 + ChunkStatus.getDistance(chunkstatus);
PlayerChunk playerchunk = this.getVisibleChunkIfPresent(k);
@ -66,7 +58,7 @@
this.distanceManager.addTicket(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
if (this.chunkAbsent(playerchunk, l)) {
GameProfilerFiller gameprofilerfiller = this.level.getProfiler();
@@ -247,7 +273,7 @@
@@ -247,7 +265,7 @@
}
private boolean chunkAbsent(@Nullable PlayerChunk playerchunk, int i) {
@ -75,7 +67,7 @@
}
@Override
@@ -314,7 +340,7 @@
@@ -314,7 +332,7 @@
} else if (!this.level.shouldTickBlocksAt(i)) {
return false;
} else {
@ -84,7 +76,7 @@
return either != null && either.left().isPresent();
}
@@ -327,11 +353,31 @@
@@ -327,11 +345,31 @@
@Override
public void close() throws IOException {
@ -117,7 +109,7 @@
@Override
public void tick(BooleanSupplier booleansupplier, boolean flag) {
this.level.getProfiler().push("purge");
@@ -363,7 +409,7 @@
@@ -363,7 +401,7 @@
gameprofilerfiller.push("pollingChunks");
int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
@ -126,7 +118,7 @@
gameprofilerfiller.push("naturalSpawnCount");
int l = this.distanceManager.getNaturalSpawnChunkCount();
@@ -384,7 +430,7 @@
@@ -384,7 +422,7 @@
}
gameprofilerfiller.popPush("spawnAndTick");
@ -135,7 +127,7 @@
Collections.shuffle(list);
Iterator iterator1 = list.iterator();
@@ -581,18 +627,26 @@
@@ -581,18 +619,26 @@
}
@Override
@ -164,7 +156,7 @@
final Chunk chunk;
final PlayerChunk holder;
@@ -608,5 +662,7 @@
@@ -608,5 +654,7 @@
public PlayerChunk holder() {
return this.holder;
}