#!/bin/bash # Simple script that automatically creates items/ and models/item defniitions # based off the textures in the textures/item folder. # It only checks for .png files # Must run from the namespace's folder (assets/) NAMESPACE=$1 if [[ -z "$NAMESPACE" ]]; then echo Namespace is required echo Syntax: ./create_json.sh "" exit 1 fi if [ ! -d "assets/$NAMESPACE/textures" ]; then echo "The path assets/$NAMESPACE/textures does not exist" exit 1 fi mkdir "assets/$NAMESPACE/models/item" -p || true mkdir "assets/$NAMESPACE/items" -p || true echo Creating files for $NAMESPACE for file in "assets/$NAMESPACE/textures/item/"*.png; do name=$(basename "$file" .png) cat > "assets/$NAMESPACE/models/item/$name.json" < "assets/$NAMESPACE/items/$name.json" <