mirror of
https://github.com/TeamMidnightDust/BetterLeavesLite.git
synced 2025-12-14 19:55:08 +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.
|
# Certain mods contain leaf carpets.
|
||||||
# Because we change the leaf texture, we need to fix the carpet models.
|
# Because we change the leaf texture, we need to fix the carpet models.
|
||||||
if (leaf.getId()) in leaves_with_carpet:
|
if (leaf.getId()) in leaves_with_carpet:
|
||||||
carpet = CarpetBlock(leaves_with_carpet[leaf.getId()], leaf)
|
carpet_ids = leaves_with_carpet[leaf.getId()]
|
||||||
generateCarpetAssets(carpet)
|
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
|
||||||
printOverride(f"Generating leaf carpet: {carpet.carpet_id}")
|
for carpet_id in carpet_ids:
|
||||||
|
carpet = CarpetBlock(carpet_id, leaf)
|
||||||
|
generateCarpetAssets(carpet)
|
||||||
|
printOverride(f"Generating leaf carpet: {carpet.carpet_id}")
|
||||||
|
|
||||||
filecount += 1
|
filecount += 1
|
||||||
# End of autoGen
|
# End of autoGen
|
||||||
@@ -332,6 +335,8 @@ def generateItemModel(leaf):
|
|||||||
def generateCarpetAssets(carpet):
|
def generateCarpetAssets(carpet):
|
||||||
mod_namespace = carpet.carpet_id.split(":")[0]
|
mod_namespace = carpet.carpet_id.split(":")[0]
|
||||||
block_name = carpet.carpet_id.split(":")[1]
|
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
|
# Create structure for blockstate file
|
||||||
block_state_file = f"assets/{mod_namespace}/blockstates/{block_name}.json"
|
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:
|
with open(block_state_file, "w") as f:
|
||||||
json.dump(block_state_data, f, indent=4)
|
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
|
# Create structure for block model file
|
||||||
block_model_file = f"assets/{mod_namespace}/models/block/{block_name}.json"
|
block_model_file = f"assets/{mod_namespace}/models/block/{block_name}.json"
|
||||||
block_model_data = {
|
block_model_data = {
|
||||||
|
|||||||
Reference in New Issue
Block a user