Minecraft/Overviewer

From Omnia
Jump to navigation Jump to search

Minecraft Overviewer

Minecraft Overviewer - https://github.com/overviewer/Minecraft-Overviewer

North facing issue: https://github.com/brownan/Minecraft-Overviewer/issues/48

This program requires:

 `Textures`_ section below.

Install Python 2.7.5:

mkdir -p ~/.src ; cd ~/.src
wget http://www.python.org/ftp/python/2.7.5/Python-2.7.5.tgz
tar -zvxf Python-2.7.5.tgz
cd Python-2.7.5
./configure --prefix=$(echo ~)/overviewer-python
make clean && make &&  make install
export PATH=$(echo ~)/overviewer-python/bin:$PATH

Install PIL:

# prerequisite for MO requirement: (zlib libraries) REQUIRED!
sudo yum -y install zlib-devel libjpeg-devel
# sudo apt-get install libjpeg-dev zlib1g-dev
mkdir -p ~/.src ; cd ~/.src
wget http://effbot.org/downloads/Imaging-1.1.7.tar.gz
tar -zvxf Imaging-1.1.7.tar.gz
cd Imaging-1.1.7
python setup.py build  # check dependencies are meet
python setup.py install
# if have to repeat
python setup.py clean
python setup.py build --force
python setup.py install
#   Missing: TKINTER, FREETYPE2, LITTLECMS
#   Supported: JPEG, ZLIB (PNG/ZIP)

WARNING: Install zlib-devel or you will get this error when running Overviewer: IOError: decoder zip not available

On Ubuntu you may have to do this fix: [1] [2]

# #ubuntu-fix freetype/fterrors.h#  cd /usr/include ; ln -s freetype2 freetype
apt-get install libzzip-dev libjpeg-dev
sudo ln -s /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib/
sudo ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/
sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/

Install numpy:

# dependency:
sudo yum -y install git
mkdir -p ~/.src ; cd ~/.src
git clone git://github.com/numpy/numpy.git numpy
cd numpy
# git tag -l
git checkout v1.7.1
python setup.py install

Test libraries:

cd ~
echo "import PIL" | python
echo "import numpy" | python  # don't try from within numpy source path
# expect no errors and no response if successful

Make folders and get assets:

mkdir -p ~/.minecraft/bin ~/.minecraft/saves/
# COPY [DESKTOP]\%appdata%\.minecraft\.bin\minecraft.jar TO ~/.minecraft/bin/
VERSION=1.6.2
wget https://s3.amazonaws.com/Minecraft.Download/versions/${VERSION}/${VERSION}.jar -P ~/.minecraft/versions/${VERSION}/

# mkdir -p ~/.minecraft/bin ~/.minecraft/saves/
#rm -f ~/.minecraft/saves/World1
# ln -s /home/minecraft/[WORLD]/world ~/.minecraft/saves/World1
# Copy jar (from an updated client) to bin:
# # %appdata%\.minecraft\bin\minecraft.jar
# # C:\Documents and Settings\kenneth\Application Data\.minecraft\bin\minecraft.jar
# cp [...]/minecraft.jar ~/.minecraft/bin/
# for i in $( seq 1 10 ) ; do echo "copy minecraft.jar to ~/.minecraft/bin/" ; done

Install Minecraft Overviewer:

# git clone https://github.com/rmrector/Minecraft-Overviewer MO  # rotate map
# git clone https://github.com/brownan/Minecraft-Overviewer.git MO  # original
cd ~
git clone git://github.com/overviewer/Minecraft-Overviewer.git overviewer
cd overviewer
cp ~/.src/Imaging-1.1.7/libImaging/Imaging.h .
cp ~/.src/Imaging-1.1.7/libImaging/ImPlatform.h .
python setup.py build
python overviewer.py  # test - shows help
# ~/overviewer-python/bin/python overviewer.py
# ./overviewer.py  # test

Update Minecraft Overviewer:

cd overviewer
git fetch
git pull
git checkout .
python setup.py build
python overviewer.py  # test - shows help
# cp /some/path/minecraft.jar .minecraft/bin/

Minecraft Overviewer Execution

Execution:

# overviewer.py [OPTIONS] <World # / Name / Path to World> <tiles dest dir>
python overviewer.py --rendermodes=normal,lighting,night,spawn,cave 1 /www/minecraft/map

Alternatives:

python overviewer.py ~/iago/world /www/minecraft/map
/home/minecraft/python/bin/python /home/minecraft/overviewer/overviewer.py --rendermodes=normal,lighting,night,cave ~/iago/world /www/minecraft/map

Crontab:

0 3 * * *	~/genmap.sh

~/genmap.sh:

#!/bin/sh

MAP_HOME=/www/minecraft
USER_HOME=/root
PYTHON=/opt/python26/bin/python

THEDATE=`date`

function header {
cat > $MAP_HOME/index.html <<EOF
<html>
<head>
  <title>Minecraft Server Maps</title>
</head>
<body>

<h1>Minecraft Server Maps</h1>

<p>Maps generated ${THEDATE}</p>

EOF
}

function footer {
cat >> $MAP_HOME/index.html <<EOF

</body>
</html>
EOF
}

function genmap {
  # Minecraft-Overviewer
  echo $1
  rm -f $USER_HOME/.minecraft/saves/World1
  ln -s $USER_HOME/$1/world $USER_HOME/.minecraft/saves/World1
  cd $USER_HOME/overviewer
  nice $PYTHON ./overviewer.py --rendermodes=normal,lighting,night,spawn,cave 1 /www/minecraft/$1
  echo "<p><a href="$1">Overview Map: $1</a></p>" >> $MAP_HOME/index.html
}

header
genmap mc
footer