#!/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 CHECK=`date +%k` if [ $CHECK -ge "7" ] && [ $CHECK -le "20" ]; then NIGHT="-skylight" NIGHTSTATUS="0" else NIGHT="-skylight -night" NIGHTSTATUS="1" fi ## 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 if [ "$NIGHTSTATUS" -eq "1" ]; then mv output.png $OUTPUT/output.night.png else mv output.png $OUTPUT/output.day.png fi fi