#!/bin/bash
## full path to mcmap binary
cd /minecraft/mcmap/
## path to your world
WORLD=/minecraft/world/
## path to write output image to
OUTPUT="/var/www/maps"
## see below to change the area to render (lines that start with ##)
################################
FILE=history-`date +%s`.png
OLD5=none
OLD6=none
if [ -e "$OUTPUT/output.day.png" ]; then
OLD5=`md5sum $OUTPUT/output.day.png | cut -b 1-32`
fi
if [ -e "$OUTPUT/output.night.png" ]; then
OLD6=`md5sum $OUTPUT/output.night.png | cut -b 1-32`
fi
NIGHT="-skylight"
NIGHTSTATUS="0"
## change the values here to define the area to render
#./mcmap -png $NIGHT -from -40 -60 -to 20 20 "$WORLD" > /dev/null
## if you want the whole world, use:
./mcmap -png "$WORLD" $NIGHT > /dev/null
RET=$?
if [ "$RET" -ne "0" ]; then
echo "Error creating image for $FILE"
exit 1;
fi
NEW5=`md5sum output.png | cut -b 1-32`
if [ "$OLD5" != "$NEW5" ] && [ "$OLD6" != "$NEW5" ]; then
mkdir -p $OUTPUT/history/
pngcrush output.png $OUTPUT/history/$FILE > /dev/null
fi