def sound_flushing_sound_wont_stop_bugfix():
    note = Note('A')
    start = time.time()
    note.play(2)
    time.sleep(1)
    note.stop()
    return verify_duration(start, 1)
def note_playing_before_end_of_duration_play():
    s = Note('A')
    s.play(duration=1.0)
    time.sleep(0.5)
    playing = s.is_playing()
    s.stop()
    return playing
Exemple #3
0
def note_playing_before_end_of_duration_play():
    s = Note('A')
    s.play(duration=1.0)
    time.sleep(0.5)
    playing = s.is_playing()
    s.stop()
    return playing
Exemple #4
0
def sound_flushing_sound_wont_stop_bugfix():
    note = Note('A')
    start = time.time()
    note.play(2)
    time.sleep(1)
    note.stop()
    return verify_duration(start, 1)
def sound_play_test_sound_and_note_mixed():
    n = Note('A')
    s = Sound(TEST_SOUND)
    n.play(duration=None)
    s.play()
    s.wait()
    n.stop()
    return True
Exemple #6
0
def sound_play_test_sound_and_note_mixed():
    n = Note('A')
    s = Sound(TEST_SOUND)
    n.play(duration=None)
    s.play()
    s.wait()
    n.stop()
    return True
def sound_manual_play_test_sound_and_note_mixed():
    '''The sound match1.wav will play TWO TIMES on the speaker, mixed with an
    'A' note.
    '''
    n = Note('A')
    s = Sound(TEST_SOUND)
    n.play(duration=None)
    s.play()
    s.wait()
    s.play()
    s.wait()
    n.stop()
Exemple #8
0
def sound_manual_play_test_sound_and_note_mixed():
    '''The sound match1.wav will play TWO TIMES on the speaker, mixed with an
    'A' note.
    '''
    n = Note('A')
    s = Sound(TEST_SOUND)
    n.play(duration=None)
    s.play()
    s.wait()
    s.play()
    s.wait()
    n.stop()
BEEP_DURATION = 0.05

ARENA_WIDTH = 10
GOLD_DEPTH = 2
gold_pos = mc.player.getTilePos()
gold_pos.x += randint(-ARENA_WIDTH, ARENA_WIDTH)
gold_pos.z += randint(-ARENA_WIDTH, ARENA_WIDTH)
gold_pos.y = mc.getHeight(gold_pos.x, gold_pos.z) - GOLD_DEPTH
mc.setBlock(gold_pos, block.GOLD_BLOCK)

next_beep_time = time.time()
while block.Block(mc.getBlock(gold_pos)) == block.GOLD_BLOCK:
    player_pos = mc.player.getTilePos()
    vector_to_gold = gold_pos - player_pos
    vector_to_gold.y = 0
    distance_to_gold = vector_to_gold.length()

    if time.time() > next_beep_time:
        if distance_to_gold <= 1:
            if not beep.is_playing():
                beep.play(duration=None)
        else:
            beep.play(duration=BEEP_DURATION).wait()
            next_beep_time = time.time() + log(distance_to_gold / 100 + 1)

    time.sleep(0.01)

beep.stop()
mc.postToChat("You found the gold!")
time.sleep(3)
ARENA_WIDTH = 10
GOLD_DEPTH = 2
gold_pos = mc.player.getTilePos()
gold_pos.x +=  randint(-ARENA_WIDTH, ARENA_WIDTH)
gold_pos.z +=  randint(-ARENA_WIDTH, ARENA_WIDTH)
gold_pos.y = mc.getHeight(gold_pos.x, gold_pos.z) - GOLD_DEPTH
mc.setBlock(gold_pos, block.GOLD_BLOCK)

next_beep_time = time.time()
while block.Block(mc.getBlock(gold_pos)) == block.GOLD_BLOCK:
    player_pos = mc.player.getTilePos()
    vector_to_gold = gold_pos - player_pos
    vector_to_gold.y = 0
    distance_to_gold = vector_to_gold.length()

    if time.time() > next_beep_time:
        if distance_to_gold <= 1:
            if not beep.is_playing():
                beep.play(duration=None)
        else:
            beep.play(duration=BEEP_DURATION).wait()
            next_beep_time = time.time() + log(distance_to_gold/100 + 1)
    
    time.sleep(0.01)

beep.stop()
mc.postToChat("You found the gold!")
time.sleep(3)