pw-js-api 0.1.3-dev.73c0476 → 0.1.3-dev.95ab0ec

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/esm.mjs CHANGED
@@ -5,11 +5,12 @@ if ("default" in PWGameClient) PWGameClient = PWGameClient.default;
5
5
  if ("default" in PWApiClient) PWApiClient = PWApiClient.default;
6
6
 
7
7
  const Constants = (await import("./dist/util/Constants.js")).default;
8
+ const BlockNames = (await import("./dist/util/block.js")).BlockNames;
8
9
 
9
10
  export default {
10
- PWGameClient, PWApiClient, Constants
11
+ PWGameClient, PWApiClient, Constants, BlockNames
11
12
  };
12
13
 
13
14
  export {
14
- PWGameClient, PWApiClient, Constants
15
+ PWGameClient, PWApiClient, Constants, BlockNames
15
16
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pw-js-api",
3
- "version": "0.1.3-dev.73c0476",
3
+ "version": "0.1.3-dev.95ab0ec",
4
4
  "description": "A PixelWalker Library, aims to be minimal with support for browsers.",
5
5
  "exports": {
6
6
  "bun": "./dist/index.js",
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "keywords": [
12
12
  "PixelWalker",
13
- "Typescript"
13
+ "Core"
14
14
  ],
15
15
  "author": "Doomester",
16
16
  "repository": {
@@ -40,6 +40,7 @@
40
40
  "test": "bun test/index.ts",
41
41
  "build": "rimraf dist && tsc -p tsconfig.json && ncp lib/types dist/types",
42
42
  "build:proto": "node scripts/build-proto.mjs && buf generate",
43
+ "build:mappings": "node scripts/build-mappings.mjs",
43
44
  "browsify": "rimraf browser && npm-run-all -p browsify-*",
44
45
  "browsify-prod": "cross-env NODE_ENV=production webpack --mode=production",
45
46
  "browsify-dev": "cross-env NODE_ENV=development webpack --mode=development"
@@ -0,0 +1,19 @@
1
+ import { writeFile } from "fs/promises";
2
+
3
+ /**
4
+ * @type {Record<String, number>}
5
+ */
6
+ const mappings = await fetch("https://game.pixelwalker.net/mappings")
7
+ .then(res => res.json());
8
+
9
+ const entries = Object.entries(mappings);
10
+
11
+ let tsOutput = "export enum BlockNames {\n";
12
+
13
+ for (let i = 0, len = entries.length; i < len; i++) {
14
+ tsOutput += " " + entries[i][0].toUpperCase() + " = " + entries[i][1] + ",\n"
15
+ }
16
+
17
+ tsOutput += "}";
18
+
19
+ writeFile("./lib/util/block.ts", tsOutput);