def theRiver(arenaPos, riverZPos): mc = minecraft.Minecraft.create() # констатнты реки RIVERWIDTH = 4 BRIDGEWIDTH = 2 # создаем реку mc.setBlocks(arenaPos.x, arenaPos.y - 2, arenaPos.z + riverZPos, arenaPos.x + ARENAX, arenaPos.y, arenaPos.z + riverZPos + RIVERWIDTH - 1, block.AIR.id) # наполняем реку mc.setBlocks(arenaPos.x, arenaPos.y - 2, arenaPos.z + riverZPos, arenaPos.x + ARENAX, arenaPos.y - 2, arenaPos.z + riverZPos + RIVERWIDTH - 1, block.WATER.id) # создаем мост bridgePos = minecraft.Vec3(arenaPos.x, arenaPos.y, arenaPos.z + riverZPos + 1) bridgeBlocks = [] for x in range(0, BRIDGEWIDTH): for z in range(0, RIVERWIDTH - 2): bridgeBlocks.append( minecraftstuff.ShapeBlock(x, 0, z, block.WOOD_PLANKS.id)) bridgeShape = minecraftstuff.MinecraftShape(mc, bridgePos, bridgeBlocks) # перемещаем мост влевло-вправо steps = ARENAX - BRIDGEWIDTH while not gameOver: for left in range(0, steps): bridgeShape.moveBy(1, 0, 0) time.sleep(1) for right in range(0, steps): bridgeShape.moveBy(-1, 0, 0) time.sleep(1)
def theWall(arenaPos, wallZPos): mc = minecraft.Minecraft.create() # создаем подвижную стену wallPos = minecraft.Vec3(arenaPos.x, arenaPos.y + 1, arenaPos.z + wallZPos) wallBlocks = [] for x in range(0, ARENAX + 1): for y in range(1, ARENAY): wallBlocks.append( minecraftstuff.ShapeBlock(x, y, 0, block.BRICK_BLOCK.id)) wallShape = minecraftstuff.MinecraftShape(mc, wallPos, wallBlocks) # передвигаем стену вверх-вниз while not gameOver: wallShape.moveBy(0, 1, 0) time.sleep(1) wallShape.moveBy(0, -1, 0) time.sleep(1)
def theWall(arenaPos, wallZPos): #create connection to minecraft mc = minecraft.Minecraft.create() #create the wall shape wallPos = minecraft.Vec3(arenaPos.x, arenaPos.y + 1, arenaPos.z + wallZPos) #create the wall blocks wallBlocks = [] for x in range(0, ARENAX + 1): for y in range(1, ARENAY): wallBlocks.append( minecraftstuff.ShapeBlock(x, y, 0, block.BRICK_BLOCK.id)) wallShape = minecraftstuff.MinecraftShape(mc, wallPos, wallBlocks) #move the wall up and down while not gameOver: wallShape.moveBy(0, 1, 0) time.sleep(1) wallShape.moveBy(0, -1, 0) time.sleep(1)
def theRiver(arenaPos, riverZPos): #create connection to minecraft mc = minecraft.Minecraft.create() #constants RIVERWIDTH = 4 BRIDGEWIDTH = 2 #create the river mc.setBlocks(arenaPos.x, arenaPos.y - 2, arenaPos.z + riverZPos, arenaPos.x + ARENAX, arenaPos.y, arenaPos.z + riverZPos + RIVERWIDTH - 1, block.AIR.id) #fill with water mc.setBlocks(arenaPos.x, arenaPos.y - 2, arenaPos.z + riverZPos, arenaPos.x + ARENAX, arenaPos.y - 2, arenaPos.z + riverZPos + RIVERWIDTH - 1, block.WATER.id) #create the bridge shape bridgePos = minecraft.Vec3(arenaPos.x, arenaPos.y, arenaPos.z + riverZPos + 1) #create the bridge blocks bridgeBlocks = [] for x in range(0, BRIDGEWIDTH): for z in range(0, RIVERWIDTH - 2): bridgeBlocks.append( minecraftstuff.ShapeBlock(x, 0, z, block.WOOD_PLANKS.id)) bridgeShape = minecraftstuff.MinecraftShape(mc, bridgePos, bridgeBlocks) #move the bridge left and right #how many steps are there between the left and right side of the arena steps = ARENAX - BRIDGEWIDTH while not gameOver: for left in range(0, steps): bridgeShape.moveBy(1, 0, 0) time.sleep(1) for right in range(0, steps): bridgeShape.moveBy(-1, 0, 0) time.sleep(1)
def __init__(self, pos): #create the x wing xWingBlocks = [ mcstuff.ShapeBlock(0, 0, -2, block.IRON_BLOCK), mcstuff.ShapeBlock(0, 0, -1, block.IRON_BLOCK), mcstuff.ShapeBlock(0, 0, 0, block.IRON_BLOCK), mcstuff.ShapeBlock(-3, 1, 0, block.IRON_BLOCK), mcstuff.ShapeBlock(0, 0, 0, block.IRON_BLOCK), mcstuff.ShapeBlock(3, 1, 0, block.IRON_BLOCK), mcstuff.ShapeBlock(-3, 1, 1, block.IRON_BLOCK), mcstuff.ShapeBlock(-1, 1, 1, block.WOOL.id, 8), mcstuff.ShapeBlock(0, 1, 1, block.WOOL.id, 3), mcstuff.ShapeBlock(1, 1, 1, block.WOOL.id, 8), mcstuff.ShapeBlock(3, 1, 1, block.IRON_BLOCK), mcstuff.ShapeBlock(-2, 1, 2, block.IRON_BLOCK), mcstuff.ShapeBlock(-1, 1, 2, block.WOOL.id, 8), mcstuff.ShapeBlock(0, 1, 2, block.IRON_BLOCK), mcstuff.ShapeBlock(1, 1, 2, block.WOOL.id, 8), mcstuff.ShapeBlock(2, 1, 2, block.IRON_BLOCK), mcstuff.ShapeBlock(-3, -1, 0, block.IRON_BLOCK), mcstuff.ShapeBlock(3, -1, 0, block.IRON_BLOCK), mcstuff.ShapeBlock(-3, -1, 1, block.IRON_BLOCK), mcstuff.ShapeBlock(-1, 0, 1, block.WOOL.id, 8), mcstuff.ShapeBlock(0, 0, 1, block.WOOL.id, 3), mcstuff.ShapeBlock(1, 0, 1, block.WOOL.id, 8), mcstuff.ShapeBlock(3, -1, 1, block.IRON_BLOCK), mcstuff.ShapeBlock(-2, -1, 2, block.IRON_BLOCK), mcstuff.ShapeBlock(-1, 0, 2, block.WOOL.id, 8), mcstuff.ShapeBlock(0, 0, 2, block.IRON_BLOCK), mcstuff.ShapeBlock(1, 0, 2, block.WOOL.id, 8), mcstuff.ShapeBlock(2, -1, 2, block.IRON_BLOCK) ] #instantiate the x wing StarwarsCraft.__init__(self, xWingBlocks, pos)
def __init__(self, pos): #create the millenium falcon falconBlocks = [ mcstuff.ShapeBlock(-1, 0, -2, block.IRON_BLOCK), mcstuff.ShapeBlock(0, 0, -2, block.IRON_BLOCK), mcstuff.ShapeBlock(1, 0, -2, block.IRON_BLOCK), mcstuff.ShapeBlock(-2, 0, -1, block.IRON_BLOCK), mcstuff.ShapeBlock(-1, 0, -1, block.IRON_BLOCK), mcstuff.ShapeBlock(0, 1, -1, block.WOOL.id, 8), mcstuff.ShapeBlock(1, 0, -1, block.IRON_BLOCK), mcstuff.ShapeBlock(2, 0, -1, block.IRON_BLOCK), mcstuff.ShapeBlock(-3, 0, 0, block.IRON_BLOCK), mcstuff.ShapeBlock(-2, 0, 0, block.IRON_BLOCK), mcstuff.ShapeBlock(-1, 1, 0, block.WOOL.id, 8), mcstuff.ShapeBlock(0, 1, 0, block.WOOL.id, 8), mcstuff.ShapeBlock(1, 1, 0, block.WOOL.id, 8), mcstuff.ShapeBlock(2, 0, 0, block.IRON_BLOCK), mcstuff.ShapeBlock(3, 0, 0, block.IRON_BLOCK), mcstuff.ShapeBlock(-3, 0, 1, block.WOOL.id, 7), mcstuff.ShapeBlock(-2, 0, 1, block.IRON_BLOCK), mcstuff.ShapeBlock(-1, 0, 1, block.IRON_BLOCK), mcstuff.ShapeBlock(0, 1, 1, block.WOOL.id, 8), mcstuff.ShapeBlock(1, 0, 1, block.IRON_BLOCK), mcstuff.ShapeBlock(2, 0, 1, block.IRON_BLOCK), mcstuff.ShapeBlock(-3, 0, 2, block.WOOL.id, 7), mcstuff.ShapeBlock(-1, 0, 2, block.IRON_BLOCK), mcstuff.ShapeBlock(0, 0, 2, block.IRON_BLOCK), mcstuff.ShapeBlock(1, 0, 2, block.IRON_BLOCK), mcstuff.ShapeBlock(-1, 0, 3, block.IRON_BLOCK), mcstuff.ShapeBlock(1, 0, 3, block.IRON_BLOCK), mcstuff.ShapeBlock(-1, 0, 4, block.IRON_BLOCK), mcstuff.ShapeBlock(1, 0, 4, block.IRON_BLOCK), mcstuff.ShapeBlock(0, 0, -1, block.WOOL.id, 8), mcstuff.ShapeBlock(-1, 0, 0, block.WOOL.id, 8), mcstuff.ShapeBlock(0, 0, 0, block.WOOL.id, 8), mcstuff.ShapeBlock(1, 0, 0, block.WOOL.id, 8), mcstuff.ShapeBlock(0, 0, 1, block.WOOL.id, 8) ] #instantiate the falcon StarwarsCraft.__init__(self, falconBlocks, pos)
def __init__(self, pos): #create the tie fighter tieBlocks = [ mcstuff.ShapeBlock(0, 0, 0, block.IRON_BLOCK), mcstuff.ShapeBlock(-1, -1, -1, block.WOOL.id, 15), mcstuff.ShapeBlock(-1, -1, 0, block.WOOL.id, 15), mcstuff.ShapeBlock(-1, -1, 1, block.WOOL.id, 15), mcstuff.ShapeBlock(-1, 0, -1, block.WOOL.id, 15), mcstuff.ShapeBlock(-1, 0, 0, block.WOOL.id, 15), mcstuff.ShapeBlock(-1, 0, 1, block.WOOL.id, 15), mcstuff.ShapeBlock(-1, 1, -1, block.WOOL.id, 15), mcstuff.ShapeBlock(-1, 1, 0, block.WOOL.id, 15), mcstuff.ShapeBlock(-1, 1, 1, block.WOOL.id, 15), mcstuff.ShapeBlock(1, -1, -1, block.WOOL.id, 15), mcstuff.ShapeBlock(1, -1, 0, block.WOOL.id, 15), mcstuff.ShapeBlock(1, -1, 1, block.WOOL.id, 15), mcstuff.ShapeBlock(1, 0, -1, block.WOOL.id, 15), mcstuff.ShapeBlock(1, 0, 0, block.WOOL.id, 15), mcstuff.ShapeBlock(1, 0, 1, block.WOOL.id, 15), mcstuff.ShapeBlock(1, 1, -1, block.WOOL.id, 15), mcstuff.ShapeBlock(1, 1, 0, block.WOOL.id, 15), mcstuff.ShapeBlock(1, 1, 1, block.WOOL.id, 15), ] #instantiate the tie fighter StarwarsCraft.__init__(self, tieBlocks, pos)