@orusteam/solariscore 2.5.1 → 2.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +20 -1
- package/dist/utils/ChunkUtil.d.ts +2 -1
- package/dist/utils/ChunkUtil.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -523,7 +523,7 @@
|
|
|
523
523
|
return this.dimension.isChunkLoaded(new Vector3Builder(this.chunkOrigin.x, 0, this.chunkOrigin.z));
|
|
524
524
|
}
|
|
525
525
|
};
|
|
526
|
-
var ChunkUtil = class {
|
|
526
|
+
var ChunkUtil = class _ChunkUtil {
|
|
527
527
|
static chunksCache = /* @__PURE__ */ new Map();
|
|
528
528
|
static getChunk(dimension, location) {
|
|
529
529
|
const chunkId = this.getChunkId(location);
|
|
@@ -545,6 +545,25 @@
|
|
|
545
545
|
z: Math.floor(location.z / 16)
|
|
546
546
|
};
|
|
547
547
|
}
|
|
548
|
+
static getNearbyChunks(dimension, location, renderDistance = 5) {
|
|
549
|
+
const chunks = [];
|
|
550
|
+
for (let x = -renderDistance; x < renderDistance; x++) {
|
|
551
|
+
const chunkX = location.x + x * 16;
|
|
552
|
+
for (let z = -renderDistance; z < renderDistance; z++) {
|
|
553
|
+
const chunkLocation = {
|
|
554
|
+
x: chunkX,
|
|
555
|
+
z: location.z + z * 16
|
|
556
|
+
};
|
|
557
|
+
const chunk = _ChunkUtil.getChunk(dimension, chunkLocation);
|
|
558
|
+
const distance = Math.sqrt(
|
|
559
|
+
Math.pow(chunkLocation.x - location.x, 2) + Math.pow(chunkLocation.z - location.z, 2)
|
|
560
|
+
);
|
|
561
|
+
chunks.push({ chunk, distance });
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
chunks.sort((a, b) => a.distance - b.distance);
|
|
565
|
+
return chunks.map(({ chunk }) => chunk);
|
|
566
|
+
}
|
|
548
567
|
static async waitForChunkLoad(dimension, location) {
|
|
549
568
|
return new Promise((resolve) => {
|
|
550
569
|
const runId = import_server2.system.runInterval(async () => {
|
|
@@ -10,9 +10,10 @@ declare class ChunkManager {
|
|
|
10
10
|
}
|
|
11
11
|
declare class ChunkUtil {
|
|
12
12
|
private static chunksCache;
|
|
13
|
-
static getChunk(dimension: Dimension, location:
|
|
13
|
+
static getChunk(dimension: Dimension, location: VectorXZ): ChunkManager | undefined;
|
|
14
14
|
static getChunkId(location: VectorXZ): string;
|
|
15
15
|
static getChunkXZ(location: VectorXZ): VectorXZ;
|
|
16
|
+
static getNearbyChunks(dimension: Dimension, location: Vector3, renderDistance?: number): ChunkManager[];
|
|
16
17
|
static waitForChunkLoad(dimension: Dimension, location: Vector3): Promise<void>;
|
|
17
18
|
}
|
|
18
19
|
export { ChunkManager, ChunkUtil };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChunkUtil.d.ts","sourceRoot":"","sources":["../../src/utils/ChunkUtil.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAU,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAIzE,cAAM,YAAY;IAMF,QAAQ,CAAC,SAAS,EAAE,SAAS;IALzC,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,OAAO,CAAS;gBAER,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ;IAS7D,IAAI,QAAQ,IAAI,OAAO,CAEtB;CACJ;AAID,cAAM,SAAS;IACX,OAAO,CAAC,MAAM,CAAC,WAAW,CAAmC;IAE7D,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"ChunkUtil.d.ts","sourceRoot":"","sources":["../../src/utils/ChunkUtil.ts"],"names":[],"mappings":"AACA,OAAO,EA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