MCPcopy Create free account
hub / github.com/deathcap/ProgrammerArt / processTextures

Function processTextures

scripts/generate.js:79–116  ·  view source on GitHub ↗
(thisRoot, category, tpPrefix, rpPrefix)

Source from the content-addressed store, hash-verified

77};
78
79function processTextures(thisRoot, category, tpPrefix, rpPrefix) {
80 var files = fs.readdirSync(thisRoot);
81
82 console.log("files = " + files);
83
84 for (var i = 0; i < files.length; ++i) {
85 var file = files[i];
86 var buffer = fs.readFileSync(thisRoot + '/' + file);
87
88 var nameRP = file.replace('.png', '');
89 var nameTP = image2tp[category][nameRP];
90
91 if (nameTP !== undefined) {
92 // part of texture pack
93 var pathTP = tpPrefix + nameTP + '.png';
94
95 zipTP.file(pathTP, new Uint8Array(buffer), fileOpts);
96 }
97
98 if (rpAdded[category][nameRP] !== undefined) {
99 // part of resource pack
100 rpAdded[category][nameRP] = true;
101 var pathRP = rpPrefix + nameRP + '.png';
102 zipRP.file(pathRP, new Uint8Array(buffer), fileOpts);
103 } else if (modpackAs[category][nameRP] !== undefined) {
104 // part of resource pack for an addon modification; add for each
105 var modRenames = modpackAs[category][nameRP];
106 for (var j = 0; j < modRenames.length; j += 1) {
107 var modRename = modRenames[j];
108 var pathRP = 'assets/' + modRename + '.png';
109
110 zipRP.file(pathRP, new Uint8Array(buffer), fileOpts);
111 }
112 } else {
113 console.log("Unknown file: " + file);
114 }
115 }
116}
117
118var stitchMatrices = require('./stitchpack_data.js');
119var stitch = require('./stitcher.js');

Callers 1

generate.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected