Skip to content

Instantly share code, notes, and snippets.

@richardbwest
Created August 29, 2018 12:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save richardbwest/22affc1719b244c3fa683fed8fcc9678 to your computer and use it in GitHub Desktop.
Save richardbwest/22affc1719b244c3fa683fed8fcc9678 to your computer and use it in GitHub Desktop.
A working teleporter in the minecraft world using Python
#Full tutorial video available at - http://learnlearn.uk/raspberrypi/2018/08/29/make-teleporter-minecraft-using-python/
import mcpi.minecraft as minecraft
import mcpi.block as block
import time
mc = minecraft.Minecraft.create()
mc.postToChat("Welcome to my teleporter")
pos1 = (-2,0,29)
pos2 = (22,0,23)
mc.setBlock(pos1[0],pos1[1]-1,pos1[2],block.WATER)
mc.setBlock(pos2[0],pos2[1]-1,pos2[2],block.SAND)
while True:
pos = tuple(mc.player.getTilePos())
if pos == pos1:
mc.player.setTilePos(pos2[0],pos2[1],pos2[2])
time.sleep(5)
elif pos == pos2:
mc.player.setTilePos(pos1[0],pos1[1],pos1[2])
time.sleep(5)
@JCrobotss1234
Copy link

Didn't work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment