mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-03-04 17:23:33 +01:00
42 lines
812 B
Python
Executable file
42 lines
812 B
Python
Executable file
#!/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():
|
|
flags = []
|
|
if info['opaque']:
|
|
flags.append('BLOCK_OPAQUE')
|
|
if info['grass']:
|
|
flags.append('BLOCK_GRASS')
|
|
if info['foliage']:
|
|
flags.append('BLOCK_FOLIAGE')
|
|
if info['birch']:
|
|
flags.append('BLOCK_BIRCH')
|
|
if info['spruce']:
|
|
flags.append('BLOCK_SPRUCE')
|
|
if info['water']:
|
|
flags.append('BLOCK_WATER')
|
|
if flags:
|
|
flags = '|'.join(flags)
|
|
else:
|
|
flags = '0'
|
|
|
|
print('{"%s", {%s, {%u, %u, %u}}},' % (
|
|
name,
|
|
flags,
|
|
info['color']['r'],
|
|
info['color']['g'],
|
|
info['color']['b'],
|
|
), file=f)
|