mirror of
https://github.com/chylex/Hardcore-Ender-Expansion-2.git
synced 2025-03-15 09:15:42 +01:00
49 lines
991 B
Python
49 lines
991 B
Python
import os.path
|
|
|
|
# Setup
|
|
|
|
registry_name = input("Block registry name: ")
|
|
|
|
if not registry_name:
|
|
raise SystemExit
|
|
|
|
root_path = "../src/main/resources/assets/hee"
|
|
|
|
if not os.path.isfile(root_path + f"/textures/block/{registry_name}.png"):
|
|
print("Missing texture file")
|
|
raise SystemExit
|
|
|
|
# Helpers
|
|
|
|
def create_file(relative_path, contents, title):
|
|
formatted_path = relative_path.format(registry_name)
|
|
|
|
try:
|
|
with open(root_path + formatted_path, "x") as file:
|
|
file.write(contents)
|
|
|
|
print("Generated " + formatted_path)
|
|
except FileExistsError:
|
|
print("Skipping " + formatted_path)
|
|
|
|
# Contents
|
|
|
|
contents_blockstate = f"""{{
|
|
"forge_marker": 1,
|
|
"defaults": {{
|
|
"model": "cube_all",
|
|
"textures": {{
|
|
"all": "hee:block/{registry_name}"
|
|
}}
|
|
}},
|
|
"variants": {{
|
|
"normal": [{{}}],
|
|
"inventory": [{{}}]
|
|
}}
|
|
}}
|
|
"""
|
|
|
|
# Files
|
|
|
|
create_file("/blockstates/{}.json", contents_blockstate, "forge block state")
|