mc-assets 0.2.39 → 0.2.40

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.
@@ -22,6 +22,7 @@ export declare class AssetsParser {
22
22
  matchedModels: string[];
23
23
  matchedConditions: string[];
24
24
  private getModelsByBlock;
25
+ private getModelData;
25
26
  getResolvedModelsByModel(model: string, debugQueryName?: string, clearModel?: boolean): {
26
27
  resolvedModel: Pick<BlockModel, "textures" | "ao" | "elements"> & {
27
28
  x?: number;
@@ -171,11 +171,15 @@ export class AssetsParser {
171
171
  }
172
172
  return modelsResolved; // todo figure out the type error
173
173
  }
174
+ getModelData(model) {
175
+ const modelData = this.blockModelsStore.get(this.version, model);
176
+ return modelData && typeof modelData === 'object' ? structuredClone(modelData) : modelData;
177
+ }
174
178
  getResolvedModelsByModel(model, debugQueryName, clearModel = true) {
175
179
  if (clearModel) {
176
180
  this.resolvedModel = {};
177
181
  }
178
- const modelData = this.blockModelsStore.get(this.version, model);
182
+ const modelData = this.getModelData(model);
179
183
  if (!modelData) {
180
184
  this.issues.push(`Model ${model} not found. Ensure it is present in assets/${getNamespace(model)}/models/${model}.json`);
181
185
  return;
@@ -191,7 +195,7 @@ export class AssetsParser {
191
195
  const collectModels = (model) => {
192
196
  collectedParentModels.push(model);
193
197
  if (model.parent) {
194
- const parent = this.blockModelsStore.get(this.version, model.parent);
198
+ const parent = this.getModelData(model.parent);
195
199
  if (!parent) {
196
200
  this.issues.push(`Parent model ${model.parent} not found for ${debugQueryName}`);
197
201
  return;
@@ -218,7 +222,7 @@ export class AssetsParser {
218
222
  }
219
223
  }
220
224
  if (model.elements) {
221
- this.resolvedModel.elements = structuredClone(model.elements);
225
+ this.resolvedModel.elements = model.elements;
222
226
  }
223
227
  for (const [key, value] of Object.entries(model)) {
224
228
  if (key !== 'elements' && key !== 'textures' && key !== 'parent') {
@@ -151741,18 +151741,18 @@
151741
151741
  "gui": {
151742
151742
  "rotation": [
151743
151743
  30,
151744
- 45,
151744
+ 225,
151745
151745
  0
151746
151746
  ],
151747
151747
  "translation": [
151748
151748
  0,
151749
- -1,
151749
+ 0,
151750
151750
  0
151751
151751
  ],
151752
151752
  "scale": [
151753
- 0.8,
151754
- 0.8,
151755
- 0.8
151753
+ 0.625,
151754
+ 0.625,
151755
+ 0.625
151756
151756
  ]
151757
151757
  },
151758
151758
  "ground": {
@@ -151798,7 +151798,7 @@
151798
151798
  "translation": [
151799
151799
  0,
151800
151800
  2.5,
151801
- 2
151801
+ 0
151802
151802
  ],
151803
151803
  "scale": [
151804
151804
  0.375,
@@ -151814,7 +151814,7 @@
151814
151814
  ],
151815
151815
  "translation": [
151816
151816
  0,
151817
- 4.2,
151817
+ 0,
151818
151818
  0
151819
151819
  ],
151820
151820
  "scale": [
@@ -151831,7 +151831,7 @@
151831
151831
  ],
151832
151832
  "translation": [
151833
151833
  0,
151834
- 4.2,
151834
+ 0,
151835
151835
  0
151836
151836
  ],
151837
151837
  "scale": [
@@ -151839,40 +151839,6 @@
151839
151839
  0.4,
151840
151840
  0.4
151841
151841
  ]
151842
- },
151843
- "head": {
151844
- "rotation": [
151845
- 0,
151846
- 0,
151847
- 0
151848
- ],
151849
- "translation": [
151850
- 0,
151851
- -3,
151852
- -6
151853
- ],
151854
- "scale": [
151855
- 1,
151856
- 1,
151857
- 1
151858
- ]
151859
- },
151860
- "thirdperson_lefthand": {
151861
- "rotation": [
151862
- 75,
151863
- -45,
151864
- 0
151865
- ],
151866
- "translation": [
151867
- 0,
151868
- 2.5,
151869
- 0
151870
- ],
151871
- "scale": [
151872
- 0.375,
151873
- 0.375,
151874
- 0.375
151875
- ]
151876
151842
  }
151877
151843
  }
151878
151844
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mc-assets",
3
- "version": "0.2.39",
3
+ "version": "0.2.40",
4
4
  "author": "Vitaly Turovsky <vital2580@icloud.com>",
5
5
  "license": "MIT",
6
6
  "files": [