diff --git a/MCHashtoName.js b/MCHashtoName.js new file mode 100644 index 00000000..28c320af --- /dev/null +++ b/MCHashtoName.js @@ -0,0 +1,43 @@ +const fs = require("fs") +const { join, dirname } = require("path") + +process.stdin.setEncoding("utf8"); + +function readlineSync(msg = "Input:") { + return new Promise((resolve, reject) => { + console.log(msg) + process.stdin.resume(); + process.stdin.on("data", function (data) { + process.stdin.pause(); + resolve(data.substring(0, data.length - 2)); + }); + }); +} + +// entry point +async function main() { + let jsonpath = await readlineSync("Input the JSON Path:"); + let srcpath = await readlineSync("Input the src Path:"); + let distpath = await readlineSync("Input the dist Path:"); + + let json = JSON.parse(fs.readFileSync(jsonpath, "utf8")); + let objects = json.objects; + + Object.keys(objects).forEach(element => { + let hash = objects[element].hash; + let srcfilepath = join(srcpath, hash.substring(0, 2), hash); + let distfilepath = join(distpath, element); + + if (!fs.existsSync(distfilepath)) { + fs.mkdirSync(dirname(distfilepath), { recursive: true }); + } + + if (fs.existsSync(srcfilepath)) { + fs.copyFileSync(srcfilepath, distfilepath); + } else { + console.log(`文件不存在:${srcfilepath}`) + } + }); +} + +main(); \ No newline at end of file diff --git a/MiniWorldRes/assets/minecraft/textures/block/redstone_dust_dot.png b/MiniWorldRes/assets/minecraft/textures/block/redstone_dust_dot.png index b79f9e16..6e23553a 100644 Binary files a/MiniWorldRes/assets/minecraft/textures/block/redstone_dust_dot.png and b/MiniWorldRes/assets/minecraft/textures/block/redstone_dust_dot.png differ