Minecraft Pi API
Project description
MinecraftPython
Sample Python scripts and notes for using the Python mcpi library for manipulating and working with Minecraft.
I use these scripts and the library to explore Python3.
Getting Started
You'll need a Minecraft setup that supports interaction via API.
This is most simply achieved with the Minecraft for Raspberry Pi, but can also work with full blown Minecraft Java Servers with the Raspberry Juice Server.
Details of setting up the server side are out of scope for these instructions, it is assumed you already have the server running and a game client connected.
- Clone down this repository.
git clone https://github.com/rdhuht/MinecraftPython.git
cd MinecraftPython
- Setup a Python virtual environment. Python3.x was used with these examples and is recommended. Install
python3.7 -m venv venv
- Install
MinecraftPython
pip install MinecraftPython
- Verify all is working by running the following in an interpreter.
# use somebody else's code
from mcpi.minecraft import Minecraft
name = "Yourname"
# connect to minecraft
address = "MinecraftServerAddress"
mc = Minecraft.create(address)
# get the x,y,z (position)
entity_id = mc.getPlayerEntityId(name)
position = mc.entity.getPos()
# print position to screen
print("x: {}, y: {}, z: {}".format(position.x, position.y, position.z))
Resources and References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mpi-1.0.0.tar.gz
.
File metadata
- Download URL: mpi-1.0.0.tar.gz
- Upload date:
- Size: 96.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.55.2 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1f87d6c213ef9102607e0321a2b07bb673359135ce2de06116591b48b90eb4a |
|
MD5 | 5a2e328e42a7c7e9f251ebed1671c294 |
|
BLAKE2b-256 | 86d1d039c0dea5058a946521b850ece030da650802078bee5c786bf54852164c |
File details
Details for the file mpi-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: mpi-1.0.0-py3-none-any.whl
- Upload date:
- Size: 106.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.55.2 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8d1f7dda9a01fce4ef5d1d1f08321fd3775b24a1b46a8814eaeed33d7750a08 |
|
MD5 | dc97fa5abea79e0842f51c1efd1a0afc |
|
BLAKE2b-256 | f6117e43ae1ecd213f45116371768bfd4437c0bbdfb880d0c680680e4cbb76b8 |