mirror of
https://github.com/TeamMidnightDust/BetterLeavesLite.git
synced 2025-12-14 11:45:09 +01:00
feat: allow multiple carpets per leaf block
This commit is contained in:
14
gen_pack.py
14
gen_pack.py
@@ -141,9 +141,12 @@ def autoGen(jsonData, args):
|
||||
# Certain mods contain leaf carpets.
|
||||
# Because we change the leaf texture, we need to fix the carpet models.
|
||||
if (leaf.getId()) in leaves_with_carpet:
|
||||
carpet = CarpetBlock(leaves_with_carpet[leaf.getId()], leaf)
|
||||
generateCarpetAssets(carpet)
|
||||
printOverride(f"Generating leaf carpet: {carpet.carpet_id}")
|
||||
carpet_ids = leaves_with_carpet[leaf.getId()]
|
||||
if not isinstance(carpet_ids, list): carpet_ids = [carpet_ids] # In case only one carpet is provided (as a string), turn it into a list
|
||||
for carpet_id in carpet_ids:
|
||||
carpet = CarpetBlock(carpet_id, leaf)
|
||||
generateCarpetAssets(carpet)
|
||||
printOverride(f"Generating leaf carpet: {carpet.carpet_id}")
|
||||
|
||||
filecount += 1
|
||||
# End of autoGen
|
||||
@@ -332,6 +335,8 @@ def generateItemModel(leaf):
|
||||
def generateCarpetAssets(carpet):
|
||||
mod_namespace = carpet.carpet_id.split(":")[0]
|
||||
block_name = carpet.carpet_id.split(":")[1]
|
||||
# Create blockstate folder if it doesn't exist already
|
||||
os.makedirs("assets/{}/blockstates/".format(mod_namespace), exist_ok=True)
|
||||
|
||||
# Create structure for blockstate file
|
||||
block_state_file = f"assets/{mod_namespace}/blockstates/{block_name}.json"
|
||||
@@ -347,6 +352,9 @@ def generateCarpetAssets(carpet):
|
||||
with open(block_state_file, "w") as f:
|
||||
json.dump(block_state_data, f, indent=4)
|
||||
|
||||
# Create models folder if it doesn't exist already
|
||||
os.makedirs("assets/{}/models/block/".format(mod_namespace), exist_ok=True)
|
||||
|
||||
# Create structure for block model file
|
||||
block_model_file = f"assets/{mod_namespace}/models/block/{block_name}.json"
|
||||
block_model_data = {
|
||||
|
||||
Reference in New Issue
Block a user