Skip to content

Instantly share code, notes, and snippets.

@cbscribe
Created April 19, 2013 00:14
Show Gist options
  • Save cbscribe/5417196 to your computer and use it in GitHub Desktop.
Save cbscribe/5417196 to your computer and use it in GitHub Desktop.
clears everything above sea level, and makes everything below dirt
#written by Hiradur
#Replaces any block above sea level with air and every block beneath it with dirt
#to keep processing time short it only replaces blocks from above sea level to level 64
#if you built higher you have to change the parameter
#import minecraft.py module for interaction with the world
import minecraft.minecraft as minecraft
#import minecraft block module for block ids
import minecraft.block as block
#import time for delays
import time
if __name__ == "__main__":
#Connect to minecraft by creating a minecraft object
#(remember: minecraft needs to be running and in a game)
mc = minecraft.Minecraft.create()
mc.postToChat("terraforming... this will take a few minutes...")
mc.postToChat("minecraft will probably be unresponsive for this time.")
mc.postToChat("If you dont want your world to be erased you have 5 seconds to close the executing terminal.")
time.sleep(5)
mc.postToChat("Moving you to a safe position.")
time.sleep(1)
mc.player.setPos(0,70,0)
time.sleep(1)
mc.postToChat("Starting...")
time.sleep(1)
#Replace blocks above sea level with air blocks by creating a huge cuboid
#change fifth parameter to your heighest level
mc.setBlocks(-128, 0, -128, 128, 63, 128, block.AIR)
#Replace blocks beneath sea level with dirt blocks
mc.setBlocks(-128, -64, -128, 128, -2, 128, block.DIRT)
#Adding grass on top of dirt for a nicer look
mc.setBlocks(-128, -1, -128, 128, -1, 128, block.GRASS)
mc.postToChat("finally done!")
time.sleep(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment