def __init__(self, mc, pos): self.mc = mc self.pos = pos self.time = None self.cputemperature = None self.temperature = None self.humidity = None self.pressure = None self.orientation = {"yaw": 0, "pitch": 0, "roll": 0} self.joystick = { "up": 0, "down": 0, "left": 0, "right": 0, "button": 0 } #calculate the positions of the towers, iss, clock and stairs temppos = pos.clone() temppos.x += 2 humiditypos = pos.clone() humiditypos.x -= 2 pressurepos = pos.clone() pressurepos.z += 2 cputemppos = pos.clone() cputemppos.z -= 2 isspos = pos.clone() isspos.y += 40 clockpos = pos.clone() clockpos.x -= 30 clockpos.z -= 10 clockpos.y += 11 rocketpos = pos.clone() rocketpos.x += 15 rocketpos.z -= 10 stairspos = pos.clone() stairspos.z -= 5 #create the clock self.clock = Clock(mc, clockpos, block.WOOL.id, 11) #clear an area for the tubes self.mc.setBlocks(self.pos.x - 3, self.pos.y, self.pos.z - 3, self.pos.x + 3, self.pos.y + 20, self.pos.z + 3, block.AIR.id) #create the tubes self.tempTube = DisplayTube(mc, temppos, 20, 10, 40, block.LAVA.id) self.humidityTube = DisplayTube(mc, humiditypos, 20, 20, 50, block.WATER) self.pressureTube = DisplayTube(mc, pressurepos, 20, 950, 1050, block.OBSIDIAN) self.cputempTube = DisplayTube(mc, cputemppos, 20, 30, 50, block.WOOL.id, 14) #create the ISS self.iss = ISS(mc, isspos) #create the stairs self.stairs = Stairs(mc, stairspos, 6, 38, block.DIAMOND_BLOCK.id) #create the launch pad and rocket self.launchpad = LaunchPad(mc, rocketpos) self.rocket = Rocket(mc, rocketpos, cleararea=False)
x = cx + math.sin(math.radians(angle)) * radius y = cy + math.cos(math.radians(angle)) * radius return((int(x + 0.5),int(y + 0.5))) if __name__ == "__main__": mc = Minecraft.create() mc.postToChat("SpaceCRAFT - Minecraft Rocket Launch") mc.postToChat("Hit the launch pad") #create the rocket next to the player at ground level rocketPos = mc.player.getTilePos() rocketPos.x += 5 rocketPos.y = mc.getHeight(rocketPos.x, rocketPos.z) - 1 launchpad = LaunchPad(mc, rocketPos) rocket = Rocket(mc, rocketPos) try: #wait till the launch tnt is hit launch = False while not launch: for hit in mc.events.pollBlockHits(): shapeblockhit = launchpad.getShapeBlock( hit.pos.x, hit.pos.y, hit.pos.z) if shapeblockhit != None: if shapeblockhit.tag == "launch": launch = True