Created
January 1, 2014 02:56
-
-
Save Plastix/8204574 to your computer and use it in GitHub Desktop.
A mcedit filter used for making Minecraft maps work with the PGM 2.0 voidmatcher.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Silhouette.py - Casts a Silhouette of the map onto y=0 | |
# MCEdit Filter | |
# Made for use with PGM v2.0 Voidmatcher | |
# Made by khazhyk | |
import sys | |
inputs = ( | |
("Fill with","blocktype"), | |
) | |
displayName = "Silhouette" | |
def perform(level,box,options): | |
blockType = options["Fill with"].ID | |
sys.stdout.write("Hello "+str(box.minx)+" "+str(box.maxx)+" "+str(box.minz)+" "+str(box.maxz)+" "+str(box.maxy)) | |
for x in range(box.minx, box.maxx): | |
for z in range(box.minz, box.maxz): | |
foundblock = False | |
for y in range(box.maxy, -1, -1): # Loop Backwards from maxy to 0 | |
if level.blockAt(x,y,z) != 0: | |
foundblock = True | |
break # If we found one, we're done | |
if foundblock: # If we found a block in this column | |
if level.blockAt(x,0,z) == 0: # Only set the block if there isn't already one there. | |
level.setBlockAt(x,0,z,blockType) # Set the block | |
chunk = level.getChunk(x/16, z/16) | |
chunk.dirty = True | |
foundblock = False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment