Last active
February 2, 2022 23:22
-
-
Save misode/3a6a8c4782e5459b8815cd3268a94e41 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROPS = { | |
"instrument": [ | |
"harp", | |
"basedrum", | |
"snare", | |
"hat", | |
"bass", | |
"flute", | |
"bell", | |
"guitar", | |
"chime", | |
"xylophone", | |
"iron_xylophone", | |
"cow_bell", | |
"didgeridoo", | |
"bit", | |
"banjo", | |
"pling" | |
], | |
"note": [ | |
"0", | |
"1", | |
"2", | |
"3", | |
"4", | |
"5", | |
"6", | |
"7", | |
"8", | |
"9", | |
"10", | |
"11", | |
"12", | |
"13", | |
"14", | |
"15", | |
"16", | |
"17", | |
"18", | |
"19", | |
"20", | |
"21", | |
"22", | |
"23", | |
"24" | |
], | |
"powered": [ | |
"true", | |
"false" | |
] | |
} | |
BLOCK = 'note_block' | |
from itertools import product | |
import json | |
keys = tuple(PROPS.keys()) | |
variants = {} | |
for values in product(*PROPS.values()): | |
variant = ','.join([f'{keys[i]}={v}' for i, v in enumerate(values)]) | |
variants[variant] = { 'model': f'minecraft:block/{BLOCK}' } | |
with open(f'{BLOCK}.json', 'w') as f: | |
json.dump({ "variants": variants }, f, indent=2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment