Remove unused chunk system hooks in MCUtils

This commit is contained in:
Spottedleaf
2024-07-17 11:08:28 -07:00
parent cc8d4390d4
commit 077f411288
3 changed files with 9 additions and 148 deletions

View File

@@ -30,5 +30,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ +
@Override @Override
public final ChunkAccess getChunk(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) { // Paper - final for inline public ChunkAccess getChunk(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) {
// Paper end // Paper end

View File

@@ -4854,64 +4854,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private int ticketLevel; private int ticketLevel;
private int queueLevel; private int queueLevel;
@@ -0,0 +0,0 @@ public class ChunkHolder extends GenerationChunkHolder { @@ -0,0 +0,0 @@ public class ChunkHolder extends GenerationChunkHolder {
private CompletableFuture<?> sendSync;
private CompletableFuture<?> saveSync;
+ private final ChunkMap chunkMap; // Paper
+
+ // Paper start
+ public void onChunkAdd() {
+
+ }
+
+ public void onChunkRemove() {
+
+ }
+ // Paper end
+
public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) {
super(pos);
this.fullChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE;
@@ -0,0 +0,0 @@ public class ChunkHolder extends GenerationChunkHolder {
this.queueLevel = this.oldTicketLevel;
this.setTicketLevel(level);
this.changedBlocksPerSection = new ShortSet[world.getSectionsCount()];
+ this.chunkMap = (ChunkMap)playersWatchingChunkProvider; // Paper
}
+ // Paper start
+ public @Nullable ChunkAccess getAvailableChunkNow() {
+ // TODO can we just getStatusFuture(EMPTY)?
+ for (ChunkStatus curr = ChunkStatus.FULL, next = curr.getParent(); curr != next; curr = next, next = next.getParent()) {
+ ChunkAccess chunkAccess = this.getChunkIfPresentUnchecked(curr);
+ if (chunkAccess == null) {
+ continue;
+ }
+ return chunkAccess;
+ }
+ return null;
+ }
+ // Paper end
// CraftBukkit start
public LevelChunk getFullChunkNow() {
// Note: We use the oldTicketLevel for isLoaded checks.
@@ -0,0 +0,0 @@ public class ChunkHolder extends GenerationChunkHolder {
}
// CraftBukkit end
- public CompletableFuture<ChunkResult<LevelChunk>> getTickingChunkFuture() {
+ public final CompletableFuture<ChunkResult<LevelChunk>> getTickingChunkFuture() { // Paper - final for inline
return this.tickingChunkFuture;
}
- public CompletableFuture<ChunkResult<LevelChunk>> getEntityTickingChunkFuture() {
+ public final CompletableFuture<ChunkResult<LevelChunk>> getEntityTickingChunkFuture() { // Paper - final for inline
return this.entityTickingChunkFuture;
}
- public CompletableFuture<ChunkResult<LevelChunk>> getFullChunkFuture() {
+ public final CompletableFuture<ChunkResult<LevelChunk>> getFullChunkFuture() { // Paper - final for inline
return this.fullChunkFuture;
} }
@Nullable @Nullable
@@ -4920,36 +4862,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return (LevelChunk) ((ChunkResult) this.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).orElse(null); // CraftBukkit - decompile error return (LevelChunk) ((ChunkResult) this.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).orElse(null); // CraftBukkit - decompile error
} }
@@ -0,0 +0,0 @@ public class ChunkHolder extends GenerationChunkHolder {
}
+ // Paper start
+ public @Nullable ChunkStatus getChunkHolderStatus() {
+ for (ChunkStatus curr = ChunkStatus.FULL, next = curr.getParent(); curr != next; curr = next, next = next.getParent()) {
+ ChunkAccess chunkAccess = this.getChunkIfPresentUnchecked(curr);
+ if (chunkAccess == null) {
+ continue;
+ }
+ return curr;
+ }
+
+ return null;
+ }
+ // Paper end
+
public CompletableFuture<?> getSaveSyncFuture() {
return this.saveSync;
}
@@ -0,0 +0,0 @@ public class ChunkHolder extends GenerationChunkHolder {
}
@Override
- public int getTicketLevel() {
+ public final int getTicketLevel() { // Paper - final for inline
return this.ticketLevel;
}
@@ -0,0 +0,0 @@ public class ChunkHolder extends GenerationChunkHolder { @@ -0,0 +0,0 @@ public class ChunkHolder extends GenerationChunkHolder {
this.wasAccessibleSinceLastSave |= flag1; this.wasAccessibleSinceLastSave |= flag1;
@@ -5102,12 +5014,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
} }
+ // Paper start
+ holder.onChunkAdd();
+ // Paper end
this.updatingChunkMap.put(pos, holder); this.updatingChunkMap.put(pos, holder);
this.modified = true;
}
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
protected void saveAllChunks(boolean flush) { protected void saveAllChunks(boolean flush) {
@@ -5135,14 +5042,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
private void processUnloads(BooleanSupplier shouldKeepTicking) { private void processUnloads(BooleanSupplier shouldKeepTicking) {
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
this.updatingChunkMap.remove(j);
+ playerchunk.onChunkRemove(); // Paper
this.pendingUnloads.put(j, playerchunk);
this.modified = true;
++i;
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} }
@@ -5834,21 +5733,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ +
@Override @Override
- public ChunkAccess getChunk(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) { public ChunkAccess getChunk(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) {
+ public final ChunkAccess getChunk(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) { // Paper - final for inline
+ // Paper end + // Paper end
ChunkAccess ichunkaccess = this.getChunkSource().getChunk(chunkX, chunkZ, leastStatus, create); ChunkAccess ichunkaccess = this.getChunkSource().getChunk(chunkX, chunkZ, leastStatus, create);
if (ichunkaccess == null && create) { if (ichunkaccess == null && create) {
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
@Override
- public boolean setBlock(BlockPos pos, BlockState state, int flags) {
+ public final boolean setBlock(BlockPos pos, BlockState state, int flags) { // Paper - final for inline
return this.setBlock(pos, state, flags, 512);
}
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
if (this.isOutsideBuildHeight(pos)) { if (this.isOutsideBuildHeight(pos)) {
return Blocks.VOID_AIR.defaultBlockState(); return Blocks.VOID_AIR.defaultBlockState();

View File

@@ -22720,13 +22720,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- private CompletableFuture<?> sendSync; - private CompletableFuture<?> sendSync;
- private CompletableFuture<?> saveSync; - private CompletableFuture<?> saveSync;
+ // Paper - rewrite chunk system + // Paper - rewrite chunk system
+
private final ChunkMap chunkMap; // Paper
@@ -0,0 +0,0 @@ public class ChunkHolder extends GenerationChunkHolder {
}
// Paper end
+ // Paper start - rewrite chunk system + // Paper start - rewrite chunk system
+ private ca.spottedleaf.moonrise.patches.chunk_system.scheduling.NewChunkHolder newChunkHolder; + private ca.spottedleaf.moonrise.patches.chunk_system.scheduling.NewChunkHolder newChunkHolder;
+ +
@@ -22819,7 +22813,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return true; + return true;
+ } + }
+ // Paper end - rewrite chunk system + // Paper end - rewrite chunk system
+
public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) { public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) {
super(pos); super(pos);
- this.fullChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE; - this.fullChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE;
@@ -22843,23 +22837,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper - rewrite chunk system + // Paper - rewrite chunk system
this.setTicketLevel(level); this.setTicketLevel(level);
this.changedBlocksPerSection = new ShortSet[world.getSectionsCount()]; this.changedBlocksPerSection = new ShortSet[world.getSectionsCount()];
this.chunkMap = (ChunkMap)playersWatchingChunkProvider; // Paper
@@ -0,0 +0,0 @@ public class ChunkHolder extends GenerationChunkHolder {
// Paper start
public @Nullable ChunkAccess getAvailableChunkNow() {
- // TODO can we just getStatusFuture(EMPTY)?
- for (ChunkStatus curr = ChunkStatus.FULL, next = curr.getParent(); curr != next; curr = next, next = next.getParent()) {
- ChunkAccess chunkAccess = this.getChunkIfPresentUnchecked(curr);
- if (chunkAccess == null) {
- continue;
- }
- return chunkAccess;
- }
- return null;
+ return this.getChunkIfPresent(ChunkStatus.EMPTY); // Paper - rewrite chunk system
} }
// Paper end @@ -0,0 +0,0 @@ public class ChunkHolder extends GenerationChunkHolder {
// CraftBukkit start // CraftBukkit start
public LevelChunk getFullChunkNow() { public LevelChunk getFullChunkNow() {
// Note: We use the oldTicketLevel for isLoaded checks. // Note: We use the oldTicketLevel for isLoaded checks.
@@ -22871,17 +22850,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class ChunkHolder extends GenerationChunkHolder { @@ -0,0 +0,0 @@ public class ChunkHolder extends GenerationChunkHolder {
// CraftBukkit end // CraftBukkit end
public final CompletableFuture<ChunkResult<LevelChunk>> getTickingChunkFuture() { // Paper - final for inline public CompletableFuture<ChunkResult<LevelChunk>> getTickingChunkFuture() {
- return this.tickingChunkFuture; - return this.tickingChunkFuture;
+ throw new UnsupportedOperationException(); // Paper - rewrite chunk system + throw new UnsupportedOperationException(); // Paper - rewrite chunk system
} }
public final CompletableFuture<ChunkResult<LevelChunk>> getEntityTickingChunkFuture() { // Paper - final for inline public CompletableFuture<ChunkResult<LevelChunk>> getEntityTickingChunkFuture() {
- return this.entityTickingChunkFuture; - return this.entityTickingChunkFuture;
+ throw new UnsupportedOperationException(); // Paper - rewrite chunk system + throw new UnsupportedOperationException(); // Paper - rewrite chunk system
} }
public final CompletableFuture<ChunkResult<LevelChunk>> getFullChunkFuture() { // Paper - final for inline public CompletableFuture<ChunkResult<LevelChunk>> getFullChunkFuture() {
- return this.fullChunkFuture; - return this.fullChunkFuture;
+ throw new UnsupportedOperationException(); // Paper - rewrite chunk system + throw new UnsupportedOperationException(); // Paper - rewrite chunk system
} }
@@ -22928,9 +22907,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
@@ -0,0 +0,0 @@ public class ChunkHolder extends GenerationChunkHolder {
// Paper end
public CompletableFuture<?> getSaveSyncFuture() { public CompletableFuture<?> getSaveSyncFuture() {
- return this.saveSync; - return this.saveSync;
+ throw new UnsupportedOperationException(); // Paper - rewrite chunk system + throw new UnsupportedOperationException(); // Paper - rewrite chunk system
@@ -22989,7 +22965,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class ChunkHolder extends GenerationChunkHolder { @@ -0,0 +0,0 @@ public class ChunkHolder extends GenerationChunkHolder {
@Override @Override
public final int getTicketLevel() { // Paper - final for inline public int getTicketLevel() {
- return this.ticketLevel; - return this.ticketLevel;
+ return this.newChunkHolder.getTicketLevel(); // Paper - rewrite chunk system + return this.newChunkHolder.getTicketLevel(); // Paper - rewrite chunk system
} }
@@ -23467,9 +23443,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- // Paper end - // Paper end
- } - }
- -
- // Paper start
- holder.onChunkAdd();
- // Paper end
- this.updatingChunkMap.put(pos, holder); - this.updatingChunkMap.put(pos, holder);
- this.modified = true; - this.modified = true;
- } - }
@@ -23547,7 +23520,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- } - }
- -
- this.updatingChunkMap.remove(j); - this.updatingChunkMap.remove(j);
- playerchunk.onChunkRemove(); // Paper
- this.pendingUnloads.put(j, playerchunk); - this.pendingUnloads.put(j, playerchunk);
- this.modified = true; - this.modified = true;
- ++i; - ++i;