diff --git a/Better-Leaves-Lite-vanilla+0.1.zip b/Better-Leaves-Lite-vanilla+0.1.zip new file mode 100644 index 0000000..5983798 Binary files /dev/null and b/Better-Leaves-Lite-vanilla+0.1.zip differ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..bb06002 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Motschen + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 3e81a69..deb6a7c 100644 --- a/README.md +++ b/README.md @@ -1 +1,31 @@ -# BetterLeavesLite \ No newline at end of file +# Motschen's Better Leaves: Lite +A more optimized version of my Better Leaves pack aiming to be the best-performing of all, while still looking spectacular. + +### In which ways is this more optimized than the regular version? +Glad you asked. +First of all, the leaf models use way less elements in comparison, as the round textures are generated in advance instead of being faked as round during rendering. + +### Does it also outperform packs made by other authors? +Yes, probably. +Most other packs use two seperate textures: one for the regular part of the leaves and one for the bushy part. +This is generally not a problem, since Minecraft bakes textures into an atlas (a big texture containing all the smaller block textures), to avoid constant texture rebinds. +However, using two textures in a model can still cause some overhead, as the game has to locate the coordinates of both on the atlas. +Additionally, the atlas size might have to be increased to fit two textures per leaf block – also resulting in performance loss. + +This pack mitigates this by just replacing the regular leaf texture with one round version, which contains the default texture in the middle. + +### Are there any downsides? +As with everything good, there are a couple caviats, but don't worry, as I've designed the pack with them in mind. + +The first is the fact that – compared to the regular pack – there is no compatibility with texturepacks that feature custom leaf textures. +You can however easily build your own version of the pack with custom textures by using the script included in this repo (see more below). +This should also work with higher-res textures, though your mileage may wary. + +The second downside is that mod-support always has to be explicitly added, while the regular version has basic support for all mods using the vanilla leaf model as a base. +Though I aim to solve this over time by just adding that explicit support, also resulting in better quality than the basic support would bring. + +## Building versions for your texturepack (or mod) +To build your own version, simply download this repository and replace the textures in the input/assets folder with those of your texturepack. +Then, make sure you've installed Python (available for every OS). +After that, simply open a terminal in the main directory and run `python3 gen-pack.py ` +Tada! You should now have a zip file ready for use. Have fun :) \ No newline at end of file diff --git a/assets/minecraft/models/block/leaves.json b/assets/minecraft/models/block/leaves.json new file mode 100644 index 0000000..398fa3b --- /dev/null +++ b/assets/minecraft/models/block/leaves.json @@ -0,0 +1,40 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "texture_size": [32, 32], + "textures": { + "particle": "#all" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 16, 16], + "faces": { + "north": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "north", "tintindex": 0}, + "east": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "east", "tintindex": 0}, + "south": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "south", "tintindex": 0}, + "west": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "west", "tintindex": 0}, + "up": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "up", "tintindex": 0}, + "down": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "down", "tintindex": 0} + } + }, + { + "from": [-5.5, -6, 14], + "to": [26.5, 22, 14], + "rotation": {"angle": 45, "axis": "y", "origin": [2, 0, 14]}, + "faces": { + "north": {"uv": [0, 1, 16, 15], "texture": "#all", "tintindex": 0}, + "south": {"uv": [0, 1, 16, 15], "texture": "#all", "tintindex": 0} + } + }, + { + "from": [-5.5, -6, 2], + "to": [26.5, 22, 2], + "rotation": {"angle": -45, "axis": "y", "origin": [2, 0, 2]}, + "faces": { + "north": {"uv": [0, 1, 16, 15], "texture": "#all", "tintindex": 0}, + "south": {"uv": [0, 1, 16, 15], "texture": "#all", "tintindex": 0} + } + } + ] +} \ No newline at end of file diff --git a/assets/minecraft/models/block/leaves1.json b/assets/minecraft/models/block/leaves1.json new file mode 100644 index 0000000..67163c5 --- /dev/null +++ b/assets/minecraft/models/block/leaves1.json @@ -0,0 +1,40 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "texture_size": [32, 32], + "textures": { + "particle": "#all" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 16, 16], + "faces": { + "north": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "north", "tintindex": 0}, + "east": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "east", "tintindex": 0}, + "south": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "south", "tintindex": 0}, + "west": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "west", "tintindex": 0}, + "up": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "up", "tintindex": 0}, + "down": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "down", "tintindex": 0} + } + }, + { + "from": [-7.98959, -6, 7.98959], + "to": [24.01041, 22, 7.98959], + "rotation": {"angle": 22.5, "axis": "y", "origin": [8.01041, 8, 7.98959]}, + "faces": { + "north": {"uv": [0, 1, 16, 15], "texture": "#all", "tintindex": 0}, + "south": {"uv": [0, 1, 16, 15], "texture": "#all", "tintindex": 0} + } + }, + { + "from": [-6.5, -6, 3], + "to": [25.5, 22, 3], + "rotation": {"angle": -45, "axis": "y", "origin": [1, 0, 3]}, + "faces": { + "north": {"uv": [0, 1, 16, 15], "texture": "#all", "tintindex": 0}, + "south": {"uv": [0, 1, 16, 15], "texture": "#all", "tintindex": 0} + } + } + ] +} \ No newline at end of file diff --git a/assets/minecraft/models/block/leaves2.json b/assets/minecraft/models/block/leaves2.json new file mode 100644 index 0000000..3b827d7 --- /dev/null +++ b/assets/minecraft/models/block/leaves2.json @@ -0,0 +1,40 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "texture_size": [32, 32], + "textures": { + "particle": "#all" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 16, 16], + "faces": { + "north": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "north", "tintindex": 0}, + "east": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "east", "tintindex": 0}, + "south": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "south", "tintindex": 0}, + "west": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "west", "tintindex": 0}, + "up": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "up", "tintindex": 0}, + "down": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "down", "tintindex": 0} + } + }, + { + "from": [-5.5, -6, 15], + "to": [26.5, 22, 15], + "rotation": {"angle": 45, "axis": "y", "origin": [2, 0, 15]}, + "faces": { + "north": {"uv": [0, 1, 16, 15], "texture": "#all", "tintindex": 0}, + "south": {"uv": [0, 1, 16, 15], "texture": "#all", "tintindex": 0} + } + }, + { + "from": [-7.98959, -6, 8.01041], + "to": [24.01041, 22, 8.01041], + "rotation": {"angle": -22.5, "axis": "y", "origin": [8.01041, 8, 8.01041]}, + "faces": { + "north": {"uv": [0, 1, 16, 15], "texture": "#all", "tintindex": 0}, + "south": {"uv": [0, 1, 16, 15], "texture": "#all", "tintindex": 0} + } + } + ] +} \ No newline at end of file diff --git a/assets/minecraft/models/block/leaves3.json b/assets/minecraft/models/block/leaves3.json new file mode 100644 index 0000000..ab56c4f --- /dev/null +++ b/assets/minecraft/models/block/leaves3.json @@ -0,0 +1,40 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "texture_size": [32, 32], + "textures": { + "particle": "#all" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 16, 16], + "faces": { + "north": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "north", "tintindex": 0}, + "east": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "east", "tintindex": 0}, + "south": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "south", "tintindex": 0}, + "west": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "west", "tintindex": 0}, + "up": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "up", "tintindex": 0}, + "down": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "down", "tintindex": 0} + } + }, + { + "from": [-6.98223, -6, 8.99264], + "to": [25.01777, 22, 8.99264], + "rotation": {"angle": 22.5, "axis": "y", "origin": [9.01041, 8, 9]}, + "faces": { + "north": {"uv": [0, 1, 16, 15], "texture": "#all", "tintindex": 0}, + "south": {"uv": [0, 1, 16, 15], "texture": "#all", "tintindex": 0} + } + }, + { + "from": [9.00305, -6, -6.99264], + "to": [9.00305, 22, 25.00736], + "rotation": {"angle": 22.5, "axis": "y", "origin": [9.01041, 8, 9]}, + "faces": { + "east": {"uv": [0, 1, 16, 15], "texture": "#all", "tintindex": 0}, + "west": {"uv": [0, 1, 16, 15], "texture": "#all", "tintindex": 0} + } + } + ] +} \ No newline at end of file diff --git a/assets/minecraft/models/block/leaves4.json b/assets/minecraft/models/block/leaves4.json new file mode 100644 index 0000000..b65cb64 --- /dev/null +++ b/assets/minecraft/models/block/leaves4.json @@ -0,0 +1,40 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "texture_size": [32, 32], + "textures": { + "particle": "#all" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 16, 16], + "faces": { + "north": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "north", "tintindex": 0}, + "east": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "east", "tintindex": 0}, + "south": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "south", "tintindex": 0}, + "west": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "west", "tintindex": 0}, + "up": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "up", "tintindex": 0}, + "down": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "down", "tintindex": 0} + } + }, + { + "from": [8.00305, -6, -8.00736], + "to": [8.00305, 22, 23.99264], + "rotation": {"angle": -22.5, "axis": "y", "origin": [8.01041, 8, 8]}, + "faces": { + "east": {"uv": [0, 1, 16, 15], "texture": "#all", "tintindex": 0}, + "west": {"uv": [0, 1, 16, 15], "texture": "#all", "tintindex": 0} + } + }, + { + "from": [-7.98223, -6, 8.00736], + "to": [24.01777, 22, 8.00736], + "rotation": {"angle": -22.5, "axis": "y", "origin": [8.01041, 8, 8]}, + "faces": { + "north": {"uv": [0, 1, 16, 15], "texture": "#all", "tintindex": 0}, + "south": {"uv": [0, 1, 16, 15], "texture": "#all", "tintindex": 0} + } + } + ] +} \ No newline at end of file diff --git a/assets/minecraft/models/block/leaves_notint1.json b/assets/minecraft/models/block/leaves_notint1.json new file mode 100644 index 0000000..7ee7e85 --- /dev/null +++ b/assets/minecraft/models/block/leaves_notint1.json @@ -0,0 +1,40 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "texture_size": [32, 32], + "textures": { + "particle": "#all" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 16, 16], + "faces": { + "north": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "north"}, + "east": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "east"}, + "south": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "south"}, + "west": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "west"}, + "up": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "up"}, + "down": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "down"} + } + }, + { + "from": [-7.98959, -6, 7.98959], + "to": [24.01041, 22, 7.98959], + "rotation": {"angle": 22.5, "axis": "y", "origin": [8.01041, 8, 7.98959]}, + "faces": { + "north": {"uv": [0, 1, 16, 15], "texture": "#all"}, + "south": {"uv": [0, 1, 16, 15], "texture": "#all"} + } + }, + { + "from": [-6.5, -6, 3], + "to": [25.5, 22, 3], + "rotation": {"angle": -45, "axis": "y", "origin": [1, 0, 3]}, + "faces": { + "north": {"uv": [0, 1, 16, 15], "texture": "#all"}, + "south": {"uv": [0, 1, 16, 15], "texture": "#all"} + } + } + ] +} \ No newline at end of file diff --git a/assets/minecraft/models/block/leaves_notint2.json b/assets/minecraft/models/block/leaves_notint2.json new file mode 100644 index 0000000..981e72f --- /dev/null +++ b/assets/minecraft/models/block/leaves_notint2.json @@ -0,0 +1,40 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "texture_size": [32, 32], + "textures": { + "particle": "#all" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 16, 16], + "faces": { + "north": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "north"}, + "east": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "east"}, + "south": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "south"}, + "west": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "west"}, + "up": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "up"}, + "down": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "down"} + } + }, + { + "from": [-5.5, -6, 15], + "to": [26.5, 22, 15], + "rotation": {"angle": 45, "axis": "y", "origin": [2, 0, 15]}, + "faces": { + "north": {"uv": [0, 1, 16, 15], "texture": "#all"}, + "south": {"uv": [0, 1, 16, 15], "texture": "#all"} + } + }, + { + "from": [-7.98959, -6, 8.01041], + "to": [24.01041, 22, 8.01041], + "rotation": {"angle": -22.5, "axis": "y", "origin": [8.01041, 8, 8.01041]}, + "faces": { + "north": {"uv": [0, 1, 16, 15], "texture": "#all"}, + "south": {"uv": [0, 1, 16, 15], "texture": "#all"} + } + } + ] +} \ No newline at end of file diff --git a/assets/minecraft/models/block/leaves_notint3.json b/assets/minecraft/models/block/leaves_notint3.json new file mode 100644 index 0000000..112500f --- /dev/null +++ b/assets/minecraft/models/block/leaves_notint3.json @@ -0,0 +1,40 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "texture_size": [32, 32], + "textures": { + "particle": "#all" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 16, 16], + "faces": { + "north": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "north"}, + "east": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "east"}, + "south": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "south"}, + "west": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "west"}, + "up": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "up"}, + "down": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "down"} + } + }, + { + "from": [-6.98223, -6, 8.99264], + "to": [25.01777, 22, 8.99264], + "rotation": {"angle": 22.5, "axis": "y", "origin": [9.01041, 8, 9]}, + "faces": { + "north": {"uv": [0, 1, 16, 15], "texture": "#all"}, + "south": {"uv": [0, 1, 16, 15], "texture": "#all"} + } + }, + { + "from": [9.00305, -6, -6.99264], + "to": [9.00305, 22, 25.00736], + "rotation": {"angle": 22.5, "axis": "y", "origin": [9.01041, 8, 9]}, + "faces": { + "east": {"uv": [0, 1, 16, 15], "texture": "#all"}, + "west": {"uv": [0, 1, 16, 15], "texture": "#all"} + } + } + ] +} \ No newline at end of file diff --git a/assets/minecraft/models/block/leaves_notint4.json b/assets/minecraft/models/block/leaves_notint4.json new file mode 100644 index 0000000..be8d0d5 --- /dev/null +++ b/assets/minecraft/models/block/leaves_notint4.json @@ -0,0 +1,40 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "texture_size": [32, 32], + "textures": { + "particle": "#all" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 16, 16], + "faces": { + "north": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "north"}, + "east": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "east"}, + "south": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "south"}, + "west": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "west"}, + "up": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "up"}, + "down": {"uv": [4, 4, 12, 12], "texture": "#all", "cullface": "down"} + } + }, + { + "from": [8.00305, -6, -8.00736], + "to": [8.00305, 22, 23.99264], + "rotation": {"angle": -22.5, "axis": "y", "origin": [8.01041, 8, 8]}, + "faces": { + "east": {"uv": [0, 1, 16, 15], "texture": "#all"}, + "west": {"uv": [0, 1, 16, 15], "texture": "#all"} + } + }, + { + "from": [-7.98223, -6, 8.00736], + "to": [24.01777, 22, 8.00736], + "rotation": {"angle": -22.5, "axis": "y", "origin": [8.01041, 8, 8]}, + "faces": { + "north": {"uv": [0, 1, 16, 15], "texture": "#all"}, + "south": {"uv": [0, 1, 16, 15], "texture": "#all"} + } + } + ] +} \ No newline at end of file diff --git a/gen-pack.py b/gen-pack.py new file mode 100644 index 0000000..232a546 --- /dev/null +++ b/gen-pack.py @@ -0,0 +1,147 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +"""This script can automatically generate blockstate and block model files, as well as textures for the Better Leaves Lite resourcepack.""" + +import argparse +import json +import os +import zipfile +from PIL import Image + +def autoGen(notint_overrides): + print("Generating assets...") + for root, dirs, files in os.walk("./input"): + for infile in files: + if infile.endswith(".png") and (len(root.split("/")) > 3): + namespace = root.split("/")[3] + block_id = infile.replace(".png", "") + print(namespace+":"+block_id) + + # Generate textures + outfolder = root.replace("assets", "").replace("input", "assets") + os.makedirs(outfolder, exist_ok=True) + outfile = os.path.splitext(os.path.join(outfolder, infile))[0] + ".png" + if infile != outfile: + try: + # First, let's open the regular texture + vanilla = Image.open(os.path.join(root, infile)) + width, height = vanilla.size + # Second, let's generate a transparent texture that's twice the size + transparent = Image.new("RGBA", [int(2 * s) for s in vanilla.size], (255, 255, 255, 0)) + out = transparent.copy() + + # Now we paste the regular texture in a 3x3 grid, centered in the middle + for x in range(-1, 2): + for y in range(-1, 2): + out.paste(vanilla, (int(width / 2 + width * x), int(height / 2 + height * y))) + + # As the last step, we apply our custom mask to round the edges and smoothen things out + mask = Image.open('input/mask.png').convert('L').resize(out.size) + out = Image.composite(out, transparent, mask) + + # Finally, we save the texture to the assets folder + out.save(outfile, vanilla.format) + except IOError: + print("Error while generating texture for '%s'" % infile) + + # Generate blockstates & models + + # Check if the block appears in the notint overrides + if (namespace+":"+block_id) in notint_overrides: + generateBlockstateAndModel(namespace, block_id, True) + generateItemModel(namespace, block_id) + print ("-> No tint") + else: + generateBlockstateAndModel(namespace, block_id, False) + +def generateBlockstateAndModel(mod_namespace, block_name, notint): + + # Create structure for blockstate file + block_state_file = f"assets/{mod_namespace}/blockstates/{block_name}.json" + block_state_data = { + "variants": { + "": [] + } + } + # Add four rotations for each of the four individual leaf models + for i in range(1, 5): + block_state_data["variants"][""] += { "model": f"{mod_namespace}:block/{block_name}{i}" }, { "model": f"{mod_namespace}:block/{block_name}{i}", "y": 90 }, { "model": f"{mod_namespace}:block/{block_name}{i}", "y": 180 }, { "model": f"{mod_namespace}:block/{block_name}{i}", "y": 270 }, + + # Create blockstates folder if it doesn't exist already + if not os.path.exists("assets/{}/blockstates/".format(mod_namespace)): + os.makedirs("assets/{}/blockstates/".format(mod_namespace)) + + # Write blockstate file + 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 + if not os.path.exists("assets/{}/models/block/".format(mod_namespace)): + os.makedirs("assets/{}/models/block/".format(mod_namespace)) + + base_model = "leaves" + if (notint): + base_model = "leaves_notint" + # Create the four individual leaf models + for i in range(1, 5): + # Create structure for block model file + block_model_file = f"assets/{mod_namespace}/models/block/{block_name}{i}.json" + block_model_data = { + "parent": f"block/{base_model}{i}", + "textures": { + "all": f"{mod_namespace}:block/{block_name}" + } + } + with open(block_model_file, "w") as f: + json.dump(block_model_data, f, indent=4) + +def generateItemModel(mod_namespace, block_name): + # Create models folder if it doesn't exist already + if not os.path.exists("assets/{}/models/item/".format(mod_namespace)): + os.makedirs("assets/{}/models/item/".format(mod_namespace)) + + item_model_file = f"assets/{mod_namespace}/models/item/{block_name}.json" + item_model_data = { + "parent": f"{mod_namespace}:block/{block_name}1" + } + with open(item_model_file, "w") as f: + json.dump(item_model_data, f, indent=4) + +# See https://stackoverflow.com/a/1855118 +def zipdir(path, ziph): + # ziph is zipfile handle + for root, dirs, files in os.walk(path): + for file in files: + ziph.write(os.path.join(root, file), + os.path.relpath(os.path.join(root, file), + os.path.join(path, '..'))) + + + +# This is the main entry point, executed when the script is run +if __name__ == '__main__': + parser = argparse.ArgumentParser( + description='This script can automatically generate files for the Better Leaves Lite resourcepack.', + epilog='Feel free to ask for help at http://discord.midnightdust.eu/') + + parser.add_argument('version', type=str) + args = parser.parse_args() + + print(args) + print() + + # Loads overrides from the json file + f = open('./input/overrides.json') + data = json.load(f) + f.close() + + autoGen(data['noTint']); + + with zipfile.ZipFile('Better-Leaves-Lite-'+args.version+".zip", 'w', zipfile.ZIP_DEFLATED) as zipf: + zipdir('assets/', zipf) + zipf.write('pack.mcmeta') + zipf.write('pack.png') + zipf.write('LICENSE') + zipf.write('README.md') \ No newline at end of file diff --git a/input/assets/minecraft/textures/block/acacia_leaves.png b/input/assets/minecraft/textures/block/acacia_leaves.png new file mode 100644 index 0000000..81c3702 Binary files /dev/null and b/input/assets/minecraft/textures/block/acacia_leaves.png differ diff --git a/input/assets/minecraft/textures/block/azalea_leaves.png b/input/assets/minecraft/textures/block/azalea_leaves.png new file mode 100644 index 0000000..83c96ec Binary files /dev/null and b/input/assets/minecraft/textures/block/azalea_leaves.png differ diff --git a/input/assets/minecraft/textures/block/birch_leaves.png b/input/assets/minecraft/textures/block/birch_leaves.png new file mode 100644 index 0000000..b29f8c0 Binary files /dev/null and b/input/assets/minecraft/textures/block/birch_leaves.png differ diff --git a/input/assets/minecraft/textures/block/cherry_leaves.png b/input/assets/minecraft/textures/block/cherry_leaves.png new file mode 100644 index 0000000..0d66833 Binary files /dev/null and b/input/assets/minecraft/textures/block/cherry_leaves.png differ diff --git a/input/assets/minecraft/textures/block/dark_oak_leaves.png b/input/assets/minecraft/textures/block/dark_oak_leaves.png new file mode 100644 index 0000000..99ee5c2 Binary files /dev/null and b/input/assets/minecraft/textures/block/dark_oak_leaves.png differ diff --git a/input/assets/minecraft/textures/block/flowering_azalea_leaves.png b/input/assets/minecraft/textures/block/flowering_azalea_leaves.png new file mode 100644 index 0000000..1c6f6ea Binary files /dev/null and b/input/assets/minecraft/textures/block/flowering_azalea_leaves.png differ diff --git a/input/assets/minecraft/textures/block/jungle_leaves.png b/input/assets/minecraft/textures/block/jungle_leaves.png new file mode 100644 index 0000000..f3c513a Binary files /dev/null and b/input/assets/minecraft/textures/block/jungle_leaves.png differ diff --git a/input/assets/minecraft/textures/block/mangrove_leaves.png b/input/assets/minecraft/textures/block/mangrove_leaves.png new file mode 100644 index 0000000..b85bfd3 Binary files /dev/null and b/input/assets/minecraft/textures/block/mangrove_leaves.png differ diff --git a/input/assets/minecraft/textures/block/oak_leaves.png b/input/assets/minecraft/textures/block/oak_leaves.png new file mode 100644 index 0000000..0f1793d Binary files /dev/null and b/input/assets/minecraft/textures/block/oak_leaves.png differ diff --git a/input/assets/minecraft/textures/block/pale_oak_leaves.png b/input/assets/minecraft/textures/block/pale_oak_leaves.png new file mode 100644 index 0000000..9f6fbfa Binary files /dev/null and b/input/assets/minecraft/textures/block/pale_oak_leaves.png differ diff --git a/input/assets/minecraft/textures/block/spruce_leaves.png b/input/assets/minecraft/textures/block/spruce_leaves.png new file mode 100644 index 0000000..a243dac Binary files /dev/null and b/input/assets/minecraft/textures/block/spruce_leaves.png differ diff --git a/input/mask.png b/input/mask.png new file mode 100644 index 0000000..df262a6 Binary files /dev/null and b/input/mask.png differ diff --git a/input/overrides.json b/input/overrides.json new file mode 100644 index 0000000..6dc2d2e --- /dev/null +++ b/input/overrides.json @@ -0,0 +1,6 @@ +{ + "noTint": [ + "minecraft:azalea_leaves", + "minecraft:flowering_azalea_leaves" + ] +} \ No newline at end of file diff --git a/leaves.bbmodel b/leaves.bbmodel new file mode 100644 index 0000000..5de9d39 --- /dev/null +++ b/leaves.bbmodel @@ -0,0 +1 @@ +{"meta":{"format_version":"4.10","model_format":"java_block","box_uv":false},"name":"leaves","parent":"block/block","ambientocclusion":true,"front_gui_light":false,"visible_box":[1,1,0],"variable_placeholders":"","variable_placeholder_buttons":[],"unhandled_root_fields":{},"resolution":{"width":32,"height":32},"elements":[{"name":"cube","box_uv":false,"rescale":false,"locked":false,"light_emission":0,"render_order":"default","allow_mirror_modeling":true,"from":[0,0,0],"to":[16,16,16],"autouv":0,"color":2,"origin":[0,0,0],"faces":{"north":{"uv":[8,8,24,24],"tint":0,"cullface":"north","texture":0},"east":{"uv":[8,8,24,24],"tint":0,"cullface":"east","texture":0},"south":{"uv":[8,8,24,24],"tint":0,"cullface":"south","texture":0},"west":{"uv":[8,8,24,24],"tint":0,"cullface":"west","texture":0},"up":{"uv":[8,8,24,24],"tint":0,"cullface":"up","texture":0},"down":{"uv":[8,8,24,24],"tint":0,"cullface":"down","texture":0}},"type":"cube","uuid":"0677d295-59fc-3179-85fb-172d66f519c0"},{"name":"cube","box_uv":false,"rescale":false,"locked":false,"light_emission":0,"render_order":"default","allow_mirror_modeling":true,"from":[-5.5,-6,14],"to":[26.5,22,14],"autouv":0,"color":4,"rotation":[0,45,0],"origin":[2,0,14],"faces":{"north":{"uv":[0,2,32,30],"tint":0,"texture":0},"east":{"uv":[0,0,0,0],"texture":null},"south":{"uv":[0,2,32,30],"tint":0,"texture":0},"west":{"uv":[0,0,0,0],"texture":null},"up":{"uv":[0,0,0,0],"texture":null},"down":{"uv":[0,0,0,0],"texture":null}},"type":"cube","uuid":"b54ae4f7-8bc2-fc49-57d2-cc620245963f"},{"name":"cube","box_uv":false,"rescale":false,"locked":false,"light_emission":0,"render_order":"default","allow_mirror_modeling":true,"from":[-5.5,-6,2],"to":[26.5,22,2],"autouv":0,"color":4,"rotation":[0,-45,0],"origin":[2,0,2],"faces":{"north":{"uv":[0,2,32,30],"tint":0,"texture":0},"east":{"uv":[0,0,0,0],"texture":null},"south":{"uv":[0,2,32,30],"tint":0,"texture":0},"west":{"uv":[0,0,0,0],"texture":null},"up":{"uv":[0,0,0,0],"texture":null},"down":{"uv":[0,0,0,0],"texture":null}},"type":"cube","uuid":"c1a53dc9-7942-a72f-b289-5ad6c45f762a"}],"outliner":["0677d295-59fc-3179-85fb-172d66f519c0","b54ae4f7-8bc2-fc49-57d2-cc620245963f","c1a53dc9-7942-a72f-b289-5ad6c45f762a"],"textures":[{"path":"","name":"#all","folder":"","namespace":"","id":"all","group":"","width":16,"height":16,"uv_width":32,"uv_height":32,"particle":true,"use_as_default":false,"layers_enabled":false,"sync_to_project":"","render_mode":"default","render_sides":"auto","frame_time":1,"frame_order_type":"loop","frame_order":"","frame_interpolate":false,"visible":true,"internal":true,"saved":true,"uuid":"3d387c5e-c9eb-ff67-154e-060ff81133ae","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAHtJREFUOE/dUzEOwCAI1IUfOPH/nykLvsCFBpsmDDQRupUFFo47OKqISEnGGKNUBdACAMpaK5SJ6AZg5nCzDptznjNAxC3UDgsxaK1tACv3rww8rXri4x1429aTHV/BTrJNKQZvYI9jXR98ZhD5iZATvUfbTuy9ixbZuAARBIdMI/Rl8wAAAABJRU5ErkJggg=="},{"path":"/home/martin/Dokumente/GitHub/BetterLeavesLite/assets/minecraft/textures/block/oak_leaves.png","name":"oak_leaves.png","folder":"block","namespace":"minecraft","id":"1","group":"","width":32,"height":32,"uv_width":32,"uv_height":32,"particle":false,"use_as_default":false,"layers_enabled":false,"sync_to_project":"","render_mode":"default","render_sides":"auto","frame_time":1,"frame_order_type":"loop","frame_order":"","frame_interpolate":false,"visible":true,"internal":true,"saved":true,"uuid":"898d09b0-bc9e-012e-77bc-08939e1b0a64","relative_path":"../../textures/block/oak_leaves.png","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAlFJREFUWEe1V8tpAzEU1FZgUsKSFOBLGjABn31LAYZsA8E1mDSwgRSQm8+G4EoStoTgCjaMYMTsi7Raee1cgm3Ne0/zfqPKFf4126bfPG9c99N5ZPPSVLvXXV8/1K777tz+bV+VmCw67B1um54OFncLB8cIon1vw/f4fPw69uunddZ+9gCc0TgMI4D2ow0OcevVeuXgDOdwhgFOCSIbAIycjid3/j17u3CuDpCK+r72ATAVNgjgU6mJBsDI6Rw0M9/KBr7jWaYGaSEjMbytj38BKAg30xum2NC0AIMbI+gY3tZFNADrFCA45/f4T5pBO25FivUccRavQYymQOmGYdJHA7YjNAgWJVMXw+O3EACMLR+X4WYxuplvDYwMoEhL8GTQBwCDaCf2dIpunQN2BlyCB2OBAe3hGF2aazKQmgFT8WDBB8Aq1hbRIUKGdBYoS4fPw2A+aHsqwxaPOhkUIeuAhWPTo7MeQXEAMfBL8H606oTD59iMV+e2QOfgPQNj+cVQYZ/rJuSQ4TbkGVsfOXxgQG+t0xA3t7nTeaAjWLuI0zCHDwxwn+t6ZZVz8tHZmB4oxYcVGtvnOpK10KbqgSl4v0Jz+3yuHhjDewam7PO5eiCFH+wCUJvb53P1gMUPJiHZGNvnMXVUogcsPnRByT6fqwcUH1KAYizd51fVA5z73NO31AO69AbLiCv51npAlXVSkln5dU09kGTg1nog9jbIPkxUrs3RA0UPE2VC16t2ifbzmB6wD5HswyQGYIuW6oEpL+VsCmxAVnDG9EDu1vr7H2D/VKRfkhR8AAAAAElFTkSuQmCC"}]} \ No newline at end of file diff --git a/pack.mcmeta b/pack.mcmeta new file mode 100644 index 0000000..1654b65 --- /dev/null +++ b/pack.mcmeta @@ -0,0 +1,7 @@ +{ + "pack": { + "pack_format": 15, + "supported_formats": [15, 99], + "description": "§2Version 0.1 §aby Motschen §e©Motschen 2024 | MIT Licence" + } +} diff --git a/pack.png b/pack.png new file mode 100644 index 0000000..d6485f9 Binary files /dev/null and b/pack.png differ