Skip to content

rdhuht/MinecraftPython

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MinecraftPython

Sample Python scripts and notes for using the Python mpi 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.

  1. Setup a Python virtual environment. Python3.x was used with these examples and is recommended. Install
python -m venv venv
  1. Install mpi
pip install mpi
  1. Verify all is working by running the following in an interpreter.
from mpi.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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages