By | 23 octobre 2014

Installation d’un serveur CraftBukkit.

Matériel : Intel(R) Atom(TM) CPU N2800 @ 1.86GHz
Distribution : Linux version 3.8.13-xxxx-grs-ipv6-32 (kernel@kernel.ovh.net) (gcc version 4.7.2 (Debian 4.7.2-5) ) #3 SMP Wed May 29 11:52:02 CEST 2013

1) Installation de Java :

root@ks3287666:~# apt-get install openjdk-7-jr
root@ks3287666:~# java -version
java version "1.7.0_65"
OpenJDK Runtime Environment (IcedTea 2.5.1) (7u65-2.5.1-2~deb7u1)
OpenJDK Server VM (build 24.65-b04, mixed mode)
root@ks3287666:~# su minecraft
minecraft@ks3287666:/root$ cd
minecraft@ks3287666:~$ 

2) Répertoire de travail :

minecraft@ks3287666:~$ mkdir CRAFTBUKKIT
minecraft@ks3287666:~$ cd CRAFTBUKKIT/

3) Télécharge CraftBukkit :

minecraft@ks3287666:~/CRAFTBUKKIT$ wget http://dl.bukkit.org/downloads/craftbukkit/get/02631_1.7.9-R0.2/craftbukkit-beta.jar

4) Création du lanceur du serveur :

Ouvrir :

lancerServeurMinecraft.sh

Ajouter :

#!/bin/sh

java -Xmx1024M -jar craftbukkit-beta.jar -o true

Action :

chmod 755 lancerServeurMinecraft.sh

5) Lancer le serveur :

minecraft@ks3287666:~/CRAFTBUKKIT$ ./lancerServeurMinecraft.sh 

6) Commande de gestion du serveur :

– Sauvegarde du monde :

>save-all
[22:33:42 INFO]: CONSOLE: Forcing save..
[22:33:43 INFO]: CONSOLE: Save complete.

– Arrêt du serveur :

>stop
...
[22:34:05 INFO]: Saving players
[22:34:05 INFO]: Saving worlds
[22:34:05 INFO]: Saving chunks for level 'world'/Overworld
[22:34:06 INFO]: Saving chunks for level 'world_nether'/Nether
[22:34:06 INFO]: Saving chunks for level 'world_the_end'/The End
[22:34:06 INFO]: Stopping server
[22:34:06 INFO]: Saving players
[22:34:06 INFO]: Saving worlds
[22:34:06 INFO]: Saving chunks for level 'world'/Overworld

– Activer le mode « creative » :

>gamemode creative Nekrofage
[22:30:32 INFO]: CONSOLE: Set Nekrofage's game mode to CREATIVE mode

– Activer le « jour » :

>time set 1
[22:32:58 INFO]: CONSOLE: Set time to 1

7) Installation de Raspberry Juice :

minecraft@ks3287666:~/CRAFTBUKKIT$ cd plugins/
minecraft@ks3287666:~/CRAFTBUKKIT/plugins$ wget http://dev.bukkit.org/media/files/781/207/raspberryjuice-1.3.jar
minecraft@ks3287666:~/CRAFTBUKKIT/plugins$ cd ..

8) Configuration :

Ouvrir :

server.properties 

Chercher et remplacer par :

gamemode=1
allow-flight=true

9) Relancer le serveur :

minecraft@ks3287666:~/CRAFTBUKKIT$ ./lancerServeurMinecraft.sh
...
[22:19:39 INFO]: [RaspberryJuice] Loading RaspberryJuice v1.3
...

10) Installation de MCPI :

– Répertoire de travail :

minecraft@ks3287666:~/CRAFTBUKKIT$ cd ..
minecraft@ks3287666:~$ mkdir MCPI
minecraft@ks3287666:~$ cd MCPI/
minecraft@ks3287666:~/MCPI$ 

– Téléchargement de l’API :

minecraft@ks3287666:~/MCPI$ wget https://s3.amazonaws.com/assets.minecraft.net/pi/minecraft-pi-0.1.1.tar.gz
minecraft@ks3287666:~/MCPI$ tar xvfz minecraft-pi-0.1.1.tar.gz 

– Répertoire de développement :

minecraft@ks3287666:~/MCPI$ mkdir mcdev
minecraft@ks3287666:~/MCPI$ cd mcdev/
minecraft@ks3287666:~/MCPI/mcdev$ cp -r ../mcpi/api/python/mcpi/ 

– Script de test : Création d’une colonne

Ouvrir :

test.py

Ajouter :

# Sample program to create a pillar

import mcpi.minecraft as minecraft
import mcpi.block as block

# Connect to the Minecraft server
world = minecraft.Minecraft.create()

# Get the player's current position and store the coordinates
[x,y,z] = world.player.getPos()

# Set some variables to customize your pillar
height = 3
material = block.BRICK_BLOCK

# Build the pillar. It will be "height" blocks high and located one step away from the player.
for level in range(0, height):
 world.setBlock( x+1, y+level, z+1, material )
 level = level + 1;

– Exécuter le script :

(Quitter la session de jeu)

minecraft@ks3287666:~/MCPI/mcdev$ python ./test.py  

(Retourner au jeu)

11) Capture d’écran :

minecraft_mcpi

12) Lien :

http://blog.lostbearlabs.com/2013/04/25/using-the-minecraft-api-without-a-raspberry-pi-craftbukkit-and-raspberryjuice/