here, try this runVerifier
This commit is contained in:
@@ -17,21 +17,45 @@ export class StructureVerifier {
|
|||||||
|
|
||||||
async runVerifier() {
|
async runVerifier() {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
this.verifyBlocks();
|
system.runJob(this.verifyBlocks);
|
||||||
resolve();
|
const checker = system.runInterval(() => {
|
||||||
|
if (this.isComplete) {
|
||||||
|
system.clearRun(checker);
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
}, 1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
verifyBlocks() {
|
*verifyBlocks() {
|
||||||
for (const block of this.instance.getBlocks()) {
|
for (const block of this.instance.getBlocks()) {
|
||||||
const verificationLevel = this.verifyBlock(block.location);
|
const verificationLevel = this.verifyBlock(block.location);
|
||||||
if (verificationLevel !== BlockVerificationLevel.isAir)
|
if (verificationLevel !== BlockVerificationLevel.isAir)
|
||||||
this.blockVerificationLevels[JSON.stringify(block.location)] = verificationLevel;
|
this.blockVerificationLevels[JSON.stringify(block.location)] = verificationLevel;
|
||||||
else
|
else
|
||||||
this.statistics.correctlyAir++;
|
this.statistics.correctlyAir++;
|
||||||
|
yield;
|
||||||
}
|
}
|
||||||
|
this.isComplete = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// async runVerifier() {
|
||||||
|
// return new Promise((resolve) => {
|
||||||
|
// this.verifyBlocks();
|
||||||
|
// resolve();
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// verifyBlocks() {
|
||||||
|
// for (const block of this.instance.getBlocks()) {
|
||||||
|
// const verificationLevel = this.verifyBlock(block.location);
|
||||||
|
// if (verificationLevel !== BlockVerificationLevel.isAir)
|
||||||
|
// this.blockVerificationLevels[JSON.stringify(block.location)] = verificationLevel;
|
||||||
|
// else
|
||||||
|
// this.statistics.correctlyAir++;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
verifyBlock(location) {
|
verifyBlock(location) {
|
||||||
const worldBlock = this.instance.getDimension().getBlock(this.instance.toGlobalCoords(location));
|
const worldBlock = this.instance.getDimension().getBlock(this.instance.toGlobalCoords(location));
|
||||||
if (!worldBlock)
|
if (!worldBlock)
|
||||||
|
|||||||
Reference in New Issue
Block a user