File: bridge.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 (25 lines) | stat: -rwxr-xr-x 544 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#
# Code under the MIT license by Alexander Pruss
#


from mc import *
import time
import os

mc = Minecraft()

bridge = []

while True:
   pos = mc.player.getTilePos()
   pos.y = pos.y - 1
   belowBlock = mc.getBlock(pos)
   if belowBlock == AIR.id or belowBlock == WATER_FLOWING.id or belowBlock == WATER_STATIONARY.id:
     bridge.append(pos)
     mc.setBlock(pos, STAINED_GLASS_BLUE)
     if len(bridge) > 10:
         firstPos = bridge.pop(0)
         if not firstPos in bridge:
             mc.setBlock(firstPos, AIR)
   time.sleep(0.05)