19 lines
1.2 KiB
Python
19 lines
1.2 KiB
Python
"""Tile original 48px artwork across the six faces of a 3x3x3 furnace.
|
|
No image resampling: JSON UVs select thirds of the supplied source PNGs.
|
|
"""
|
|
import json
|
|
from pathlib import Path
|
|
root = Path(__file__).resolve().parents[1] / 'mods/sanctuary/src/main/resources/assets/sanctuary/models/block/fourneau'
|
|
root.mkdir(parents=True, exist_ok=True)
|
|
for facing in ('north', 'east', 'south', 'west'):
|
|
for y in range(3):
|
|
for z in range(3):
|
|
for x in range(3):
|
|
faces = {}
|
|
for direction, u, v in [('north',2-x,2-y),('south',x,2-y),('east',2-z,2-y),('west',z,2-y),('up',x,z),('down',x,2-z)]:
|
|
texture = 'top' if direction in ('up','down') else 'front' if direction == facing else 'side'
|
|
faces[direction] = {'texture':'#'+texture, 'cullface':direction, 'uv':[u*16/3,v*16/3,(u+1)*16/3,(v+1)*16/3]}
|
|
model = {'textures':{n:'sanctuary:block/fourneau/'+n for n in ('front','side','top')} | {'particle':'sanctuary:block/fourneau/side'},
|
|
'elements':[{'from':[0,0,0],'to':[16,16,16],'faces':faces}]}
|
|
(root / f'{facing}_{x}_{y}_{z}.json').write_text(json.dumps(model,indent=2)+'\n')
|