Created
August 29, 2018 12:45
-
-
Save richardbwest/22affc1719b244c3fa683fed8fcc9678 to your computer and use it in GitHub Desktop.
A working teleporter in the minecraft world using Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Didn't work