Example #1
0
def show_fails_if_minecraft_not_running():
    shcall(KILL_MINECRAFT_CMD)
    time.sleep(0.5)

    try:
        control.show()
    except IOError:
        return True

    return False
Example #2
0
def show_opens():
    wid = get_wid()
    show(False)

    time.sleep(2)
    if window_visible(wid):
        print('FAILED: Window should NOT be viewable, but it is')
        return False
    else:
        print('PASSED: Window should NOT be viewable, and it is not')

    control.show()

    time.sleep(2)
    if window_visible(wid):
        print('PASSED: Window SHOULD be viewable, and it is')
    else:
        print('FAILED: Window SHOULD be viewable, but it is NOT')
        return False

    return True
Example #3
0
from rstem.button import Button
from rstem.mcpi import minecraft, control, block
from rstem.mcpi.vec3 import Vec3
from itertools import cycle
import time

control.show(hide_at_exit=True)
mc = minecraft.Minecraft.create()

left = Button(23)
right = Button(14)
up = Button(18)
down = Button(15)
place = Button(24)
select = Button(7)

block_types = [
    block.STONE,
    block.BRICK_BLOCK,
    block.OBSIDIAN,
    block.DIAMOND_BLOCK,
    ]
block_types = cycle(block_types)
blk = next(block_types)

cursor = mc.player.getTilePos()
cursor.y = mc.getHeight(cursor.x, cursor.z)

BLINK_TIME = 0.3
start = time.time()
cursor_on = True
Example #4
0
from rstem.led_matrix import FrameBuffer
from rstem.mcpi import minecraft, control
import time

control.show()

mc = minecraft.Minecraft.create()

SCALE = 25
fb = FrameBuffer()

count = 0
FLASH_COUNT = 3
flash_lit = True
while True:
    pos = mc.player.getTilePos()

    x = round(pos.x / SCALE + (fb.width - 1) / 2)
    x_out_of_bounds = not 0 <= x < fb.width
    x = min(fb.width - 1, max(0, x))

    z = round(pos.z / SCALE + (fb.height - 1) / 2)
    z_out_of_bounds = not 0 <= z < fb.height
    z = min(fb.height - 1, max(0, z))

    fb.erase()
    count += 1
    if count > FLASH_COUNT:
        flash_lit = not flash_lit
        count = 0
    if not x_out_of_bounds and not z_out_of_bounds or flash_lit:
from rstem.led_matrix import FrameBuffer
from rstem.mcpi import minecraft, control
import time

control.show()

mc = minecraft.Minecraft.create()

SCALE = 25
fb = FrameBuffer()

count = 0
FLASH_COUNT = 3
flash_lit = True
while True:
	pos = mc.player.getTilePos()

	x = round(pos.x/SCALE + (fb.width-1)/2)
	x_out_of_bounds = not 0 <= x < fb.width
	x = min(fb.width-1, max(0, x))

	z = round(pos.z/SCALE + (fb.height-1)/2)
	z_out_of_bounds = not 0 <= z < fb.height
	z = min(fb.height-1, max(0, z))

	fb.erase()
	count += 1
	if count > FLASH_COUNT:
		flash_lit = not flash_lit
		count = 0
	if not x_out_of_bounds and not z_out_of_bounds or flash_lit: