Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #MINECRAFT
- # Get player's coordinates. Use x, y and z variables to do the exercises.
- position=player.position()
- x=position.get_value(Axis.X)
- y=position.get_value(Axis.Y)
- z=position.get_value(Axis.Z)
- # Exercise 1
- # Create an underwaterWorld function which will be called by using the "aquaman" command in chat.
- # After calling the function, the player should be locked in a huge water container made of GLASS and filled with WATER.
- # Use the blocks.fill() function.
- def underwaterWorld():
- #Creating a glass structure
- blocks.fill(GLASS, world(x-10,y-10,z-10),world(x+10,y+10,z+10))
- #puouring water
- blocks.fill(WATER, world(x-9,y-9,z-9),world(x+9,y+9,z+9))
- drowned(10)
- inventory()
- coral()
- player.on_chat("aquaman",underwaterWorld)
- # Exercise 2
- # Create a drowned function with numberOfDrowned parameter and call it in the underwaterWorld function.
- # When calling the function we should specify the number of drowned we want to spawn.
- # We will use the parameter in a for loop in a range() function.
- def drowned(numberOfDrowned):
- for i in range(numberOfDrowned):
- mobs.spawn(DROWNED, randpos(world(x-9,y-9,z-9),world(x+9,y+9,z+9)))
- # Exercise 3
- # Create an inventory function which will add a trident when calling the underwaterWorld function.
- # The trident is great for fighting underwater
- # Add spells which will improve the weapon
- # Unbreaking level 3 - increases durability of the weapon.
- # Channeling level 1 - During the storm, when hitting a mob, a lightning will hit them too.
- # Riptide level 3 - during rain, using the trident will get us fast transport.
- # Loyalty level 3 - the trident will come back to the player after they throw it.
- # Use functions like mobs.give() and mobs.enchant().
- # You can add other items useful in underwater combat.
- def inventory():
- mobs.give(mobs.target(NEAREST_PLAYER), TRIDENT, 1)
- mobs.enchant(mobs.target(NEAREST_PLAYER), "Unbreaking", 3)
- mobs.enchant(mobs.target(NEAREST_PLAYER), "Channeling", 1)
- mobs.enchant(mobs.target(NEAREST_PLAYER), "Loyalty", 3)
- # Exercise 4
- # Create a coral function and call it in the underwaterWorld after creating the water container.
- # Use blocks.place and randpos() to place different corals in random places. Use for loop, too.
- # Coral names: TUBE_CORAL, BRAIN_CORAL, BUBBLE_CORAL, FIRE_CORAL, BUBBLE_CORAL_FAN
- # You can use an array to do this exercise
- # In the coral function create a coralArray array and add different corals to it.
- # Using two for loops, get corals from the array and place them in random places.
- def coral():
- coralArray = [TUBE_CORAL, BRAIN_CORAL, BUBBLE_CORAL, FIRE_CORAL, BUBBLE_CORAL_FAN]
- for i in range(len(coralArray)):
- for j in range(10):
- blocks.place(coralArray[i], randpos(world(x-9,y-9,z-9),world(x+9,y-9,z+9)))
- # Exercise 5
- # The function changing the game mode
- # Create a gameMode function with the mode parameter. The function will be called in chat by writing 't' and giving a parameter 0 or 1.
- # When we put 0, the game should be in survival mode and the player should get breathing underwater effect.
- # When we put 1, the game should be switched to creative mode.
- # Use if elif conditional statements.
- # The name of the effect is WATER_BREATHING. Use it in the mobs.apply_effect function.
- def gameMode(mode):
- if mode == 0:
- gameplay.set_game_mode(SURVIVAL, mobs.target(NEAREST_PLAYER))
- mobs.apply_effect(WATER_BREATHING, mobs.target(NEAREST_PLAYER))
- elif mode == 1:
- gameplay.set_game_mode(CREATIVE, mobs.target(NEAREST_PLAYER))
- player.on_chat("m", gameMode)
Add Comment
Please, Sign In to add comment