Mega Jump
Introduction
Build a mod that lets you jump high… as high as you want!
Super Power Chat Command
Add a chat command named "jump"
.
def on_chat():
pass
player.on_chat("jump", on_chat)
Teleport the player
In the chat command event, teleport the player to a position that is 100
blocks higher than the current position.
def on_chat():
# @highlight
player.teleport(pos(0, 100, 0))
player.on_chat("jump", on_chat)
Use your slash command!
Go to Minecraft, type t to open the chat and enter jump.
Add a parameter to the slash command
Add a parameter variable to the chat command. Use the variable name num1
for the parameter. This will add a number parameter to the command.
# @highlight
def on_chat(num1):
player.teleport(pos(0, 100, 0))
player.on_chat("jump", on_chat)
Jump the amount entered by the user.
Instead of a number of 100
in the teleport position, use the num1
parameter so you will jump by the amount entered by the player.
def on_chat(num1):
# @highlight
player.teleport(pos(0, num1, 0))
player.on_chat("jump", on_chat)
Use your slash command!
Go to Minecraft and enter jump 50 in the chat. You should jump by 50 blocks instead of 100. Try jump 1000…