Minecraft Pi API extensions.
To use the ModPi API you need to have Python >= 3.7.x
and libmcpi
pre-installed.
To install ModPi, download or clone the repository, install the Python 3.x module using pip
and build the patch using make
:
git clone https://github.com/MCPI-Devs/modpi.git
cd modpi
pip3 install .
make
You can also install it from the Packagecloud Debian repository:
# If you didn't add the repository yet
curl -s https://packagecloud.io/install/repositories/Alvarito050506/mcpi-devs/script.deb.sh | sudo bash
# Now the actual installation
sudo apt-get install libmodpi
The ModPi API exposes the following methods through the ModPi
class:
Initializes the class, mcpi
must be a mcpi.minecraft.Minecraft
object.
Returns the current player name.
Sets the current player name to username
.
Returns the game mode of the current world as an integer:
- 0 = Survival
- 1 = Creative
Returns the name of the current world.
Returns the IP address or internet domain of the current server.
Returns the internet port of the current server.
Sets the OpenGL fog and clear colors. The color
argument must be an RGBA tuple, like (255, 0, 255, 128)
.
Returns if the instance of MCPI is acting as Server, Client or Local:
- 0 = Server
- 1 = Client
- 2 = Local
There is an example.py
in the src
folder. It contains a basic usage example.
It's a bit magic. The core is the C code, that's all my explanation because I'm too lazy to write a proper one. But hey! The code is well commented! (I hope).
All the code of this project is licensed under the GNU General Public License version 2.0 (GPL-2.0).
All the documentation of this project is licensed under the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.