#!/bin/bash
set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BUILD_DIR="$SCRIPT_DIR/build"

rm -rf "$BUILD_DIR"
mkdir -p "$BUILD_DIR"

echo "Packaging Behavior Pack..."
cd "$SCRIPT_DIR/spark_pet_BP"
zip -r "$BUILD_DIR/spark_pet_BP.mcpack" . -x ".*"

echo "Packaging Resource Pack..."
cd "$SCRIPT_DIR/spark_pet_RP"
zip -r "$BUILD_DIR/spark_pet_RP.mcpack" . -x ".*"

echo "Creating .mcaddon bundle..."
cd "$BUILD_DIR"
zip -r "$BUILD_DIR/pets_4_jamies_stars.mcaddon" spark_pet_BP.mcpack spark_pet_RP.mcpack

echo ""
echo "Build complete!"
echo "  Output: $BUILD_DIR/pets_4_jamies_stars.mcaddon"
echo ""
echo "To install:"
echo "  - Double-click the .mcaddon file on Windows to auto-import"
echo "  - Or copy packs to com.mojang/development_behavior_packs/ and development_resource_packs/"
