@starktma/minecraft-utils 1.0.0 → 1.0.1
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.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/math/index.d.ts.map +1 -0
- package/dist/minecraft/index.d.ts.map +1 -0
- package/package.json +10 -2
- package/src/math/index.ts +1 -1
- package/src/minecraft/index.ts +10 -8
- package/tsconfig.json +17 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/math/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM,CAIhF;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAmBlG;AAED;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAErE;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAG9C;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,SAAS,GAAE,MAAY,GAAG,OAAO,CAEvF;AAED;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAExE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/minecraft/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAS,MAAM,mBAAmB,CAAC;AAG1E,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,KAAK,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,WA4BnG;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,OAAO,EAAE,GAAG,QAO3E;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGxD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAEtD"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@starktma/minecraft-utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"keywords": [],
|
|
8
8
|
"author": "",
|
|
9
9
|
"license": "ISC",
|
|
10
|
-
"type": "
|
|
10
|
+
"type": "module",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "npx -p typescript tsc --project tsconfig.json"
|
|
13
|
+
},
|
|
11
14
|
"exports": {
|
|
12
15
|
".": {
|
|
13
16
|
"import": "./dist/index.js",
|
|
@@ -24,5 +27,10 @@
|
|
|
24
27
|
},
|
|
25
28
|
"publishConfig": {
|
|
26
29
|
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@minecraft/server": "^2.1.0",
|
|
33
|
+
"@minecraft/server-ui": "^2.0.0",
|
|
34
|
+
"typescript": "^5.9.2"
|
|
27
35
|
}
|
|
28
36
|
}
|
package/src/math/index.ts
CHANGED
package/src/minecraft/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Player, Entity, Block, Vector3 } from "@minecraft/server";
|
|
1
|
+
import { Player, Entity, Block, Vector3, world } from "@minecraft/server";
|
|
2
2
|
import { calculateDistance, toUnsigned } from "../math";
|
|
3
3
|
|
|
4
4
|
export function getBlocksInASphere(centerBlock: Block | Entity, radius: number, innerRadius?: number) {
|
|
@@ -31,11 +31,13 @@ export function getBlocksInASphere(centerBlock: Block | Entity, radius: number,
|
|
|
31
31
|
return [];
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
export function displayActionbar(player: Player, ...message: any) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
export function displayActionbar(player: Player | undefined, ...message: any) {
|
|
35
|
+
const text = message.join(" ");
|
|
36
|
+
let target;
|
|
37
|
+
let selector;
|
|
38
|
+
target = player && player.isValid ? player : world.getDimension("overworld");
|
|
39
|
+
selector = player ? `@s` : `@a`;
|
|
40
|
+
target.runCommand(`title @s actionbar ${JSON.stringify(text)}`);
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
/**
|
|
@@ -56,5 +58,5 @@ export function snapRotationToGrid(angle: number): number {
|
|
|
56
58
|
* @returns A new vector with each component rounded to the nearest integer.
|
|
57
59
|
*/
|
|
58
60
|
export function snapLocationToGrid(v: Vector3): Vector3 {
|
|
59
|
-
return { x: Math.round(v.x), y: Math.
|
|
60
|
-
}
|
|
61
|
+
return { x: Math.round(v.x), y: Math.floor(v.y), z: Math.round(v.z) };
|
|
62
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
+
"module": "esnext",
|
|
4
|
+
"moduleResolution": "bundler",
|
|
5
|
+
"target": "ES2022",
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"sourceMap": true,
|
|
8
|
+
"strict": true,
|
|
9
|
+
"forceConsistentCasingInFileNames": true,
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
|
|
12
|
+
"composite": true,
|
|
13
|
+
"declaration": true,
|
|
14
|
+
"declarationMap": true,
|
|
15
|
+
"incremental": true,
|
|
16
|
+
"skipLibCheck": true,
|
|
17
|
+
"noEmitOnError": true,
|
|
18
|
+
"typeRoots": ["./node_modules/@types"],
|
|
3
19
|
"outDir": "./dist",
|
|
4
20
|
"rootDir": "./src"
|
|
5
|
-
}
|
|
6
|
-
"extends": "../../tsconfig.base.json"
|
|
21
|
+
}
|
|
7
22
|
}
|