Skip to content

Instantly share code, notes, and snippets.

@albertochiwas
Created October 14, 2016 22:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save albertochiwas/25c3b7735f2c14f39d031a66fbb98a3e to your computer and use it in GitHub Desktop.
Save albertochiwas/25c3b7735f2c14f39d031a66fbb98a3e to your computer and use it in GitHub Desktop.
# DROPPING BLOCKS AS YOU WALK
from mcpi.minecraft import Minecraft
from time import sleep
mc = Minecraft.create()
flower = 38
while True:
x, y, z = mc.player.getPos()
mc.setBlock(x, y, z, flower)
sleep(0.1)
# PLAN A FLOWER IF WE'RE STANDING INTO GRASS
if block_beneath == grass:
mc.setBlock(x, y, z, flower)
else:
mc.setBlock(x, y-1, z, grass)
# FLOWING LAVA
from mcpi.minecraft import Minecraft
from time import sleep
mc = Minecraft.create()
x, y, z = mc.player.getPos()
lava = 10
water = 8
air = 0
mc.setBlock(x+3, y+3, z, lava)
sleep(20)
mc.setBlock(x+3,y+5, z, water)
sleep(4)
mc.setBlock(x+3, y+5, z, air)
from mcpi.minecraft import Minecraft
mc = Minecraft.create()
mc.postToChat("Hello world")
pos = mc.player.getPos()
x, y, z = mc.player.getPos()
mc.player.setPos(x, y+100, z) # teleporting... jump
#set block
mc.setBlock(x+1, y, z, 1)
# Air: 0
# Block: 1
# Grass: 2
# Dirt: 3
mc.setBlock(x+1, y, z, 2)
from mcpi import block
mc.setBlock(x+3, y, z, block.STONE.id)
"""
WOOD_PLANKS
WATER_STATIONARY
GOLD_ORE
GOLD_BLOCK
DIAMOND_BLOCK
NETHER_REACTOR_CORE
"""
wool = 35
mc.setBlock(x, y, z, wool, 1)
wool = 35
mc.setBlock(x, y+1, z, wool, 31)
tnt = 46
mc.setBlock(x, y, z, tnt, 1)
# Multiple blocks
stone = 1
x, y, z = mc.player.getPos()
mc.setBlocks(x+1, y+1, z+1, x+11, y+11, z+11, stone)
tnt = 46
mc.setBlocks(x+1, y+1, z+1, x+11, y+11, z+11, tnt, 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment