from socket import * _sock = socket() def connect(ip="127.0.0.1", port=4711): """Connect to the Minecraft game at the given address.""" _sock.connect((ip,port)) print "Connected to Minecraft server at {0}:{1}".format(ip,port) def setblock(x,y,z,type): """Place a block.""" _sock.send("set-block({0},{1},{2},{3})\n".format(x,y,z,type)) def getblock(x,y,z): """Ask the type of a block.""" #_sock.send("get-block({0},{1},{2})\n".format(x,y,z)) pass def moveplayer(x,y,z): """Move the player.""" _sock.send("set-player({0},{1},{2})\n".format(x,y,z)) AIR = 0 STONE = 1 GRASS = 2 DIRT = 3 COBBLESTONE = 4 WOOD_PLANK = 5 SAPLING = 6 BEDROCK = 7 WATER_FLOWING = 8 WATER = 9 LAVA_FLOWING = 10 LAVA = 11 SAND = 12 GRAVEL = 13 GOLD_ORE = 14 IRON_ORE = 15 COAL_ORE = 16 WOOD = 17 LEAVES = 18 GLASS = 20 LAPIS_ORE = 21 LAPIS = 22 SANDSTONE = 24 BED = 26 COBWEB = 30 TALL_GRASS = 31 WOOL = 35 FLOWER_YELLOW = 37 FLOWER_RED = 38 MUSHROOM_BROWN = 39 MUSHROOM_RED = 40 GOLD = 41 IRON = 42 STONE_SLAB_DOUBLE = 43 STONE_SLAB = 44 BRICK = 45 TNT = 46 BOOKSHELF = 47 MOSSY_STONE = 48 OBSIDIAN = 49 TORCH = 50 FIRE = 51 WOOD_STAIRS = 53 CHEST = 54 DIAMOND_ORE = 56 DIAMOND = 57 CRAFTING_TABLE = 58 FARMLAND = 60 FURNACE = 61 FURNACE_ACTIVE = 62 WOOD_DOOR = 64 LADDER = 65 COBBLESTONE_STAIRS = 67 IRON_DOOR = 71 REDSTONE_ORE = 73 SNOW_COVER = 78 ICE = 79 SNOW = 80 CACTUS = 81 CLAY = 82 SUGAR_CANE = 83 FENCE = 85 GLOWSTONE = 89 INVISIBLE_BEDROCK = 95 STONE_BRICK = 98 GLASS_PANE = 102 MELON = 103 FENCE_GATE = 107 GLOWING_OBSIDIAN = 246 NETHER_REACTOR_CORE = 247 UPDATE_GAME_BLOCK = 249