-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconvertcolors.js
More file actions
33 lines (29 loc) · 784 Bytes
/
convertcolors.js
File metadata and controls
33 lines (29 loc) · 784 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Read the file and print its contents.
var fs = require('fs');
var mcData = require('minecraft-data')("1.12");
fs.readFile("./web/js/map-colors.csv", 'utf8', function(err, data) {
if (err) throw err;
console.log(data);
var lines = data.split("\n");
for(var i in lines){
var line = lines[i];
var elements = line.split(",");
for(var j in elements){
var el = elements[j].trim();
//console.log(el);
var found = false;
for(var b in mcData.blocks){
var block = mcData.blocks[b];
if(block.displayName == el){
process.stdout.write(block.id + ", ")
found=true;
break;
}
}
if(!found){
process.stdout.write(el + ", ")
}
}
process.stdout.write("\n")
}
});