from mcpi.minecraft import Minecraft
from map import Fase
from Message import Message
import time
mc = Minecraft.create()
# Set the location where tha phase is going to be loaded
pos = {'x': 100, 'y': 100, 'z': 100}
# Set the amount of platforms in the game
# These platforms are the one that stands appearing and may disappear
platforms = 40
# List of the location(x, z) of all the platforms during the game
lstPlatforms = []

# Creates a new Phase
fase = Fase(20, 20, 20, mc)
# Creates 'message' to display warnings to the playing during the game
message = Message(mc)
# Load the floor
fase.LoadFloor(pos, 20, 20, 1)
# Load a under floor
fase.LoadUnderFloor(pos, 20, 20)
# Load the walls(4). You can specify the block like fase.LoadWalls(pos, width, height, blockType)
fase.LoadWalls(pos, 20, 20, 120)
# Teleport the player to the initial of the phase generated
mc.player.setTilePos(pos['x']+4, pos['y']+5, pos['z']+10)
# Get the position of the random platforms generated by LoadPlatforms(platforms)
lstPlatforms = fase.LoadPlatforms(platforms)
# This floor is trap containing lava, but you can specify any block you want in
# LoadTrap(pos, width, length, blockType)
fase.LoadTrap(pos, 20, 20)
# Display a warning telling that the game is going to start in x seconds
message.WarningBeginning(30)
while(platforms > 0):
    # Warn the player that a platform is going to be removed from the map
    message.WarningRemoveBlock()
    # Clean the floor, leaving only the platforms in the 'lstPlatforms'
    fase.CleanFloor(pos, lstPlatforms)
    # Remove a random platform of the map
    lstPlatforms = fase.RemoveRandomPlatform(pos, lstPlatforms)
    # Update the platform amount
    platforms = platforms - 1
