mc-assets 0.2.34 → 0.2.36
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/README.MD +1 -1
- package/dist/assetsParser.d.ts +3 -0
- package/dist/assetsParser.js +48 -9
- package/dist/atlasCreator.d.ts +1 -0
- package/dist/atlasCreator.js +57 -58
- package/dist/atlasParser.d.ts +1 -0
- package/dist/atlasParser.js +107 -1
- package/dist/blocksAtlasLatest.png +0 -0
- package/dist/blocksAtlasLegacy.png +0 -0
- package/dist/blocksAtlases.json +6764 -6774
- package/dist/itemsAtlasLatest.png +0 -0
- package/dist/itemsAtlasLegacy.png +0 -0
- package/dist/itemsAtlases.json +4671 -4681
- package/dist/itemsRenderer.test.js +41 -76
- package/dist/particlesAtlasLatest.png +0 -0
- package/dist/particlesAtlasLegacy.png +0 -0
- package/dist/particlesAtlases.json +672 -682
- package/dist/worldBlockProvider.d.ts +1 -1
- package/dist/worldBlockProvider.js +41 -6
- package/package.json +2 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { QueriedBlock } from './assetsParser';
|
|
2
2
|
import { BlockModel } from './types';
|
|
3
3
|
export default function worldBlockProvider(blockstatesModels: any, blocksAtlas: any, version: string): {
|
|
4
|
-
getAllResolvedModels0_1(block: Omit<QueriedBlock, "stateId">, fallbackVariant?: boolean): ({
|
|
4
|
+
getAllResolvedModels0_1(block: Omit<QueriedBlock, "stateId">, fallbackVariant?: boolean, possibleIssues?: string[], matchedModels?: string[], matchedConditions?: string[]): ({
|
|
5
5
|
elements: {
|
|
6
6
|
faces: {
|
|
7
7
|
[k: string]: {
|
|
@@ -57,15 +57,50 @@ export default function worldBlockProvider(blockstatesModels, blocksAtlas, versi
|
|
|
57
57
|
};
|
|
58
58
|
};
|
|
59
59
|
return {
|
|
60
|
-
getAllResolvedModels0_1(block, fallbackVariant = false) {
|
|
60
|
+
getAllResolvedModels0_1(block, fallbackVariant = false, possibleIssues = [], matchedModels = [], matchedConditions = []) {
|
|
61
|
+
assetsParser.issues = [];
|
|
62
|
+
assetsParser.matchedModels = [];
|
|
63
|
+
assetsParser.matchedConditions = [];
|
|
61
64
|
const modelsParts = assetsParser.getAllResolvedModels(block, fallbackVariant) ?? [];
|
|
65
|
+
possibleIssues.push(...assetsParser.issues);
|
|
66
|
+
matchedModels.push(...assetsParser.matchedModels);
|
|
67
|
+
matchedConditions.push(...assetsParser.matchedConditions);
|
|
68
|
+
if (!modelsParts.length) {
|
|
69
|
+
possibleIssues.push(`No models found for block ${block.name}`);
|
|
70
|
+
return [];
|
|
71
|
+
}
|
|
62
72
|
const interestedFaces = ['north', 'east', 'south', 'west', 'up', 'down'];
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return
|
|
66
|
-
|
|
67
|
-
|
|
73
|
+
try {
|
|
74
|
+
const result = modelsParts.map(modelVariants => {
|
|
75
|
+
return modelVariants.map(model => {
|
|
76
|
+
try {
|
|
77
|
+
return transformModel(model, block);
|
|
78
|
+
}
|
|
79
|
+
catch (e) {
|
|
80
|
+
possibleIssues.push(`Error transforming model for ${block.name}: ${e.message}`);
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
}).filter(a => a?.elements?.length);
|
|
84
|
+
}).filter(a => a.length);
|
|
85
|
+
if (!result.length) {
|
|
86
|
+
possibleIssues.push(`No valid models after transformation for block ${block.name}`);
|
|
87
|
+
}
|
|
88
|
+
return result;
|
|
89
|
+
}
|
|
90
|
+
catch (e) {
|
|
91
|
+
possibleIssues.push(`Fatal error processing models for ${block.name}: ${e.message}`);
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
68
94
|
},
|
|
95
|
+
// getResolvedModels0_1(block: Omit<QueriedBlock, 'stateId'>, fallbackVariant = false) {
|
|
96
|
+
// const modelsParts = assetsParser.getAllResolvedModels(block, fallbackVariant) ?? []
|
|
97
|
+
// const interestedFaces = ['north', 'east', 'south', 'west', 'up', 'down']
|
|
98
|
+
// return modelsParts.map(modelVariants => {
|
|
99
|
+
// return modelVariants.map(model => {
|
|
100
|
+
// return transformModel(model, block);
|
|
101
|
+
// }).filter(a => a.elements?.length)
|
|
102
|
+
// }).filter(a => a.length)
|
|
103
|
+
// },
|
|
69
104
|
transformModel,
|
|
70
105
|
getTextureInfo
|
|
71
106
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mc-assets",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.36",
|
|
4
4
|
"author": "Vitaly Turovsky <vital2580@icloud.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"minecraft block entity"
|
|
54
54
|
],
|
|
55
55
|
"dependencies": {
|
|
56
|
+
"apl-image-packer": "^1.1.0",
|
|
56
57
|
"zod": "^3.24.1"
|
|
57
58
|
},
|
|
58
59
|
"repository": "https://github.com/zardoy/mc-assets",
|