MC-Super_Jump.py
 1  # SPDX-FileCopyrightText: 2019 Mikey Sklar for Adafruit Industries
 2  #
 3  # SPDX-License-Identifier: MIT
 4  
 5  import time
 6  import board
 7  import mcpi.minecraft as minecraft
 8  from digitalio import DigitalInOut, Direction
 9  
10  mc = minecraft.Minecraft.create()
11  
12  pad_pin = board.D23
13  pad = DigitalInOut(pad_pin)
14  pad.direction = Direction.INPUT
15  
16  already_pressed = False
17  
18  while True:
19  
20      if pad.value and not already_pressed:
21          pos = mc.player.getPos()
22          x = pos.x
23          y = pos.y + 10
24          z = pos.z
25          mc.player.setPos(x, y, z)
26      alreadyPressed = pad.value
27      time.sleep(0.1)