#!/usr/bin/env python3 """Generate placeholder 16x16 textures for SCICRAFT protocol items/blocks.""" import os from PIL import Image, ImageDraw OUT = "/home/mithral/Documents/SciCraft/server_pack/kubejs/assets/scicraft/textures" def base(name, base_color, accent_color, kind, size=16): img = Image.new("RGBA", (size, size), (0, 0, 0, 0)) d = ImageDraw.Draw(img) if kind == "item": d.rectangle([3, 2, 12, 13], fill=base_color, outline=accent_color) d.line([3, 2, 12, 13], fill=accent_color) d.line([12, 2, 3, 13], fill=accent_color) elif kind == "block": d.rectangle([1, 1, 14, 14], fill=base_color, outline=accent_color) d.rectangle([4, 4, 11, 11], fill=accent_color, outline=accent_color) img.save(os.path.join(OUT, kind, name + ".png")) def glow(name, base_color, accent_color, kind, size=16): """Item with an outer glow ring.""" img = Image.new("RGBA", (size, size), (0, 0, 0, 0)) d = ImageDraw.Draw(img) for r, col in [(6, (255, 255, 255, 40)), (5, (255, 255, 255, 80)), (4, (255, 255, 255, 130))]: d.ellipse([8 - r, 8 - r, 8 + r, 8 + r], outline=col) d.ellipse([4, 4, 12, 12], fill=base_color, outline=accent_color) img.save(os.path.join(OUT, kind, name + ".png")) glow("photon_core", (0, 180, 220, 255), (180, 255, 255, 255), "item") glow("photon_fragment", (120, 60, 200, 255), (230, 180, 255, 255), "item") base("void_stabilizer", (40, 40, 80, 255), (150, 150, 255, 255), "item") base("quantum_lattice", (30, 30, 60, 255), (0, 200, 220, 255), "block") base("renegade_glass", (0, 59, 111, 220), (120, 180, 255, 255), "block") print("textures generated")