2018-07-22 16:54:00 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import json
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
|
|
if len(sys.argv) != 3:
|
|
|
|
sys.exit('Usage: extract.py <colors.json> <BlockType.inc>')
|
|
|
|
|
|
|
|
with open(sys.argv[1]) as f:
|
|
|
|
colors = json.load(f)
|
|
|
|
|
|
|
|
output = {}
|
|
|
|
|
|
|
|
with open(sys.argv[2], 'w') as f:
|
|
|
|
for name, info in colors.items():
|
2018-11-07 22:50:42 +01:00
|
|
|
print('{"%s", {%s, %s, %s, %s, {%u, %u, %u}}},' % (
|
2018-07-22 16:54:00 +02:00
|
|
|
name,
|
|
|
|
['false', 'true'][info['opaque']],
|
2018-11-07 22:50:42 +01:00
|
|
|
['false', 'true'][info['grass']],
|
|
|
|
['false', 'true'][info['foliage']],
|
2018-07-22 16:54:00 +02:00
|
|
|
['false', 'true'][info['blue']],
|
|
|
|
info['color']['r'],
|
|
|
|
info['color']['g'],
|
|
|
|
info['color']['b'],
|
2018-11-07 22:50:42 +01:00
|
|
|
), file=f)
|