Teleporting between locations via python…

Obsidz created a teleportation script, first the pics (of fleap3’s pads, hard to show a pic of teleporting…)

2013-02-16_11.30.16 2013-02-16_11.30.26

Here’s how it works:

  1. The user creates a Nether Reactor Core block, surrounded by cobblestone in one location
  2. And then creates another of the same — in a different location.  These become the “teleportation station”
  3. Run the script
  4. Travel as usually over the two pads
  5. Now when you travel over one pad in the future – you will teleport to the other

Note as well — the script only works with a single person.  Fleap3 also had a problem going through the same portal multiple times (we haven’t debugged this).

The code below is Obsidz original code — the version in github has two changes:

  1. To enable this to run on the bukkit mode, I made it easy to switch between the “magic blocks”.  I use diamond for the bukkit server.
  2. When running this we had some trouble getting it to work with manually created pads – so I have the script send to chat when it recognizes a pad.

Finally I also created a quick script to automate the pad creation as well.  Here is the script in github.


import mcpi.minecraft as minecraft
import mcpi.block as block
import time

#Author:                Obsidz
#Description:   This is a teleport pad script.
#                          To create a pad, place a nether reactor core onto a location and ring with cobbledtone blocks
#                          To add to locations list walk over it
#Notes:          Pads added to list by walking over them
#                          Pads not removed if destroyed but can be teleported to but not from
#                          You cannot teleport to the same pad without modifying script
#                          Pads need to be added each time the script is run

LPLoc = list()

Pads = 0
Cpad = 0
def isLaunchPad(): #checks if the the location below the player is a teleporting pad
                loc = mc.player.getPos()
                if ((mc.getBlock(loc.x,loc.y-1,loc.z) == and
                        (mc.getBlock(loc.x-1,loc.y-1,loc.z-1) == and
                        (mc.getBlock(loc.x-1,loc.y-1,loc.z) == and
                        (mc.getBlock(loc.x-1,loc.y-1,loc.z+1) == and
                        (mc.getBlock(loc.x,loc.y-1,loc.z+1) == and
                        (mc.getBlock(loc.x,loc.y-1,loc.z-1) == and
                        (mc.getBlock(loc.x+1,loc.y-1,loc.z-1) == and
                        (mc.getBlock(loc.x+1,loc.y-1,loc.z) == and
                        (mc.getBlock(loc.x+1,loc.y-1,loc.z+1) ==
                        return True
                        return False
def addLPLoc(Vec3): #Loggs the location of the pad for future use
        global Pads
        global LPLoc

        inList = False
        if Pads > 0:
                for loc in LPLoc:
                        if (loc.x == Vec3.x and loc.y == Vec3.y and loc.z == Vec3.z):
                                inList = True

        if not inList:
                Pads =  len(LPLoc)
def locCheck(): #Checks that you are not teleporting to the same pad

        global Cpad
        global LPLoc
        loc = mc.player.getPos()
        if (loc.x == LPLoc[Cpad].x and loc.y == LPLoc[Cpad].y and loc.z == LPLoc[Cpad].z):
                Cpad = Cpad + 1
def TPChar(): #sends the character to the next pad
        global Pads
        global Cpad
        global LPLoc

        if Pads > 1:
                mc.player.setPos(LPLoc[Cpad].x,LPLoc[Cpad].y + 1,LPLoc[Cpad].z)
                Cpad = ( Cpad + 1) %  Pads

if __name__ == "__main__": # The script

        mc = minecraft.Minecraft.create()
        while True:
                if isLaunchPad():


Originally found here…


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s