Hardware Reference
In-Depth Information
minecraftstuff.ShapeBlock(0,0,-1,block.WOOL.id, 5),
minecraftstuff.ShapeBlock(1,0,0,block.WOOL.id, 5),
minecraftstuff.ShapeBlock(0,0,1,block.WOOL.id, 5),
minecraftstuff.ShapeBlock( 0,-1,0,
block.GLOWSTONE_BLOCK.id),
minecraftstuff.ShapeBlock( 0,1,0,
block.GLOWSTONE_BLOCK.id)]
alienShape = minecraftstuff.MinecraftShape(mc, alienPos,
alienBlocks)
8.
Create a
while
loop, which will continue to loop while the mode is not
"mis-
sionaccomplished"
or to put it another way, will exit when the mode is
"missionaccomplished"
:
while mode != "missionaccomplished":
9.
Get the player's position each time around the loop:
playerPos = mc.player.getTilePos()
10.
The next section of code relates to the rules the program will use to decide what
to do next—if the mode is
"landing"
, set the alien target (where the alien
spaceship will travel to) to be above the player's position and set the mode to
"attack"
:
if mode == "landing":
mc.postToChat("<aliens> We dont come in peace - please
↩
panic")
alienTarget = playerPos.clone()
alienTarget.y = alienTarget.y + HOVER_HEIGHT
mode = "attack"
11.
Otherwise, if the mode is
"attack"
, check to see if the alien spaceship is above
the player. If it is, beam her inside the ship and set the mode to
"missionac-
complished"
. Otherwise, if the player has got away, set the alien target to be
the player's current position and post a taunt to the chat:
elif mode == "attack":
#check to see if the alien ship is above the player
if alienPos.x == playerPos.x and alienPos.z ==
↩
playerPos.z:
mc.postToChat("<aliens>We have you now!")
#create a room
mc.setBlocks(0,50,0,6,56,6,block.BEDROCK.id)