Skip to content

Commit 8021c38

Browse files
committed
fix: we block sets
1 parent 45b4aaa commit 8021c38

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/modules/world-edit/lib/world-edit.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,16 @@ import {
88
system,
99
world,
1010
} from '@minecraft/server'
11-
import { Vector, getRole, prompt, util } from 'lib'
11+
import { Vector, getRole, prompt } from 'lib'
1212
import { Sounds } from 'lib/assets/config'
1313
import { table } from 'lib/database/abstract'
1414
import { ngettext, t } from 'lib/text'
15-
import stringifyError from 'lib/utils/error'
15+
import { stringify } from 'lib/utils/inspect'
1616
import { WeakPlayerMap } from 'lib/weak-player-storage'
1717
import { stringifyReplaceTargets, toPermutation, toReplaceTarget } from 'modules/world-edit/menu'
1818
import { WE_CONFIG, spawnParticlesInArea } from '../config'
1919
import { BigStructure } from './big-structure'
2020
import { Cuboid } from './ccuboid'
21-
import { stringify } from 'lib/utils/inspect'
2221

2322
// TODO Add WorldEdit.runMultipleAsyncJobs
2423

@@ -364,13 +363,14 @@ export class WorldEdit {
364363
system.runJob(
365364
(function* fillBetweenJob() {
366365
nextBlock: for (const position of Vector.foreach(selection.min, selection.max)) {
366+
const block = world.overworld.getBlock(position)
367+
367368
for (const replaceBlock of replaceTargets) {
368369
try {
369-
const block = world.overworld.getBlock(position)
370-
371370
if (replaceBlock && !block?.permutation.matches(replaceBlock.typeId, replaceBlock.states)) continue
372371

373372
block?.setPermutation(toPermutation(blocks.randomElement()))
373+
yield
374374
continue nextBlock
375375
} catch (e) {
376376
if (errors < 3 && e instanceof Error) {
@@ -384,10 +384,9 @@ export class WorldEdit {
384384
console.error(e)
385385

386386
errors++
387+
} finally {
388+
all++
387389
}
388-
389-
all++
390-
yield
391390
}
392391
}
393392
})(),

src/modules/world-edit/utils/blocks-set.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ export function setBlocksSet(id: string, setName: string, set: BlocksSet | undef
4545
}
4646

4747
function getActiveBlockInSetByRef([playerId, blocksSetName]: BlocksSetRef): BlocksSet | undefined {
48-
return getAllBlocksSets(playerId)[blocksSetName].filter(e => e[2] > 0)
48+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
49+
return getAllBlocksSets(playerId)[blocksSetName]?.filter(e => e[2] > 0)
4950
}
5051

5152
export function getBlocksSetByRef([playerId, blocksSetName]: BlocksSetRef) {

0 commit comments

Comments
 (0)