File: brooksc_findpos.py

package info (click to toggle)
minetest-mod-pycraft 0.22-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,744 kB
  • sloc: python: 79,282; makefile: 10
file content (24 lines) | stat: -rw-r--r-- 923 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env python3

#import the minecraft.py module from the minecraft directory
import mcpi.minecraft as minecraft
#import minecraft block module
import mcpi.block as block
#import time, so delays can be used
import time
import server

if __name__ == "__main__":
    mc = minecraft.Minecraft.create(server.address)
#    mc.postToChat("Flattening surface")
#    mc.setBlocks(-128,0,-128,128,64,128,0)
#    mc.setBlocks(-128,0,-128,128,-64,128,block.SANDSTONE.id)
#    mc.postToChat("Putting a diamong block at 0,0,0")
#    mc.setBlock(0,0,0,block.DIAMOND_BLOCK.id)

    while True:
        #Find out your players position
        playerPos = mc.player.getPos()
        mc.postToChat("Find your position - its x=%s y=%s z=%s" % (int(playerPos.x), int(playerPos.y), int(playerPos.z)))
#        mc.postToChat("Find your position - its x=%.2f y=%.2f z=%.2f" % (playerPos.x, playerPos.y, playerPos.z))
        time.sleep(1)