Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # CC:Tweaked and Python 3
- # Block move terminal programm
- # Version 1.0 01.07.2021 00:45:00
- # (c) 2021, MCAP-2020 (mcap_nikita & mcap_slipers)
- import sys
- from cc import term, commands
- cmd = commands
- out = term; out.clear(); out.setCursorPos(1,1)
- # -------------------------------------------------------------
- tmp_x, tmp_z = None, None
- x, y, z = cmd.getBlockPosition()
- for dx in -3, 3:
- for dz in -3, 3:
- info = cmd.getBlockInfo(x + dx, y - 1, z + dz)
- if info['name'] == 'minecraft:redstone_block':
- tmp_x = x + dx; tmp_z = z + dz
- x = tmp_x; z = tmp_z
- if (x == None) or (z == None):
- print("Starting point not found")
- sys.exit()
- print("Starting point: %s, %s, %s" % (x, y, z))
- # -------------------------------------------------------------
- print("START")
- log, move = '', ''
- pos_x = x; pos_y = y; pos_z = z
- new_x = x; new_y = y; new_z = z
- min_x = x - 1; max_x = x + 1; min_y = y; max_y = y + 2; min_z = z - 1; max_z = z + 1
- cmd.exec('fill %s %s %s %s %s %s minecraft:air'%(str(min_x), str(min_y), str(min_z), str(max_x), str(max_y), str(max_z)))
- cmd.exec('setblock %s %s %s minecraft:concrete'%(str(x), str(y), str(z)))
- while True:
- out.setCursorPos(1,3); out.clearLine()
- move = input("Move (f, b, l, r, u, d), quit (q): ")
- if move == 'q':
- log = log + move
- break
- elif move == 'f':
- new_x = pos_x - 1
- elif move == 'b':
- new_x = pos_x + 1
- elif move == 'l':
- new_z = pos_z + 1
- elif move == 'r':
- new_z = pos_z - 1
- elif move == 'u':
- new_y = pos_y + 1
- elif move == 'd':
- new_y = pos_y - 1
- if (new_x >= min_x) and (new_x <= max_x) and (new_y >= min_y) and (new_y <= max_y) and (new_z >= min_z) and (new_z <= max_z):
- if (new_x != pos_x) or (new_y != pos_y) or (new_z != pos_z):
- cmd.exec('setblock %s %s %s minecraft:air'%(str(pos_x),str(pos_y),str(pos_z)))
- cmd.exec('setblock %s %s %s minecraft:concrete'%(str(new_x),str(new_y),str(new_z)))
- pos_x = new_x; pos_y = new_y; pos_z = new_z
- log = log + move + "-"
- else:
- new_x = pos_x; new_y = pos_y; new_z = pos_z
- else:
- new_x = pos_x; new_y = pos_y; new_z = pos_z
- print("LOG: " + log)
- print("END")
- sys.exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement