Filename is now dependent on the texture

This commit is contained in:
Casey 2024-05-22 13:12:20 +03:00
parent c3f9581b52
commit 422c319f1f
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
2 changed files with 24 additions and 10 deletions

2
.gitignore vendored
View File

@ -3,4 +3,4 @@ __pycache__/
venv/ venv/
input/ input/
output/ output/
pack.zip *.zip

26
make.py
View File

@ -194,26 +194,40 @@ async def main(seam_texture: str = "block.dark_oak_planks"):
fp.write(f"matchBlocks=seasonsextras:{texture_name}\n") fp.write(f"matchBlocks=seasonsextras:{texture_name}\n")
fp.write(f"tiles=0-46\n") fp.write(f"tiles=0-46\n")
fp.write(f"connect=block\n") fp.write(f"connect=block\n")
fp.write(f"resourceCondition=seasonsextras:textures/block/{texture_name}.png\n") fp.write(
f"resourceCondition=seasonsextras:textures/block/{texture_name}.png\n"
)
with Image.open(GLASS_CACHE_SEAMLESS / f"{color}.png") as glass: with Image.open(GLASS_CACHE_SEAMLESS / f"{color}.png") as glass:
for i in range(47): for i in range(47):
ctm = Image.composite(border_texture, glass, ctm_list[i]) ctm = Image.composite(border_texture, glass, ctm_list[i])
ctm.save(out_path / f"{i}.png") ctm.save(out_path / f"{i}.png")
if i == 0: if i == 0:
ctm.save(OUTPUT_PATH / "assets/seasonsextras/textures/block/{texture_name}.png") ctm.save(
OUTPUT_PATH
/ "assets/seasonsextras/textures/block/{texture_name}.png"
)
with (OUTPUT_PATH / "pack.mcmeta").open("w") as fp: with (OUTPUT_PATH / "pack.mcmeta").open("w") as fp:
json.dump({ json.dump(
{
"pack": { "pack": {
"pack_format": 15, "pack_format": 15,
"description": f"CTM support for Fabric Seasons Extras. {seam_texture}" "description": f"CTM support for Fabric Seasons Extras. {seam_texture}",
} }
}, fp, indent=2, ensure_ascii=False) },
fp,
indent=2,
ensure_ascii=False,
)
with ZipFile("pack.zip", "w") as zipf: with ZipFile(
f"seasons-ctm-{seam_texture.split('.', 1)[-1]}.zip", "w"
) as zipf:
zipf.write(GLASS_OUTPUT_PATH / "purple" / "0.png", "pack.png") zipf.write(GLASS_OUTPUT_PATH / "purple" / "0.png", "pack.png")
for file in OUTPUT_PATH.rglob("*"): for file in OUTPUT_PATH.rglob("*"):
zipf.write(file, Path(*file.parts[1:])) zipf.write(file, Path(*file.parts[1:]))
if __name__ == "__main__": if __name__ == "__main__":
from sys import argv from sys import argv
asyncio.run(main(*argv[1:])) asyncio.run(main(*argv[1:]))