yeow-api 0.2.21 → 0.2.22
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/package.json +1 -1
- package/src/world.ts +2 -1
package/package.json
CHANGED
package/src/world.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { call, post } from './task.js';
|
|
2
2
|
import { Location } from './location.js';
|
|
3
|
+
import { Block } from './block.js';
|
|
3
4
|
|
|
4
5
|
export class World {
|
|
5
6
|
static get(name: string): World | null { const d = call('world.get', { name }) as any; return d ? new World(d.name) : null; }
|
|
@@ -23,7 +24,7 @@ export class World {
|
|
|
23
24
|
setGameRule(rule: string, value: string): Promise<boolean> { return post('world.setGameRule', { world: this.name, rule, value }) as Promise<boolean>; }
|
|
24
25
|
setGameRuleSync(rule: string, value: string): boolean { return call('world.setGameRule', { world: this.name, rule, value }) as boolean; }
|
|
25
26
|
getBiome(x: number, y: number, z: number): string { return call('world.getBiome', { world: this.name, x, y, z }) as string; }
|
|
26
|
-
getBlock(x: number, y: number, z: number):
|
|
27
|
+
getBlock(x: number, y: number, z: number): Block | null { const r = call('world.getBlock', { world: this.name, x, y, z }) as any; return r ? new Block(this.name, r.x, r.y, r.z, r.type) : null; }
|
|
27
28
|
setBlock(x: number, y: number, z: number, blockType: string): Promise<void> { return post('world.setBlock', { world: this.name, x, y, z, blockType }) as Promise<void>; }
|
|
28
29
|
setBlockSync(x: number, y: number, z: number, blockType: string) { call('world.setBlock', { world: this.name, x, y, z, blockType }); }
|
|
29
30
|
getEntities(): string[] { return call('world.getEntities', { world: this.name }) as string[]; }
|