@bedrock-oss/bedrock-boost
    Preparing search index...

    Function jobPromise

    • Runs a job and returns a promise that resolves when the job is done.

      Type Parameters

      • Result

      Parameters

      • generator: Generator<void, Result, void>

        The generator function to run.

      Returns Promise<Result>

      A promise that resolves when the job is done.

      const dimension = world.getDimension(MinecraftDimensionTypes.overworld);
      function* generator(startLocation: Vec3): Generator<void, Block | undefined, void> {
      for (let x = 0; x < 10; x++) {
      for (let z = 0; z < 10; z++) {
      for (let y = 0; y < 10; y++) {
      const location = startLocation.add(x, y, z);
      const block = dimension.getBlock(location);
      if (block && block.isSolid) {
      return block;
      }
      yield;
      }
      }
      }
      }
      jobPromise(generator(Vec3.from(0, 0, 0)))
      .then(console.log);