bc-minecraft-bedrock-project 1.21.101-7 → 1.21.101-9

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.
@@ -61,7 +61,7 @@ function process(doc) {
61
61
  documentation: types_2.Documentation.getDoc(doc, () => `Model: ${key}`),
62
62
  location: bc_minecraft_bedrock_types_1.Types.Location.create(uri, content.indexOf(key)),
63
63
  root_bone_uses_binding: typeof model.bones[0].binding == "string" ? true : false,
64
- bones: types_1.Defined.wrap(model.bones.map((bone) => bone.name).filter((name) => typeof name !== "string" || name === "")),
64
+ bones: types_1.Defined.wrap(model.bones.map((bone) => bone.name).filter((name) => typeof name === "string" && name !== "")),
65
65
  locators: types_1.Defined.wrap(model.bones
66
66
  .map((bone) => bone.locators)
67
67
  .filter((locators) => locators !== undefined)
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const types_1 = require("../../../types");
4
+ const process_1 = require("./process");
5
+ describe("Models", () => {
6
+ test("can process old format", () => {
7
+ const doc = types_1.TestTextDocument.create("foo.json", old_format);
8
+ const result = (0, process_1.process)(doc);
9
+ expect(result).toMatchSnapshot();
10
+ });
11
+ test("can process new format", () => {
12
+ const doc = types_1.TestTextDocument.create("foo.json", new_format);
13
+ const result = (0, process_1.process)(doc);
14
+ expect(result).toMatchSnapshot();
15
+ });
16
+ });
17
+ const old_format = `{
18
+ "format_version": "1.8.0",
19
+ "geometry.example.v1.8": {
20
+ "visible_bounds_width": 5,
21
+ "visible_bounds_height": 4,
22
+ "visible_bounds_offset": [ 0, 0.5, 0 ],
23
+ "texturewidth": 64,
24
+ "textureheight": 64,
25
+ "bones": [
26
+ {
27
+ "name": "head",
28
+ "pivot": [ 0.0, 0.0, 0.0 ],
29
+ "mirror": true,
30
+ "cubes": []
31
+ },
32
+ {
33
+ "name": "eye",
34
+ "parent": "head",
35
+ "pivot": [ 0.0, 24.0, 0.0 ],
36
+ "cubes": []
37
+ }
38
+ ]
39
+ }
40
+ }`;
41
+ const new_format = `{
42
+ "format_version": "1.12.0",
43
+ "minecraft:geometry": [
44
+ {
45
+ "description": {
46
+ "identifier": "geometry.example",
47
+ "texture_width": 64,
48
+ "texture_height": 64,
49
+ "visible_bounds_width": 1.5,
50
+ "visible_bounds_height": 0.25,
51
+ "visible_bounds_offset": [0, 0.75, 0]
52
+ },
53
+ "bones": [
54
+ {
55
+ "name": "root",
56
+ "pivot": [0, -4, 0]
57
+ },
58
+ {
59
+ "name": "body",
60
+ "parent": "root",
61
+ "pivot": [0, 3, 4],
62
+ "cubes": [],
63
+ "locators": {
64
+ "lead": [0, 0, -5]
65
+ }
66
+ },
67
+ {
68
+ "name": "right_arm",
69
+ "parent": "body",
70
+ "pivot": [-4, 1, -4],
71
+ "rotation": [0, -90, 0],
72
+ "cubes": []
73
+ }
74
+ ]
75
+ }
76
+ ]
77
+ }`;
78
+ //# sourceMappingURL=process.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process.test.js","sourceRoot":"","sources":["../../../../../src/project/resource-pack/model/process.test.ts"],"names":[],"mappings":";;AAAA,0CAAkD;AAClD,uCAAoC;AAEpC,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,IAAI,CAAC,wBAAwB,EAAE,GAAG,EAAE;QAClC,MAAM,GAAG,GAAG,wBAAgB,CAAC,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAC5D,MAAM,MAAM,GAAG,IAAA,iBAAO,EAAC,GAAG,CAAC,CAAC;QAE5B,MAAM,CAAC,MAAM,CAAC,CAAC,eAAe,EAAE,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,wBAAwB,EAAE,GAAG,EAAE;QAClC,MAAM,GAAG,GAAG,wBAAgB,CAAC,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAC5D,MAAM,MAAM,GAAG,IAAA,iBAAO,EAAC,GAAG,CAAC,CAAC;QAE5B,MAAM,CAAC,MAAM,CAAC,CAAC,eAAe,EAAE,CAAC;IACnC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;EAuBjB,CAAC;AAEH,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoCjB,CAAC"}
@@ -18,3 +18,6 @@ export declare namespace TextDocument {
18
18
  */
19
19
  function toObject<T>(doc: TextDocument, checkIs?: (value: any) => value is T): T | undefined;
20
20
  }
21
+ export declare namespace TestTextDocument {
22
+ function create(uri: string, content: string): TextDocument;
23
+ }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  //Note: this is kept sync with vscode form of textdocument for easy of use
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.TextDocument = void 0;
4
+ exports.TestTextDocument = exports.TextDocument = void 0;
5
5
  const json_1 = require("../internal/json");
6
6
  var TextDocument;
7
7
  (function (TextDocument) {
@@ -25,4 +25,14 @@ var TextDocument;
25
25
  }
26
26
  TextDocument.toObject = toObject;
27
27
  })(TextDocument || (exports.TextDocument = TextDocument = {}));
28
+ var TestTextDocument;
29
+ (function (TestTextDocument) {
30
+ function create(uri, content) {
31
+ return {
32
+ uri,
33
+ getText: () => content,
34
+ };
35
+ }
36
+ TestTextDocument.create = create;
37
+ })(TestTextDocument || (exports.TestTextDocument = TestTextDocument = {}));
28
38
  //# sourceMappingURL=text-document.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"text-document.js","sourceRoot":"","sources":["../../../src/types/text-document.ts"],"names":[],"mappings":";AAAA,0EAA0E;;;AAG1E,2CAAwC;AAcxC,IAAiB,YAAY,CAoB5B;AApBD,WAAiB,YAAY;IAC3B;;;;;OAKG;IACH,SAAgB,QAAQ,CAAI,GAAiB,EAAE,OAAoC;QACjF,MAAM,GAAG,GAAG,WAAI,CAAC,EAAE,CAAI,GAAG,CAAC,CAAC;QAE5B,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;gBACjB,OAAO,GAAG,CAAC;YACb,CAAC;iBAAM,CAAC;gBACN,OAAO,SAAS,CAAC;YACnB,CAAC;QACH,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC;IAZe,qBAAQ,WAYvB,CAAA;AACH,CAAC,EApBgB,YAAY,4BAAZ,YAAY,QAoB5B"}
1
+ {"version":3,"file":"text-document.js","sourceRoot":"","sources":["../../../src/types/text-document.ts"],"names":[],"mappings":";AAAA,0EAA0E;;;AAG1E,2CAAwC;AAcxC,IAAiB,YAAY,CAoB5B;AApBD,WAAiB,YAAY;IAC3B;;;;;OAKG;IACH,SAAgB,QAAQ,CAAI,GAAiB,EAAE,OAAoC;QACjF,MAAM,GAAG,GAAG,WAAI,CAAC,EAAE,CAAI,GAAG,CAAC,CAAC;QAE5B,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;gBACjB,OAAO,GAAG,CAAC;YACb,CAAC;iBAAM,CAAC;gBACN,OAAO,SAAS,CAAC;YACnB,CAAC;QACH,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC;IAZe,qBAAQ,WAYvB,CAAA;AACH,CAAC,EApBgB,YAAY,4BAAZ,YAAY,QAoB5B;AAED,IAAiB,gBAAgB,CAOhC;AAPD,WAAiB,gBAAgB;IAC/B,SAAgB,MAAM,CAAC,GAAW,EAAE,OAAe;QACjD,OAAO;YACL,GAAG;YACH,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO;SACvB,CAAC;IACJ,CAAC;IALe,uBAAM,SAKrB,CAAA;AACH,CAAC,EAPgB,gBAAgB,gCAAhB,gBAAgB,QAOhC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bc-minecraft-bedrock-project",
3
- "version": "1.21.101-7",
3
+ "version": "1.21.101-9",
4
4
  "description": "The typescript library responsible for reading/parsing minecraft bedrock data",
5
5
  "main": "./lib/src/main.js",
6
6
  "types": "./lib/src/main.d.ts",
@@ -57,7 +57,7 @@
57
57
  "bc-minecraft-bedrock-command": "^1.21.100-3",
58
58
  "bc-minecraft-bedrock-types": "^1.22.1-16",
59
59
  "bc-minecraft-bedrock-vanilla-data": "^1.21.80-10",
60
- "bc-minecraft-molang": "^1.21.100-9",
60
+ "bc-minecraft-molang": "^1.21.100-11",
61
61
  "bc-minecraft-project": "^1.21.73-8",
62
62
  "jsonc": "^2.0.0"
63
63
  }