Files
Construct-CN/packs/BP/scripts/classes/Verifier/SkippedChunkTracker.js
T
wed150 136d5ffa3b
/ build (push) Has been cancelled
Start working at 1.2.0
2026-08-26 09:54:39 +08:00

25 lines
659 B
JavaScript

export class SkippedChunkTracker {
#unloadedChunks = new Set();
#outOfBoundsChunks = new Set();
startLayer() {
this.#outOfBoundsChunks.clear();
}
isSkipped(chunkKey) {
return this.#unloadedChunks.has(chunkKey) || this.#outOfBoundsChunks.has(chunkKey);
}
trackError(error, chunkKey) {
if (error?.name === 'LocationInUnloadedChunkError') {
this.#unloadedChunks.add(chunkKey);
return true;
}
if (error?.name === 'LocationOutOfWorldBoundariesError') {
this.#outOfBoundsChunks.add(chunkKey);
return true;
}
return false;
}
}