def perform(level, box, options): fillBlock = options["Fill"] withBlock = options["With"] borderThickness = options["Boundary thickness"] orig = MCSchematic(shape=box.size, mats=level.materials) orig.copyBlocksFrom(level, box, (0,0,0)) orig.removeEntitiesInBox(orig.bounds) orig.removeTileEntitiesInBox(orig.bounds) a = orig.Blocks[:] != fillBlock.ID b = numpy.copy(a) for n in xrange(borderThickness): b[:] = a[:] b[ 1: , : , : ] |= a[ :-1, : , : ] b[ :-1, : , : ] |= a[ 1: , : , : ] b[ : , 1: , : ] |= a[ : , :-1, : ] b[ : , :-1, : ] |= a[ : , 1: , : ] b[ : , : , 1: ] |= a[ : , : , :-1] b[ : , : , :-1] |= a[ : , : , 1: ] a, b = b, a orig.Blocks[~a] = withBlock.ID level.copyBlocksFrom(orig, orig.bounds, box.origin, [withBlock.ID]) level.markDirtyBox(box)
def build(block_space): """ Build a blockspace into a schematic :param block_space: Blockspace :return: MCSchematic containing all the blocks described in the blockspace. """ # Create a schematic of the size of the blockspace. schematic = MCSchematic(shape=block_space.size) tile_entities_to_add = [] for block, location in block_space.packed_blocks.items(): # Create the actual block. if block.has_tile_entity: # Create the tile mcentity of the block, if it has one. tile_entity = translate(block, location, blockspace=block_space) tile_entities_to_add.append(tile_entity) schematic.setBlockAt(location[0], location[1], location[2], block.block_id) data_value = calculate_data_value(block) if data_value is not None: schematic.setBlockDataAt(location[0], location[1], location[2], data_value) for tile_entity in tile_entities_to_add: schematic.addTileEntity(tile_entity) return schematic
def perform(level, box, options): #level.markDirtyBox(box) Not needed method = "KingSupernova's ArmorStands" print '%s: Started at %s' % (method, time.ctime()) tags = ("Marker:1b,Invisible:1,Invulnerable:1,NoGravity:1," if options["Include Marker:1b,Invisible:1,Invulnerable:1,NoGravity:1"] else "") tags += options["Additional tags"] command_list = [] for (chunk, slices, point) in level.getChunkSlices(box): for e in chunk.TileEntities: x = e["x"].value y = e["y"].value z = e["z"].value if (x, y, z) in box: if e["id"].value == "Sign": if level.blockAt(x,y,z) == 68: data = level.blockDataAt(x,y,z) if data == 2: z += 1 elif data == 3: z += -1 elif data == 4: x += 1 elif data == 5: x += -1 try: name = json.loads(e["Text1"].value)["text"] + json.loads(e["Text2"].value)["text"] command = "/summon ArmorStand %s %s %s {CustomName:\"%s\",%s}" % (x,y,z, name, tags) print(command) for i in xrange(int(json.loads(e["Text4"].value)["text"])): command_list.append(command) except TypeError as error: print("Skipping sign at %s %s %s due to TypeError: %s" % (x,y,z, error)) schematic = MCSchematic((1,1,len(command_list)), mats = level.materials) for x_coord, command in enumerate(command_list): schematic.setBlockAt(0,0,x_coord,211) #211 is chain command block schematic.setBlockDataAt(0,0,x_coord,3) #3 = facing south schematic.TileEntities.append(cmdBlockTe(0,0,x_coord,command, not(options["Require redstone"]))) schematic_file = mcplatform.askSaveFile(mcplatform.lastSchematicsDir or mcplatform.schematicsDir, "Save Schematic As...", "", "Schematic\0*.schematic\0\0", ".schematic") if schematic_file == None: print "ERROR: No schematic filename provided!" return schematic.saveToFile(schematic_file) print '%s: Ended at %s' % (method, time.ctime())
def kv62sch(level, kv6, colourpalletscan): if kv6[0:8].decode('hex') != 'Kvxl': raise Exception("Not the correct file format") xdim = int(bytereverse(kv6, 4, 4), 16) ydim = int(bytereverse(kv6, 8, 4), 16) zdim = int(bytereverse(kv6, 12, 4), 16) count = int(bytereverse(kv6, 28, 4), 16) element = [] per = 10 pertem = 0 for block in range(count): element.append([ int(kv6[64 + 16 * block:16 * block + 66], 16), int(kv6[66 + 16 * block:16 * block + 68], 16), int(kv6[68 + 16 * block:16 * block + 70], 16), int(kv6[70 + 16 * block:16 * block + 72], 16), int(bytereverse(kv6, 8 * block + 36, 2), 16) ]) pertem += (1.0 / count) * 100.0 if pertem > per: print str(per) + '% read' per += 10 if count > 10000000: print 'NOTE: If you are importing a large file there may be a small wait before writing' xlist = [] for block in range(xdim): xlist.append(int(bytereverse(kv6, 32 + 8 * count + 4 * block, 4), 16)) xylist = [] for block in range(ydim * xdim): xylist.append( int(bytereverse(kv6, 32 + 8 * count + 4 * xdim + 2 * block, 2), 16)) tempids = [] for id in colourpalletscan: tempids.append([id[3], id[4]]) ColourPallet = colourpalletscan for id in DefaultColourPallet: if [id[3], id[4]] not in tempids: ColourPallet.append(id) # import inspect # try: # editor # except: # editor = inspect.stack()[1][0].f_locals.get('self', None).editor schematic = MCSchematic((xdim, zdim, ydim), mats=level.materials) per = 10 pertem = 0 x = 0 y = 0 elementno = 0 xslice = xlist[x] for xy in xylist: if y == ydim: x += 1 xslice = xlist[x] y = 0 for elmnt in range(xy): (block, damage) = closestMaterial(ColourPallet, element[elementno][2], element[elementno][1], element[elementno][0]) schematic.setBlockAt(x, zdim - element[elementno][4] - 1, y, block) schematic.setBlockDataAt(x, zdim - element[elementno][4] - 1, y, damage) pertem += (1.0 / count) * 100.0 if pertem > per: print str(per) + '% written' per += 10 elementno += 1 xslice -= 1 y += 1 editor.addCopiedSchematic(schematic)
def LargeHouse1(): e = MCSchematic(shape=(12, 7, 9), filename='') e._Blocks = [[[0, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0], [0, 4, 5, 5, 5, 5, 4, 0, 0, 0, 0, 0], [67, 4, 5, 5, 5, 5, 4, 2, 2, 3, 3, 3], [0, 4, 5, 5, 5, 5, 4, 3, 3, 3, 3, 3], [0, 4, 5, 5, 5, 5, 4, 3, 3, 3, 3, 3], [0, 4, 43, 43, 43, 5, 4, 3, 3, 3, 3, 3], [0, 4, 43, 43, 43, 5, 4, 4, 3, 3, 3, 3], [0, 4, 43, 43, 43, 5, 4, 3, 3, 3, 3, 2], [0, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3]], [[0, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0], [0, 4, 0, 0, 53, 5, 4, 0, 0, 0, 0, 0], [0, 64, 0, 0, 85, 53, 4, 85, 85, 85, 85, 85], [0, 4, 0, 0, 0, 0, 4, 0, 0, 0, 0, 85], [0, 4, 0, 0, 0, 0, 4, 0, 0, 0, 0, 85], [0, 4, 0, 0, 0, 0, 4, 0, 0, 0, 0, 85], [0, 4, 43, 43, 0, 0, 64, 0, 0, 0, 0, 85], [0, 4, 0, 0, 0, 0, 4, 0, 0, 0, 0, 85], [0, 4, 4, 4, 4, 4, 4, 85, 85, 85, 85, 85]], [[0, 4, 17, 102, 102, 17, 4, 0, 0, 0, 0, 0], [0, 5, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0], [0, 64, 0, 0, 72, 0, 102, 0, 0, 0, 0, 0], [0, 5, 0, 0, 0, 0, 102, 0, 0, 0, 0, 0], [0, 5, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0], [0, 102, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0], [0, 5, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0], [0, 5, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0], [0, 4, 17, 102, 102, 17, 4, 0, 0, 0, 0, 0]], [[53, 4, 4, 4, 4, 4, 4, 53, 0, 0, 0, 0], [53, 5, 0, 0, 0, 0, 5, 53, 0, 0, 0, 0], [53, 5, 50, 0, 0, 0, 5, 53, 0, 0, 0, 0], [53, 5, 0, 0, 0, 0, 5, 53, 0, 0, 0, 0], [53, 5, 0, 0, 0, 0, 5, 53, 0, 0, 0, 0], [53, 5, 0, 0, 0, 0, 5, 53, 0, 0, 0, 0], [53, 5, 0, 0, 0, 50, 5, 53, 0, 0, 0, 0], [53, 5, 0, 0, 0, 0, 5, 53, 0, 0, 0, 0], [53, 4, 4, 4, 4, 4, 4, 53, 0, 0, 0, 0]], [[0, 53, 5, 5, 5, 5, 53, 0, 0, 0, 0, 0], [0, 53, 5, 0, 0, 5, 53, 0, 0, 0, 0, 0], [0, 53, 5, 0, 0, 5, 53, 0, 0, 0, 0, 0], [0, 53, 5, 0, 0, 5, 53, 0, 0, 0, 0, 0], [0, 53, 5, 0, 0, 5, 53, 0, 0, 0, 0, 0], [0, 53, 5, 0, 0, 5, 53, 0, 0, 0, 0, 0], [0, 53, 5, 0, 0, 5, 53, 0, 0, 0, 0, 0], [0, 53, 5, 0, 0, 5, 53, 0, 0, 0, 0, 0], [0, 53, 5, 5, 5, 5, 53, 0, 0, 0, 0, 0]], [[0, 0, 53, 5, 5, 53, 0, 0, 0, 0, 0, 0], [0, 0, 53, 5, 5, 53, 0, 0, 0, 0, 0, 0], [0, 0, 53, 5, 5, 53, 0, 0, 0, 0, 0, 0], [0, 0, 53, 5, 5, 53, 0, 0, 0, 0, 0, 0], [0, 0, 53, 5, 5, 53, 0, 0, 0, 0, 0, 0], [0, 0, 53, 5, 5, 53, 0, 0, 0, 0, 0, 0], [0, 0, 53, 5, 5, 53, 0, 0, 0, 0, 0, 0], [0, 0, 53, 5, 5, 53, 0, 0, 0, 0, 0, 0], [0, 0, 53, 5, 5, 53, 0, 0, 0, 0, 0, 0]], [[0, 0, 0, 53, 53, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 53, 53, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 53, 53, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 53, 53, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 53, 53, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 53, 53, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 53, 53, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 53, 53, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 53, 53, 0, 0, 0, 0, 0, 0, 0]]] e.root_tag['Data'] = TAG_Byte_Array([[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 8, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]], [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]]]) return e
def perform(level, box, options): leaveBlock = options["Leave Only"] buf = MCSchematic(shape=box.size, mats=level.materials) buf.copyBlocksFrom(level, box, (0,0,0), [leaveBlock.ID]) level.copyBlocksFrom(buf, buf.bounds, box.origin) level.markDirtyBox(box)
def building(originalLevel, originalBox, options): b=range(4096) b.remove(0) # @CodeWarrior0 and @Wout12345 explained how to merge schematics level = originalLevel.extractSchematic(originalBox) # Working set width = originalBox.width height = originalBox.height depth = originalBox.length box = BoundingBox((0,0,0),(width,height,depth)) materials = [getBlockFromOptions(options,"WALL:"), getBlockFromOptions(options,"GLASS:"), getBlockFromOptions(options,"FACADE VERTICAL:"), getBlockFromOptions(options,"FACADE HORIZONTAL:"), ] # Ground Floor # Windows - need to be consistent Fwidth = Factorise(width>>1) PreferredWidth = Fwidth[randint(0,(len(Fwidth)-1)>>2)] if PreferredWidth < 6: PreferredWidth = 6 if PreferredWidth > 12: PreferredWidth = 12 Fheight = Factorise(height) PreferredHeight = Fheight[randint(0,(len(Fheight)-1)>>2)] if PreferredHeight < 8: PreferredHeight = 8 # Face of the building facadePart = 1 facadeHeightCursor = 0 facadeDepthCursor = 0 scale = randint(1,5) originalFacadeDepth = 0 while facadeHeightCursor < height: # Build the face of the building facadeHeight = (1+(facadePart-1)*scale)*randint(8,32) # How tall should this bit be? if facadeHeightCursor+facadeHeight >= height: facadeHeight = height-facadeHeightCursor # Truncate the top section to the box height print facadeHeight,facadeHeightCursor facadeDepth = randint(2,4) if facadeDepth > depth: facadeDepth = depth if facadePart == 1: originalFacadeDepth = facadeDepth FACADE = facadeSection(materials,(width-(facadeDepth<<1)-facadeDepthCursor,facadeHeight,facadeDepth),(PreferredWidth,facadeHeight-2)) else: FACADE = facadeSection(materials,(width-(facadeDepth<<1)-facadeDepthCursor,facadeHeight,facadeDepth),(PreferredWidth,PreferredHeight)) # print FACADE, level, facadeDepthCursor print facadeHeight,facadeHeightCursor, FACADE level.copyBlocksFrom(FACADE, BoundingBox((0,0,0),(FACADE.Width,FACADE.Height-1,FACADE.Length)), (box.minx+facadeDepth+facadeDepthCursor,box.miny+facadeHeightCursor,box.maxz-1-facadeDepthCursor-facadeDepth)) print facadeHeight,facadeHeightCursor, FACADE, level facadeDepthCursor += 1 #facadeDepth facadePart +=1 facadeHeightCursor += facadeHeight # Verticals if randint(1,100) > 60: # Verticals all the way up for x in xrange(facadeDepthCursor,width>>1): depthhere = randint(0,depth) if x%PreferredWidth == 0: for z in xrange(1,depthhere): shapeFill(level,materials[2%len(materials)],(x,0,level.Length-facadeDepthCursor-1),(x,height,level.Length-1)) shapeFill(level,materials[2%len(materials)],(width-1-x,0,level.Length-facadeDepthCursor-1),(width-1-x,height,level.Length-1-facadeDepthCursor+depthhere)) FACADE = level.extractSchematic(BoundingBox((0,0,box.maxz-1-facadeDepthCursor-originalFacadeDepth),(box.maxx,box.maxy,box.maxz-(box.maxz-1-facadeDepthCursor-originalFacadeDepth)))) FACADE.flipEastWest() level.copyBlocksFrom(FACADE, BoundingBox((0,0,0),(FACADE.Width,FACADE.Height,FACADE.Length)), (box.minx, box.miny, box.minz),b) FACADE = level.extractSchematic(BoundingBox((0,0,0),(box.maxx,box.maxy,box.maxz))) FACADE.rotateLeft() level.copyBlocksFrom(FACADE, BoundingBox((0,0,0),(FACADE.Width,FACADE.Height,FACADE.Length)), (box.minx, box.miny, box.minz),b) shapeFill(level,materials[0%len(materials)],(0,0,0),(level.Width-1,0,level.Length-1)) # Ground floor p1 = (box.minx+facadeDepthCursor+originalFacadeDepth,height-5,box.minz+facadeDepthCursor+originalFacadeDepth) p2 = (width-1-1*(facadeDepthCursor+originalFacadeDepth),height-3,depth-1-1*(facadeDepthCursor+originalFacadeDepth)) # print p1,p2, facadeHeightCursor,height,level shapeFill(level,materials[0%len(materials)],p1,p2) # Roof buttressHeight = randint(height>>1,height) buttress = MCSchematic(shape=(facadeDepthCursor+originalFacadeDepth+1,buttressHeight,facadeDepthCursor+originalFacadeDepth+1)) shapeFill(buttress,materials[2%len(materials)],(0,0,0),(buttress.Width,buttress.Height,buttress.Length)) level.copyBlocksFrom(buttress, BoundingBox((0,0,0),(buttress.Width,buttress.Height,buttress.Length)),(0,0,0)) level.copyBlocksFrom(buttress, BoundingBox((0,0,0),(buttress.Width,buttress.Height,buttress.Length)),(level.Width-1-buttress.Width,0,0)) level.copyBlocksFrom(buttress, BoundingBox((0,0,0),(buttress.Width,buttress.Height,buttress.Length)),(level.Width-1-buttress.Width,0,level.Length-1-buttress.Length)) level.copyBlocksFrom(buttress, BoundingBox((0,0,0),(buttress.Width,buttress.Height,buttress.Length)),(0,0,level.Length-1-buttress.Length)) originalLevel.copyBlocksFrom(level, box, (originalBox.minx, originalBox.miny, originalBox.minz ),b)
def Expand(level, box, options): # I pulled the connected-block scan code from my SELECTOR filter method = "Expand" (method, (width, height, depth), (centreWidth, centreHeight, centreDepth)) = FuncStart(level, box, options, method) AIR = (0, 0) DIAGONAL = True #GAP = options["Scale"] # Save - because I am a destructive beast SAVED = level.extractSchematic( box) # Best I can do is save the selection and restore it later # Scan through the selection box. Find all the connected blocks of the same type and create new schematics with only those blocks. # Find the largest dimension. We need it for a scratchpad to track progress. SIZE = width if depth > SIZE: SIZE = depth if height > SIZE: SIZE = height trackx = SIZE # Centre of the tracking schematic tracky = SIZE trackz = SIZE Components = [] print 'Looking for connected sets of blocks...' for iterY in xrange(0, height): for iterZ in xrange(0, depth): for iterX in xrange(0, width): (matBlock, matID) = getBlock(level, box.minx + iterX, box.miny + iterY, box.minz + iterZ) if ( matBlock, matID ) != AIR: # Something to work with, scan the surroundings for connected blocks of the same type, and if found then build out a connected graph of blocks print 'Connecting blocks from %s %s %s' % (iterX, iterY, iterZ) # Find all of the connected blocks WORKING = MCSchematic( (2 * SIZE, 2 * SIZE, 2 * SIZE )) # temp - track progress finding connected blocks. minx = width - 1 # Track extremities, we'll blit out these blocks later. miny = height - 1 minz = depth - 1 maxx = 0 maxy = 0 maxz = 0 Q = [] Q.append((iterX, iterY, iterZ)) numBlocks = 0 (px, py, pz) = (0, 0, 0) while len(Q) > 0: (x, y, z) = Q.pop() print 'Checking block %s %s %s for Block %s' % ( x, y, z, matBlock) tx = trackx + x ty = tracky + y tz = trackz + z ((block, ID), NBT) = getBlockWithNBT(level, box.minx + x, box.miny + y, box.minz + z) #(block,ID) = getBlock(level,box.minx+x,box.miny+y,box.minz+z) # print '...found Block %s' % (block) if block == matBlock: # print 'Block %s matches %s at %s %s %s' % (block, matBlock, x,y,z) if getBlock(WORKING, tx, ty, tz) == AIR: numBlocks += 1 setBlockWithNBT( WORKING, (matBlock, matID), NBT, int(tx), int(ty), int(tz)) # Mark this block as 'traversed' #setBlock(WORKING, (matBlock,matID), int(tx), int(ty), int(tz)) # Mark this block as 'traversed' setBlock(level, AIR, box.minx + x, box.miny + y, box.minz + z) # erase the source block (px, py, pz) = (px + tx, py + ty, pz + tz) if x < minx: minx = x if y < miny: miny = y if z < minz: minz = z if x > maxx: maxx = x if y > maxy: maxy = y if z > maxz: maxz = z Q.append((x - 1, y, z)) Q.append((x + 1, y, z)) Q.append((x, y - 1, z)) Q.append((x, y + 1, z)) Q.append((x, y, z - 1)) Q.append((x, y, z + 1)) if DIAGONAL == True: Q.append((x, y - 1, z - 1)) Q.append((x - 1, y, z - 1)) Q.append((x - 1, y - 1, z)) Q.append((x, y + 1, z + 1)) Q.append((x + 1, y, z + 1)) Q.append((x + 1, y + 1, z)) Q.append((x, y + 1, z - 1)) Q.append((x + 1, y, z - 1)) Q.append((x + 1, y - 1, z)) Q.append((x, y - 1, z + 1)) Q.append((x - 1, y, z + 1)) Q.append((x - 1, y + 1, z)) Q.append((x - 1, y - 1, z - 1)) Q.append((x - 1, y - 1, z + 1)) Q.append((x - 1, y + 1, z - 1)) Q.append((x - 1, y + 1, z + 1)) Q.append((x + 1, y - 1, z - 1)) Q.append((x + 1, y - 1, z + 1)) Q.append((x + 1, y + 1, z - 1)) Q.append((x + 1, y + 1, z + 1)) # Finished scanning - I now have a set of the connected blocks. Blit it out into a new schematic and store it in a queue snipBox = BoundingBox( (SIZE + minx, SIZE + miny, SIZE + minz), (SIZE + maxx + 1, SIZE + maxy + 1, SIZE + maxz + 1)) snipSchematic = WORKING.extractSchematic(snipBox) Components.append( (snipSchematic, BoundingBox((0, 0, 0), (maxx - minx + 1, maxy - miny + 1, maxz - minz + 1)), (maxx - minx + 1, maxy - miny + 1, maxz - minz + 1), miny, numBlocks, (px / numBlocks, py / numBlocks, pz / numBlocks))) print 'Drawing components I found...' # Now I have a set of Components. Where to draw them? b = range(4096) b.remove( 0) # @CodeWarrior0 and @Wout12345 explained how to merge schematics startX = width startY = height distance = SIZE angle = pi ANGLES = options["Angles"] for (P, bx, (w, h, d), y, blockCount, (comx, comy, comz)) in Components: if blockCount >= options["Blocks"]: # Only plot objects above this size #startX += GAP #startY += GAP #distance = sqrt(comx*comx + comz*comz + comy*comy) #+randint(10,50) #print 'Component %s %s %s Centre of Mass %s %s %s, %s' % (P,bx,w,comx,comy,comz,distance) #horizangle = atan2(comz,comx) #(newposx,newposz) = (distance*cos(horizangle),distance*sin(horizangle)) (newposx, newposz) = (distance * cos(angle), distance * sin(angle)) level.copyBlocksFrom(P, bx, (box.minx + int(newposx), box.miny + y, box.minz + int(newposz)), b) #print 'Copied component to %s %s %s' % (box.minx+startX, box.miny, box.minz ) #startX += w #startY += h angle += 2 * pi / ANGLES distance += SIZE / ANGLES level.copyBlocksFrom(SAVED, BoundingBox((0, 0, 0), (width, height, depth)), (box.minx, box.miny, box.minz), b) FuncEnd(level, box, options, method) # Log end
def makeBlankAreaOfSizeWHD(width, height, depth): return MCSchematic((width, height, depth))
def library(): e = MCSchematic(shape=(9, 9, 8), filename='') e._Blocks = [[[0, 0, 0, 0, 0, 0, 0, 0, 0], [4, 4, 4, 4, 4, 4, 4, 4, 4], [4, 4, 4, 4, 4, 4, 4, 4, 4], [4, 4, 4, 4, 4, 4, 4, 4, 4], [4, 4, 4, 4, 4, 4, 4, 4, 4], [4, 4, 4, 4, 4, 4, 4, 4, 4], [4, 4, 4, 4, 4, 4, 4, 4, 4], [0, 67, 0, 0, 0, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 0, 0, 0, 0], [4, 4, 4, 4, 4, 4, 4, 4, 4], [4, 0, 0, 53, 53, 53, 53, 5, 4], [4, 0, 0, 0, 85, 0, 85, 53, 4], [4, 0, 0, 0, 0, 0, 0, 0, 4], [4, 0, 0, 0, 0, 0, 0, 58, 4], [4, 64, 4, 4, 4, 4, 4, 4, 4], [0, 0, 0, 0, 0, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 0, 0, 0, 0], [4, 5, 102, 102, 5, 102, 102, 5, 4], [5, 0, 0, 0, 0, 0, 0, 0, 5], [102, 0, 0, 0, 72, 0, 72, 0, 102], [102, 0, 0, 0, 0, 0, 0, 0, 102], [5, 0, 0, 0, 0, 0, 0, 0, 5], [4, 64, 5, 5, 102, 102, 102, 5, 4], [0, 0, 0, 0, 0, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 0, 0, 0, 0], [4, 5, 5, 5, 5, 5, 5, 5, 4], [5, 47, 47, 47, 47, 47, 47, 47, 5], [102, 0, 0, 0, 0, 0, 0, 0, 102], [102, 0, 0, 0, 0, 0, 0, 0, 102], [5, 0, 0, 0, 0, 0, 0, 0, 5], [4, 5, 5, 5, 102, 102, 102, 5, 4], [0, 0, 0, 0, 0, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 0, 0, 0, 0], [4, 5, 5, 5, 5, 5, 5, 5, 4], [5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 0, 0, 0, 0, 0, 0, 0, 5], [5, 0, 0, 0, 0, 0, 0, 0, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5], [4, 5, 5, 5, 5, 5, 5, 5, 4], [0, 0, 0, 0, 0, 0, 0, 0, 0]], [[53, 53, 53, 53, 53, 53, 53, 53, 53], [4, 4, 4, 4, 4, 4, 4, 4, 4], [4, 4, 4, 4, 4, 4, 4, 4, 4], [4, 4, 4, 4, 4, 4, 4, 4, 4], [4, 4, 4, 4, 4, 4, 4, 4, 4], [4, 4, 4, 4, 4, 4, 4, 4, 4], [4, 4, 4, 4, 4, 4, 4, 4, 4], [53, 53, 53, 53, 53, 53, 53, 53, 53]], [[0, 0, 0, 0, 0, 0, 0, 0, 0], [53, 53, 53, 53, 53, 53, 53, 53, 53], [4, 4, 4, 4, 4, 4, 4, 4, 4], [4, 4, 4, 4, 4, 4, 4, 4, 4], [4, 4, 4, 4, 4, 4, 4, 4, 4], [4, 4, 4, 4, 4, 4, 4, 4, 4], [53, 53, 53, 53, 53, 53, 53, 53, 53], [0, 0, 0, 0, 0, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [53, 53, 53, 53, 53, 53, 53, 53, 53], [4, 4, 4, 4, 4, 4, 4, 4, 4], [4, 4, 4, 4, 4, 4, 4, 4, 4], [53, 53, 53, 53, 53, 53, 53, 53, 53], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [53, 53, 53, 53, 53, 53, 53, 53, 53], [53, 53, 53, 53, 53, 53, 53, 53, 53], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]] e.root_tag['Data'] = TAG_Byte_Array([[[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 3, 0, 0, 0, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 3, 3, 3, 3, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 8, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]], [[2, 2, 2, 2, 2, 2, 2, 2, 2], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [3, 3, 3, 3, 3, 3, 3, 3, 3]], [[0, 0, 0, 0, 0, 0, 0, 0, 0], [2, 2, 2, 2, 2, 2, 2, 2, 2], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [3, 3, 3, 3, 3, 3, 3, 3, 3], [0, 0, 0, 0, 0, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [2, 2, 2, 2, 2, 2, 2, 2, 2], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [3, 3, 3, 3, 3, 3, 3, 3, 3], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [2, 2, 2, 2, 2, 2, 2, 2, 2], [3, 3, 3, 3, 3, 3, 3, 3, 3], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]]) return e
def library(): e = MCSchematic(shape=(9,9,8),filename='') e._Blocks = [[[0,0,0,0,0,0,0,0,0],[4,4,4,4,4,4,4,4,4],[4,4,4,4,4,4,4,4,4],[4,4,4,4,4,4,4,4,4],[4,4,4,4,4,4,4,4,4],[4,4,4,4,4,4,4,4,4],[4,4,4,4,4,4,4,4,4],[0,67,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0,0],[4,4,4,4,4,4,4,4,4],[4,0,0,53,53,53,53,5,4],[4,0,0,0,85,0,85,53,4],[4,0,0,0,0,0,0,0,4],[4,0,0,0,0,0,0,58,4],[4,64,4,4,4,4,4,4,4],[0,0,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0,0],[4,5,102,102,5,102,102,5,4],[5,0,0,0,0,0,0,0,5],[102,0,0,0,72,0,72,0,102],[102,0,0,0,0,0,0,0,102],[5,0,0,0,0,0,0,0,5],[4,64,5,5,102,102,102,5,4],[0,0,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0,0],[4,5,5,5,5,5,5,5,4],[5,47,47,47,47,47,47,47,5],[102,0,0,0,0,0,0,0,102],[102,0,0,0,0,0,0,0,102],[5,0,0,0,0,0,0,0,5],[4,5,5,5,102,102,102,5,4],[0,0,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0,0],[4,5,5,5,5,5,5,5,4],[5,5,5,5,5,5,5,5,5],[5,0,0,0,0,0,0,0,5],[5,0,0,0,0,0,0,0,5],[5,5,5,5,5,5,5,5,5],[4,5,5,5,5,5,5,5,4],[0,0,0,0,0,0,0,0,0]],[[53,53,53,53,53,53,53,53,53],[4,4,4,4,4,4,4,4,4],[4,4,4,4,4,4,4,4,4],[4,4,4,4,4,4,4,4,4],[4,4,4,4,4,4,4,4,4],[4,4,4,4,4,4,4,4,4],[4,4,4,4,4,4,4,4,4],[53,53,53,53,53,53,53,53,53]],[[0,0,0,0,0,0,0,0,0],[53,53,53,53,53,53,53,53,53],[4,4,4,4,4,4,4,4,4],[4,4,4,4,4,4,4,4,4],[4,4,4,4,4,4,4,4,4],[4,4,4,4,4,4,4,4,4],[53,53,53,53,53,53,53,53,53],[0,0,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[53,53,53,53,53,53,53,53,53],[4,4,4,4,4,4,4,4,4],[4,4,4,4,4,4,4,4,4],[53,53,53,53,53,53,53,53,53],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[53,53,53,53,53,53,53,53,53],[53,53,53,53,53,53,53,53,53],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0]]] e.root_tag['Data'] = TAG_Byte_Array([[[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,3,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,3,3,3,3,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,1,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,8,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0]],[[2,2,2,2,2,2,2,2,2],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[3,3,3,3,3,3,3,3,3]],[[0,0,0,0,0,0,0,0,0],[2,2,2,2,2,2,2,2,2],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[3,3,3,3,3,3,3,3,3],[0,0,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[2,2,2,2,2,2,2,2,2],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[3,3,3,3,3,3,3,3,3],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[2,2,2,2,2,2,2,2,2],[3,3,3,3,3,3,3,3,3],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0]]]) return e
def houseOne(): e = MCSchematic(shape=(5,5,6),filename='') e._Blocks = [[[4,4,4,4,4],[4,4,4,4,4],[4,4,4,4,4],[4,4,4,4,4],[4,4,4,4,4],[0,0,67,0,0]],[[4,5,5,5,4],[5,0,0,0,5],[5,0,0,0,5],[5,0,0,0,5],[4,5,0,5,4],[0,0,0,0,0]],[[4,5,102,5,4],[5,0,0,0,5],[102,0,0,0,102],[5,0,0,0,5],[4,5,0,5,4],[0,0,0,0,0]],[[4,5,5,5,4],[5,0,0,0,5],[5,0,0,0,5],[5,0,50,0,5],[4,5,5,5,4],[0,0,0,0,0]],[[17,17,17,17,17],[17,5,5,5,17],[17,5,5,5,17],[17,5,5,5,17],[17,17,17,17,17],[0,0,0,0,0]]] e.root_tag['Data'] = TAG_Byte_Array([[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,3,0,0]],[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,4,0,0],[0,0,0,0,0],[0,0,0,0,0]],[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]]]) return e
""" Holds the Screen schematics """ from pymclevel import MCSchematic from pkg_resources import resource_filename from cbac.schematics.common import RESOURCE_MODULE BLACK_SCREEN_128x128 = MCSchematic( filename=resource_filename(RESOURCE_MODULE, 'screen_128x128.schematic'))
def SchematicBlockSwap(level, box, options): method = "SchematicBlockSwap" (method, (width, height, depth), (centreWidth, centreHeight, centreDepth)) = FuncStart(level, box, options, method) AIR = (0, 0) DIRPATH = options["Schematic Folder:"] print 'Scanning available schematics...' SchematicFileNames = glob.glob(DIRPATH + "/*.schematic") for fileName in SchematicFileNames: print fileName print 'Found %s schematic files' % (len(SchematicFileNames)) # End cached file names blockIDList = [] for a in blockIDListWood: blockIDList.append(a) for a in blockIDListLeaf: blockIDList.append(a) for fn in SchematicFileNames: print 'Loading schematic from file - %s' % (fn) sourceSchematic = MCSchematic(filename=fn) (x, y, z) = sourceSchematic.size theBox = BoundingBox((0, 0, 0), (x, y, z)) #level.fillBlocks(box, level.materials[mapToList[i]], [level.materials[x]]) print 'Marking patterns' P = [] for (b, d) in blockIDList: print 'Finding the pattern for block ID ' + str( b) + ' data ' + str(d) pattern = MCSchematic((x, y, z)) empty = True for iterY in xrange(0, y): for iterZ in xrange(0, z): for iterX in xrange(0, x): (b1, d1) = getBlock(sourceSchematic, iterX, iterY, iterZ) if (b1, d1) == ( b, d): # if this block is of the required type setBlock( pattern, (b1, d1), iterX, iterY, iterZ ) # change all the copies of the model to have the empty = False if empty == False: P.append((b, d, pattern)) # Now we have pattern schemas, we need to combine them in interesting ways. print 'Merging patterns with block type variants - wood' Q = [] for (b1, d1, pattern1) in P: for (m, n) in blockIDListWood: blendedPattern = sourceSchematic.extractSchematic(theBox) for iterY in xrange(0, y): #print iterY for iterZ in xrange(0, z): for iterX in xrange(0, x): (e, f) = getBlock(pattern1, iterX, iterY, iterZ) if (e, f) != AIR: setBlock(blendedPattern, (m, n), iterX, iterY, iterZ) Q.append((b1, d1, m, n, blendedPattern)) # produces a bunch of R = [] print 'Merging patterns with block type variants - leaves' for (b1, d1, b2, d2, pattern) in Q: print fn + "_Block_" + str(b1) + "_Data_" + str( d1) + "_Block_" + str(b2) + "_Data_" + str(d2) for (m, n) in blockIDListLeaf: for (o, p) in blockIDListLeaf: newPattern = pattern.extractSchematic(theBox) changed = False for iterY in xrange(0, y): #print iterY for iterZ in xrange(0, z): for iterX in xrange(0, x): (e, f) = getBlock(pattern, iterX, iterY, iterZ) if (e, f) == (m, n): setBlock(newPattern, (o, p), iterX, iterY, iterZ) changed = True if changed == True: R.append((b2, d2, o, p, newPattern)) for (b1, d1, b2, d2, newSchematic) in R: # Write out the variant schematic files. filename = fn + "_Block_" + str(b1) + "_Data_" + str( d1) + "_Block_" + str(b2) + "_Data_" + str(d2) + ".schematic" newSchematic.saveToFile(filename) FuncEnd(level, box, options, method)
def createSchematic(): e = MCSchematic(shape=(8,2,7),filename='') e._Blocks = [[[137,0,137,137,137,137,137,137],[137,0,137,137,137,137,137,137],[137,159,137,137,137,137,137,137],[137,0,137,137,137,137,137,137],[0,0,0,137,137,137,137,137],[0,0,0,137,137,137,137,137],[0,0,0,137,137,137,137,137]],[[55,0,55,55,55,55,55,55],[55,0,55,55,55,55,55,55],[55,55,55,55,55,55,55,55],[55,0,55,55,55,55,55,55],[0,0,0,55,55,55,55,55],[0,0,0,55,55,55,55,55],[0,0,0,55,55,55,55,55]]] e.root_tag['TileEntities'] = TAG_List([ TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,85f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(0), "y": TAG_Int(0), "z": TAG_Int(1), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,280f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(3), "y": TAG_Int(0), "z": TAG_Int(1), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,350f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(2), "y": TAG_Int(0), "z": TAG_Int(1), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,140f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(5), "y": TAG_Int(0), "z": TAG_Int(1), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,250f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(4), "y": TAG_Int(0), "z": TAG_Int(1), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,10f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(7), "y": TAG_Int(0), "z": TAG_Int(1), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,110f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(6), "y": TAG_Int(0), "z": TAG_Int(1), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,130f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(5), "y": TAG_Int(0), "z": TAG_Int(0), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,120f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(6), "y": TAG_Int(0), "z": TAG_Int(0), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,270f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(3), "y": TAG_Int(0), "z": TAG_Int(0), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,260f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(4), "y": TAG_Int(0), "z": TAG_Int(0), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,0f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(7), "y": TAG_Int(0), "z": TAG_Int(0), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,340f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(2), "y": TAG_Int(0), "z": TAG_Int(0), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,-5f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(0), "y": TAG_Int(0), "z": TAG_Int(0), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,70f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(6), "y": TAG_Int(0), "z": TAG_Int(5), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,50f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(7), "y": TAG_Int(0), "z": TAG_Int(5), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,310f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(3), "y": TAG_Int(0), "z": TAG_Int(4), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,220f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(4), "y": TAG_Int(0), "z": TAG_Int(4), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,170f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(5), "y": TAG_Int(0), "z": TAG_Int(4), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,80f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(6), "y": TAG_Int(0), "z": TAG_Int(4), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,100f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(6), "y": TAG_Int(0), "z": TAG_Int(2), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,265f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(0), "y": TAG_Int(0), "z": TAG_Int(3), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,150f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(5), "y": TAG_Int(0), "z": TAG_Int(2), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,360f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(2), "y": TAG_Int(0), "z": TAG_Int(3), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,300f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(3), "y": TAG_Int(0), "z": TAG_Int(3), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,20f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(7), "y": TAG_Int(0), "z": TAG_Int(2), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,360f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(2), "y": TAG_Int(0), "z": TAG_Int(2), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,230f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(4), "y": TAG_Int(0), "z": TAG_Int(3), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,160f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(5), "y": TAG_Int(0), "z": TAG_Int(3), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,40f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(7), "y": TAG_Int(0), "z": TAG_Int(4), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,240f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(4), "y": TAG_Int(0), "z": TAG_Int(2), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,90f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(6), "y": TAG_Int(0), "z": TAG_Int(3), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,30f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(7), "y": TAG_Int(0), "z": TAG_Int(3), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,290f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(3), "y": TAG_Int(0), "z": TAG_Int(2), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,175f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(0), "y": TAG_Int(0), "z": TAG_Int(2), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,180f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(5), "y": TAG_Int(0), "z": TAG_Int(5), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,210f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(4), "y": TAG_Int(0), "z": TAG_Int(5), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,320f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(3), "y": TAG_Int(0), "z": TAG_Int(5), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,330f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(3), "y": TAG_Int(0), "z": TAG_Int(6), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,200f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(4), "y": TAG_Int(0), "z": TAG_Int(6), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,50f]}s'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.tagError","with":["Unable to locate ending bracket for: {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,50f]}s"]}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(7), "y": TAG_Int(0), "z": TAG_Int(6), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,60f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(6), "y": TAG_Int(0), "z": TAG_Int(6), }), TAG_Compound({ "Command": TAG_String(u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,190f]}'), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String(u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}'), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(5), "y": TAG_Int(0), "z": TAG_Int(6), }), ]) e.root_tag['Data'] = TAG_Byte_Array([[[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,5,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0]]]) return e
def createSchematic(): e = MCSchematic(shape=(8, 2, 7), filename='') e._Blocks = [[[137, 0, 137, 137, 137, 137, 137, 137], [137, 0, 137, 137, 137, 137, 137, 137], [137, 159, 137, 137, 137, 137, 137, 137], [137, 0, 137, 137, 137, 137, 137, 137], [0, 0, 0, 137, 137, 137, 137, 137], [0, 0, 0, 137, 137, 137, 137, 137], [0, 0, 0, 137, 137, 137, 137, 137]], [[55, 0, 55, 55, 55, 55, 55, 55], [55, 0, 55, 55, 55, 55, 55, 55], [55, 55, 55, 55, 55, 55, 55, 55], [55, 0, 55, 55, 55, 55, 55, 55], [0, 0, 0, 55, 55, 55, 55, 55], [0, 0, 0, 55, 55, 55, 55, 55], [0, 0, 0, 55, 55, 55, 55, 55]]] e.root_tag['TileEntities'] = TAG_List([ TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,85f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(0), "y": TAG_Int(0), "z": TAG_Int(1), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,280f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(3), "y": TAG_Int(0), "z": TAG_Int(1), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,350f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(2), "y": TAG_Int(0), "z": TAG_Int(1), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,140f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(5), "y": TAG_Int(0), "z": TAG_Int(1), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,250f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(4), "y": TAG_Int(0), "z": TAG_Int(1), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,10f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(7), "y": TAG_Int(0), "z": TAG_Int(1), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,110f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(6), "y": TAG_Int(0), "z": TAG_Int(1), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,130f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(5), "y": TAG_Int(0), "z": TAG_Int(0), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,120f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(6), "y": TAG_Int(0), "z": TAG_Int(0), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,270f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(3), "y": TAG_Int(0), "z": TAG_Int(0), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,260f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(4), "y": TAG_Int(0), "z": TAG_Int(0), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,0f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(7), "y": TAG_Int(0), "z": TAG_Int(0), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,340f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(2), "y": TAG_Int(0), "z": TAG_Int(0), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,-5f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(0), "y": TAG_Int(0), "z": TAG_Int(0), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,70f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(6), "y": TAG_Int(0), "z": TAG_Int(5), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,50f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(7), "y": TAG_Int(0), "z": TAG_Int(5), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,310f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(3), "y": TAG_Int(0), "z": TAG_Int(4), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,220f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(4), "y": TAG_Int(0), "z": TAG_Int(4), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,170f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(5), "y": TAG_Int(0), "z": TAG_Int(4), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,80f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(6), "y": TAG_Int(0), "z": TAG_Int(4), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,100f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(6), "y": TAG_Int(0), "z": TAG_Int(2), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,265f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(0), "y": TAG_Int(0), "z": TAG_Int(3), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,150f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(5), "y": TAG_Int(0), "z": TAG_Int(2), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,360f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(2), "y": TAG_Int(0), "z": TAG_Int(3), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,300f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(3), "y": TAG_Int(0), "z": TAG_Int(3), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,20f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(7), "y": TAG_Int(0), "z": TAG_Int(2), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,360f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(2), "y": TAG_Int(0), "z": TAG_Int(2), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,230f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(4), "y": TAG_Int(0), "z": TAG_Int(3), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,160f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(5), "y": TAG_Int(0), "z": TAG_Int(3), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,40f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(7), "y": TAG_Int(0), "z": TAG_Int(4), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,240f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(4), "y": TAG_Int(0), "z": TAG_Int(2), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,90f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(6), "y": TAG_Int(0), "z": TAG_Int(3), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,30f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(7), "y": TAG_Int(0), "z": TAG_Int(3), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,290f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(3), "y": TAG_Int(0), "z": TAG_Int(2), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,175f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(0), "y": TAG_Int(0), "z": TAG_Int(2), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,180f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(5), "y": TAG_Int(0), "z": TAG_Int(5), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,210f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(4), "y": TAG_Int(0), "z": TAG_Int(5), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,320f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(3), "y": TAG_Int(0), "z": TAG_Int(5), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,330f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(3), "y": TAG_Int(0), "z": TAG_Int(6), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,200f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(4), "y": TAG_Int(0), "z": TAG_Int(6), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,50f]}s' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.tagError","with":["Unable to locate ending bracket for: {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,50f]}s"]}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(7), "y": TAG_Int(0), "z": TAG_Int(6), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,60f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(6), "y": TAG_Int(0), "z": TAG_Int(6), }), TAG_Compound({ "Command": TAG_String( u'/summon MinecartRideable 0 36 0 {CustomDisplayTile:1,DisplayTile:159,DisplayData:4,DisplayOffset:84,Rotation:[90f,190f]}' ), "id": TAG_String(u'Control'), "TrackOutput": TAG_Byte(1), "LastOutput": TAG_String( u'{"extra":[{"translate":"commands.summon.success"}],"text":"[18:12:58] "}' ), "CustomName": TAG_String(u'@'), "SuccessCount": TAG_Int(1), "x": TAG_Int(5), "y": TAG_Int(0), "z": TAG_Int(6), }), ]) e.root_tag['Data'] = TAG_Byte_Array([[[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 5, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]]) return e
def createBlocks(): e = MCSchematic(shape=(21,4,8),filename='')
def farm(): e = MCSchematic(shape=(9,2,7),filename='') e._Blocks = [[[17,17,17,17,17,17,17,17,17],[17,60,60,60,60,60,60,60,17],[17,60,60,60,60,60,60,60,17],[17,9,9,9,9,9,9,9,17],[17,60,60,60,60,60,60,60,17],[17,60,60,60,60,60,60,60,17],[17,17,17,17,17,17,17,17,17]],[[0,0,0,0,0,0,0,0,0],[0,59,59,59,59,59,59,59,0],[0,59,59,59,59,59,59,59,0],[0,0,0,0,0,0,0,0,0],[0,141,141,141,141,141,141,141,0],[0,141,141,141,141,141,141,141,0],[0,0,0,0,0,0,0,0,0]]] e.root_tag['Data'] = TAG_Byte_Array([[[0,0,0,0,0,0,0,0,0],[0,7,0,7,0,0,7,0,0],[0,0,0,0,0,0,7,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,7,0,7,0,7,0],[0,0,0,0,7,7,0,0,0],[0,0,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0,0],[0,7,6,6,3,2,2,2,0],[0,6,2,6,3,5,4,6,0],[0,0,0,0,0,0,0,0,0],[0,2,6,4,3,5,2,5,0],[0,5,5,7,5,7,5,6,0],[0,0,0,0,0,0,0,0,0]]]) return e
def arrowSchematic(): e = MCSchematic((5,3,3),filename='', mats=) e._Blocks = [[[0,0,0,0,0],[0,0,0,0,137],[137,1,1,1,0]],[[0,0,0,0,137],[0,0,0,0,0],[137,93,137,149,137]],[[0,0,0,0,0],[0,0,0,0,137],[0,0,0,0,0]]] e.root_tag['Data'] = TAG_Byte_Array([[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],[[0,0,0,0,0],[0,0,0,0,0],[0,3,0,3,0]],[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]]]) e.root_tag['TileEntities'] = TAG_List() return e
def LargeHouse1(): e = MCSchematic(shape=(12,7,9),filename='') e._Blocks = [[[0,4,4,4,4,4,4,0,0,0,0,0],[0,4,5,5,5,5,4,0,0,0,0,0],[67,4,5,5,5,5,4,2,2,3,3,3],[0,4,5,5,5,5,4,3,3,3,3,3],[0,4,5,5,5,5,4,3,3,3,3,3],[0,4,43,43,43,5,4,3,3,3,3,3],[0,4,43,43,43,5,4,4,3,3,3,3],[0,4,43,43,43,5,4,3,3,3,3,2],[0,4,4,4,4,4,4,3,3,3,3,3]],[[0,4,4,4,4,4,4,0,0,0,0,0],[0,4,0,0,53,5,4,0,0,0,0,0],[0,64,0,0,85,53,4,85,85,85,85,85],[0,4,0,0,0,0,4,0,0,0,0,85],[0,4,0,0,0,0,4,0,0,0,0,85],[0,4,0,0,0,0,4,0,0,0,0,85],[0,4,43,43,0,0,64,0,0,0,0,85],[0,4,0,0,0,0,4,0,0,0,0,85],[0,4,4,4,4,4,4,85,85,85,85,85]],[[0,4,17,102,102,17,4,0,0,0,0,0],[0,5,0,0,0,0,5,0,0,0,0,0],[0,64,0,0,72,0,102,0,0,0,0,0],[0,5,0,0,0,0,102,0,0,0,0,0],[0,5,0,0,0,0,5,0,0,0,0,0],[0,102,0,0,0,0,5,0,0,0,0,0],[0,5,0,0,0,0,64,0,0,0,0,0],[0,5,0,0,0,0,5,0,0,0,0,0],[0,4,17,102,102,17,4,0,0,0,0,0]],[[53,4,4,4,4,4,4,53,0,0,0,0],[53,5,0,0,0,0,5,53,0,0,0,0],[53,5,50,0,0,0,5,53,0,0,0,0],[53,5,0,0,0,0,5,53,0,0,0,0],[53,5,0,0,0,0,5,53,0,0,0,0],[53,5,0,0,0,0,5,53,0,0,0,0],[53,5,0,0,0,50,5,53,0,0,0,0],[53,5,0,0,0,0,5,53,0,0,0,0],[53,4,4,4,4,4,4,53,0,0,0,0]],[[0,53,5,5,5,5,53,0,0,0,0,0],[0,53,5,0,0,5,53,0,0,0,0,0],[0,53,5,0,0,5,53,0,0,0,0,0],[0,53,5,0,0,5,53,0,0,0,0,0],[0,53,5,0,0,5,53,0,0,0,0,0],[0,53,5,0,0,5,53,0,0,0,0,0],[0,53,5,0,0,5,53,0,0,0,0,0],[0,53,5,0,0,5,53,0,0,0,0,0],[0,53,5,5,5,5,53,0,0,0,0,0]],[[0,0,53,5,5,53,0,0,0,0,0,0],[0,0,53,5,5,53,0,0,0,0,0,0],[0,0,53,5,5,53,0,0,0,0,0,0],[0,0,53,5,5,53,0,0,0,0,0,0],[0,0,53,5,5,53,0,0,0,0,0,0],[0,0,53,5,5,53,0,0,0,0,0,0],[0,0,53,5,5,53,0,0,0,0,0,0],[0,0,53,5,5,53,0,0,0,0,0,0],[0,0,53,5,5,53,0,0,0,0,0,0]],[[0,0,0,53,53,0,0,0,0,0,0,0],[0,0,0,53,53,0,0,0,0,0,0,0],[0,0,0,53,53,0,0,0,0,0,0,0],[0,0,0,53,53,0,0,0,0,0,0,0],[0,0,0,53,53,0,0,0,0,0,0,0],[0,0,0,53,53,0,0,0,0,0,0,0],[0,0,0,53,53,0,0,0,0,0,0,0],[0,0,0,53,53,0,0,0,0,0,0,0],[0,0,0,53,53,0,0,0,0,0,0,0]]] e.root_tag['Data'] = TAG_Byte_Array([[[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,3,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,8,0,0,1,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,9,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,1,0,0,0,0],[0,0,0,0,0,0,0,1,0,0,0,0],[0,0,1,0,0,0,0,1,0,0,0,0],[0,0,0,0,0,0,0,1,0,0,0,0],[0,0,0,0,0,0,0,1,0,0,0,0],[0,0,0,0,0,0,0,1,0,0,0,0],[0,0,0,0,0,2,0,1,0,0,0,0],[0,0,0,0,0,0,0,1,0,0,0,0],[0,0,0,0,0,0,0,1,0,0,0,0]],[[0,0,0,0,0,0,1,0,0,0,0,0],[0,0,0,0,0,0,1,0,0,0,0,0],[0,0,0,0,0,0,1,0,0,0,0,0],[0,0,0,0,0,0,1,0,0,0,0,0],[0,0,0,0,0,0,1,0,0,0,0,0],[0,0,0,0,0,0,1,0,0,0,0,0],[0,0,0,0,0,0,1,0,0,0,0,0],[0,0,0,0,0,0,1,0,0,0,0,0],[0,0,0,0,0,0,1,0,0,0,0,0]],[[0,0,0,0,0,1,0,0,0,0,0,0],[0,0,0,0,0,1,0,0,0,0,0,0],[0,0,0,0,0,1,0,0,0,0,0,0],[0,0,0,0,0,1,0,0,0,0,0,0],[0,0,0,0,0,1,0,0,0,0,0,0],[0,0,0,0,0,1,0,0,0,0,0,0],[0,0,0,0,0,1,0,0,0,0,0,0],[0,0,0,0,0,1,0,0,0,0,0,0],[0,0,0,0,0,1,0,0,0,0,0,0]],[[0,0,0,0,1,0,0,0,0,0,0,0],[0,0,0,0,1,0,0,0,0,0,0,0],[0,0,0,0,1,0,0,0,0,0,0,0],[0,0,0,0,1,0,0,0,0,0,0,0],[0,0,0,0,1,0,0,0,0,0,0,0],[0,0,0,0,1,0,0,0,0,0,0,0],[0,0,0,0,1,0,0,0,0,0,0,0],[0,0,0,0,1,0,0,0,0,0,0,0],[0,0,0,0,1,0,0,0,0,0,0,0]]]) return e
def createSchematic(): e = MCSchematic(shape=(5,5,3),filename='') e._Blocks = [[[0,0,0,0,0],[0,0,1,0,0],[0,0,0,0,0]],[[0,0,0,0,0],[0,1,93,1,76],[0,0,0,1,0]],[[0,23,0,0,0],[23,70,23,0,1],[0,23,1,55,75]],[[1,158,1,0,0],[158,0,158,0,0],[1,158,55,0,0]],[[55,55,55,0,0],[55,0,55,0,0],[55,55,0,0,0]]] e.root_tag['Data'] = TAG_Byte_Array([[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],[[0,0,0,0,0],[0,0,1,0,1],[0,0,0,0,0]],[[0,3,0,0,0],[5,0,4,0,0],[0,2,0,0,3]],[[0,3,0,0,0],[5,0,4,0,0],[0,2,0,0,0]],[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]]]) return e
def ahouse(level0,box0,options): # Init and log method = "AHouse" (method, (width, height, depth), (centreWidth, centreHeight, centreDepth)) = FuncStart(level0,box0,options,method) # Log start level = MCSchematic((width,height,depth)) box = BoundingBox((0,0,0),(width,height,depth)) # A house has a number of levels and an interior and exterior. There is a roof. # The exterior has windows, doors, balconies, planter boxes, signs, banners, etc. Materials may differ by level # The roof may be of various block type construction and is typically pitched. A chimney appears! # Even where the face of the house is sloping # Random seeded generators RAND = getRandFromSeed(options) RANDMAT = getRandFromSeed(options) # House geometry/structure FLOORHEIGHT = RAND.randint(4,8) NUMFLOORS = int(height/FLOORHEIGHT) ROOFLEVELS = RAND.randint(0,(NUMFLOORS-3)%NUMFLOORS)+2 # How many levels are devoted to the roofline. RECESS = 1 # RAND.randint(1,2) # Pallette MAT_WALL_EXT = [ (35,0), (35,8),(172,0), (45,0), (82,0), (43,9), (5,2), (5,1)] MAT_WALL_EXT2 = [ (35,0), (35,8),(172,0), (45,0), (82,0), (43,9), (5,2), (5,1)] MAT_WALL_BEAM = [ (5,5), (5,3),(17,12),(17,13),(17,15), (162,12),(162,13) ] MAT_WINDOW = [ (160,8), (160,0), (160,7), (95,8), (95,0) ] MAT_FLOOR = [ (5,0), (5,2), (5,3)] MAT_DOOR = [ (193,1), (193,3) ] # Choose material palette mWall = chooseMaterial(MAT_WALL_EXT,RANDMAT) mWallBeam = chooseMaterial(MAT_WALL_BEAM,RANDMAT) mFloor = chooseMaterial(MAT_FLOOR,RANDMAT) mWindow = chooseMaterial(MAT_WINDOW,RANDMAT) mDoor = chooseMaterial(MAT_DOOR,RANDMAT) oWall = mWall chopped = True # I have to hand the house geometry into the child procedures for consistency for i in xrange(0,NUMFLOORS): roomBox = BoundingBox((box.minx+RECESS,box.miny+i*FLOORHEIGHT,box.minz+RECESS),(width-2*RECESS,FLOORHEIGHT,depth-2*RECESS)) if i == 0: # Ground floor if RAND.randint(1,100) >80: # Cobblestone mWall = (4,0) roomBox = BoundingBox((box.minx+int(RECESS*1.5),box.miny+i*FLOORHEIGHT,box.minz+int(RECESS*1.5)),(width-2*int(RECESS*1.5),FLOORHEIGHT,depth-2*int(RECESS*1.5))) mWall = oWall if i == 1: # First floor if RAND.randint(1,100) > 70: # Randomise wall material? mWall = chooseMaterial(MAT_WALL_EXT,RANDMAT) if RAND.randint(1,100) > 50: chopped = False if i == 0 and RAND.randint(1,100) > 50: # Special collection of rooms instead of one room only for j in xrange(0,RAND.randint(2,5)): px = RAND.randint(RECESS,RECESS+int(centreWidth)) pz = RAND.randint(RECESS,RECESS+int(centreDepth)) pxd = width-RECESS-px pzd = depth-RECESS-pz roomBox = BoundingBox((box.minx+px,box.miny+i*FLOORHEIGHT,box.minz+pz), (RAND.randint(int(pxd/2),pxd),FLOORHEIGHT,RAND.randint(int(pzd/2),pzd))) room(level,roomBox,options,RAND,getRandFromSeed(options),mWall,mWallBeam,mFloor,mWindow,mDoor,chopped) doors(level,roomBox,options,RAND,mDoor) # Struts for y in xrange(box.miny+i*FLOORHEIGHT,box.miny+(i+1)*FLOORHEIGHT): setBlockForced(level,mWallBeam,box.minx+2,y,box.minz+2) setBlockForced(level,mWallBeam,box.maxx-3,y,box.maxz-3) setBlockForced(level,mWallBeam,box.minx+2,y,box.maxz-3) setBlockForced(level,mWallBeam,box.maxx-3,y,box.minz+2) else: # One box only room(level,roomBox,options,RAND,getRandFromSeed(options),mWall,mWallBeam,mFloor,mWindow,mDoor,chopped) if i == 0: doors(level,roomBox,options,RAND,mDoor) stairs(level,box,options,RAND,RANDMAT) # Detail # -- Door detail placePorch(level,box,options,RAND,RANDMAT,mDoor) # -- Windows placeWindows(level,box,options,RAND,RANDMAT,FLOORHEIGHT,mWindow,mWall,mWallBeam,mDoor) # Roof(s) - size and shape can be tuned through parameters. Some extreme A-frame high fantasy roofs can occur in the initial version of this generator roofMaterial = RANDMAT.randint(0,10) if depth > width: roofNS(level,box,options,RAND,RANDMAT,height-ROOFLEVELS*FLOORHEIGHT,roofMaterial,mWall) if RAND.randint(1,100) > 50: roofEW(level,box,options,RAND,RANDMAT,height-ROOFLEVELS*FLOORHEIGHT,roofMaterial,mWall) else: roofEW(level,box,options,RAND,RANDMAT,height-ROOFLEVELS*FLOORHEIGHT,roofMaterial,mWall) if RAND.randint(1,100) > 50: roofNS(level,box,options,RAND,RANDMAT,height-ROOFLEVELS*FLOORHEIGHT,roofMaterial,mWall) if RAND.randint(1,100) > 5: chimney(level,box,options,RAND,(RAND.randint(box.minx+1,box.maxx-2),box.miny,RAND.randint(box.minz+1,box.maxz-2))) b=range(4096) b.remove(0) # @CodeWarrior0 and @Wout12345 explained how to merge schematics level0.copyBlocksFrom(level, box, (box0.minx, box0.miny, box0.minz ),b) level0.markDirtyBox(box0) # End / log FuncEnd(level,box,options,method)
def meshy2(level,box,spacing,vspacing,ores): op = "meshy2" l2 = MCSchematic((box.width,box.height,box.length)) b2 = BoundingBox((0,0,0),(box.width,box.height,box.length)) print "Clearing:" # Clear the landscape of all superfluous blocks blockTo = level.materials.Air blockFrom = [ level.materials.Sapling, level.materials.SpruceSapling, level.materials.BirchSapling, level.materials.WaterActive, level.materials.Water, level.materials.LavaActive, level.materials.Lava, level.materials.UnusedShrub, level.materials.TallGrass, level.materials.Shrub, level.materials.DesertShrub2, level.materials.Flower, level.materials.Rose, level.materials.BrownMushroom, level.materials.RedMushroom, level.materials.SnowLayer, level.materials.Lilypad, level.materials.Wood, # level.materials.IronWood, level.materials.BirchWood, level.materials.PineWood, level.materials.Leaves, level.materials.PineLeaves, level.materials.BirchLeaves, level.materials.JungleLeaves, level.materials.LeavesPermanent, level.materials.PineLeavesPermanent, level.materials.BirchLeavesPermanent, level.materials.JungleLeavesPermanent, level.materials.LeavesDecaying, level.materials.PineLeavesDecaying, level.materials.BirchLeavesDecaying, level.materials.JungleLeavesDecaying, level.materials[175,10], level.materials[17,4], level.materials[17,8], level.materials[9,0], level.materials[9,1], level.materials[9,2], level.materials[9,3], level.materials[9,4], level.materials[9,5], level.materials[9,6], level.materials[9,7], ] for block in blockFrom: print block level.fillBlocks(box, blockTo, [block]) # Traverse the landscape surface, taking only solid blocks onto the workspace x = box.minx while x < box.maxx: print x z = box.minz while z < box.maxz: y = box.maxy while y > box.miny: y -= 1 block = level.blockAt(x,y,z) if block != 0: while y > box.miny: block = level.blockAt(x,y,z) data = level.blockDataAt(x,y,z) setBlock(l2,(block,data),x-box.minx,y-box.miny,z-box.minz) y -= vspacing z += 1 x += spacing x = box.minx while x < box.maxx: print x z = box.minz while z < box.maxz: y = box.maxy while y > box.miny: y -= 1 block = level.blockAt(x,y,z) if block != 0: while y > box.miny: block = level.blockAt(x,y,z) data = level.blockDataAt(x,y,z) setBlock(l2,(block,data),x-box.minx,y-box.miny,z-box.minz) y -= vspacing z += spacing x += 1 if ores == True: print "Keeping ores" oreList = [ 14,15,16,21,56,73,129,153 ] for x in xrange(box.minx,box.maxx): for z in xrange(box.minz,box.maxz): for y in xrange(box.miny,box.maxy): block = level.blockAt(x,y,z) if block in oreList: setBlock(l2,(block,level.blockDataAt(x,y,z)),x-box.minx,y-box.miny,z-box.minz) # Copy the workspace over the original area level.copyBlocksFrom(l2, b2, (box.minx, box.miny, box.minz ))
def perform(level, box, options): for (chunk, slices, point) in level.getChunkSlices(box): if options["Include blocks"] == True: for t in chunk.TileEntities: x = t["x"].value y = t["y"].value z = t["z"].value if (x,y,z) in box: if options["LastOutput"] == True: if "LastOutput" in t: del t["LastOutput"] if options["Include entities"] == True: for e in chunk.Entities: x = e["Pos"][0].value y = e["Pos"][1].value z = e["Pos"][2].value if (x,y,z) in box: if options["LastOutput"] == True and "LastOutput" in e: del e["LastOutput"] if options["UUID"] == True: if "UUIDMost" in e: del e["UUIDMost"] if "UUIDLeast" in e: del e["UUIDLeast"] if options["AbsorptionAmount"] == True: if "AbsorptionAmount" in e: del e["AbsorptionAmount"] if options["Air"] == True: if "Air" in e: del e["Air"] if options["Attributes"] == True: if "Attributes" in e: del e["Attributes"] if options["DeathTime"] == True: if "DeathTime" in e: del e["DeathTime"] if options["Dimension"] == True: if "Dimension" in e: del e["Dimension"] if options["Fire"] == True: if "Fire" in e: del e["Fire"] if options["HurtByTimestamp"] == True: if "HurtByTimestamp" in e: del e["HurtByTimestamp"] if options["PortalCooldown"] == True: if "PortalCooldown" in e: del e["PortalCooldown"] #Getting inputs includeAir = options["Include air"] includeBlocks = options["Include blocks"] cmdBlockHeight = options["command block height (relative only)"] relativePos = options["Relative position"] cmdBlockPosing = options["Command block positioning"] editor = inspect.stack()[1][0].f_locals.get('self', None).editor commandlist = [] bracketsToClosetemp = 0 popOffBlocks = [6,8,9,10,11,12,13,27,28,31,32,36,37,38,39,40,50,51,55,59,63,64,65,66,68,69,70,71,72,75,76,77,78,81,83,90,92,93,94,96,104,105,106,111,115,119,122,127,131,140,141,142,143,147,148,149,150,157,167,171,175,176,177,193,194,195,196,197] popoffcommands = [] redstoneblockcommands = [] solidcommands = [] entitiescommand = [] if options["Include blocks"] == True: for y in reversed(xrange(box.miny,box.maxy)): for x in xrange(box.minx,box.maxx): for z in xrange(box.minz,box.maxz): cmdtemp = '' if cmdBlockPosing=="Absolute": blockX = x blockY = y blockZ = z elif cmdBlockPosing=="Relative": blockY=y-box.miny-cmdBlockHeight-2 if relativePos=="North-West": blockX=x-box.minx+2 blockZ=z-box.minz+2 if relativePos=="South-West": blockX=x-box.minx+2 blockZ=z-box.maxz-1 if relativePos=="North-East": blockX=x-box.maxx-1 blockZ=z-box.minz+2 if relativePos=="South-East": blockX=x-box.maxx-1 blockZ=z-box.maxz-1 else : raise Exception ("WTF?") if includeBlocks==True and level.blockAt(x,y,z)!=0: if level.tileEntityAt(x,y,z)==None: cmdtemp='{id:MinecartCommandBlock,Command:"setblock'+ {True: " ~", False: " "}[cmdBlockPosing=="Relative"] +str(blockX)+{True: " ~", False: " "}[cmdBlockPosing=="Relative"]+str(blockY)+{True: " ~", False: " "}[cmdBlockPosing=="Relative"]+str(blockZ)+' '+IDsToName[str(level.blockAt(x,y,z))]+' '+str(level.blockDataAt(x,y,z))+{True: " destroy", False: " replace"}[level.blockAt(x,y,z)==152]+'",Riding:' if level.tileEntityAt(x,y,z) !=None: cmdtemp= '{id:MinecartCommandBlock,Command:"setblock'+ {True: " ~", False: " "}[cmdBlockPosing=="Relative"]+str(blockX)+{True: " ~", False: " "}[cmdBlockPosing=="Relative"]+str(+blockY)+{True: " ~", False: " "}[cmdBlockPosing=="Relative"]+str(blockZ)+' '+IDsToName[str(level.blockAt(x,y,z))]+' '+str(level.blockDataAt(x,y,z))+{True: " destroy", False: " replace"}[level.blockAt(x,y,z)==152]+' {'+NBT2Command(level.tileEntityAt(x,y,z))+'}",Riding:' if includeAir==True and level.blockAt(x,y,z)==0: if level.tileEntityAt(x,y,z)==None: cmdtemp='{id:MinecartCommandBlock,Command:"setblock'+ {True: " ~", False: " "}[cmdBlockPosing=="Relative"]+str(blockX)+{True: " ~", False: " "}[cmdBlockPosing=="Relative"]+str(blockY)+{True: " ~", False: " "}[cmdBlockPosing=="Relative"]+str(blockZ)+' '+IDsToName[str(level.blockAt(x,y,z))]+' '+str(level.blockDataAt(x,y,z))+' replace",Riding:' if level.tileEntityAt(x,y,z) != None: cmdtemp='{id:MinecartCommandBlock,Command:"setblock'+ {True: " ~", False: " "}[cmdBlockPosing=="Relative"]+str(blockX)+{True: " ~", False: " "}[cmdBlockPosing=="Relative"]+str(blockY)+{True: " ~", False: " "}[cmdBlockPosing=="Relative"]+str(blockZ)+' '+IDsToName[str(level.blockAt(x,y,z))]+' '+str(level.blockDataAt(x,y,z))+' replace {'+NBT2Command(level.tileEntityAt(x,y,z))+'}",Riding:' if cmdtemp != '': if level.blockAt(x,y,z) in popOffBlocks: popoffcommands.append([cmdtemp, 1]) elif level.blockAt(x,y,z) == 152: redstoneblockcommands.append([cmdtemp, 1]) solidcommands.append([cmdtemp, 1]) else: solidcommands.append([cmdtemp, 1]) if options["Include entities"] == True: for (chunk, slices, point) in level.getChunkSlices(box): for e in chunk.Entities: ex = e["Pos"][0].value ey = e["Pos"][1].value ez = e["Pos"][2].value if (ex,ey,ez) in box: if cmdBlockPosing=="Absolute": entityX = ex entityY = ey entityZ = ez elif cmdBlockPosing=="Relative": entityY=ey-box.miny-cmdBlockHeight-2.05 if relativePos=="North-West": entityX=ex-box.minx+1.5 entityZ=ez-box.minz+1.7 if relativePos=="South-West": entityX=ex-box.minx+1.5 entityZ=ez-box.maxz-1.3 if relativePos=="North-East": entityX=ex-box.maxx-1.5 entityZ=ez-box.minz+1.7 if relativePos=="South-East": entityX=ex-box.maxx-1.5 entityZ=ez-box.maxz-1.3 else : raise Exception ("WTF?") cmdtemp= "{id:MinecartCommandBlock,Command:\"summon "+str(e["id"].value)+" "+ {True: "~", False: ""}[cmdBlockPosing=="Relative"]+str(entityX)+{True: " ~", False: " "}[cmdBlockPosing=="Relative"]+str(+entityY)+{True: " ~", False: " "}[cmdBlockPosing=="Relative"]+str(entityZ)+" {"+NBT2Command(e)+"}\",Riding:" entitiescommand.append([cmdtemp, 1]) if cmdBlockPosing=="Absolute": cmd="/summon FallingSand ~ ~+4 ~ {Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:fill ~ ~1 ~-1 ~ ~-5 ~ air},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:kill @e[type=MinecartCommandBlock,r=4]},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:MinecartCommandBlock,Command:setblock ~ ~ ~ air,Riding:{id:MinecartCommandBlock,Command:/kill @e[type=Item,r=4],Riding:{id:MinecartCommandBlock,Command:/tellraw @a {text:\"Thanks to gentlegiantJGC and xafonyz for making the MCedit filter to make this possible\",color:gold},Riding:" bracketsToClose=1 if entitiescommand != []: for c in entitiescommand: if len(cmd) + len(c[0]) + bracketsToClose + c[1] + 195 > 32760: cmd+="{id:MinecartCommandBlock,Command:buffer,Riding:{id:FallingSand,Time:1,Data:0,TileID:157,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:Item,Age:5996,Motion:[0.0,0.0,-0.1]}}}}}}}}}}}}" while bracketsToClose > 0: cmd += "}" bracketsToClose -= 1 commandlist.append(cmd) cmd="/summon FallingSand ~ ~+4 ~ {Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:fill ~ ~1 ~-1 ~ ~-5 ~ air},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:kill @e[type=MinecartCommandBlock,r=4]},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:MinecartCommandBlock,Command:setblock ~ ~ ~ air,Riding:{id:MinecartCommandBlock,Command:/kill @e[type=Item,r=4],Riding:" bracketsToClose=0 cmd += c[0] bracketsToClose += c[1] if popoffcommands != [] or redstoneblockcommands != [] or solidcommands != []: if len(cmd) + 51 + bracketsToClose + 195 > 32760: cmd+="{id:MinecartCommandBlock,Command:buffer,Riding:{id:FallingSand,Time:1,Data:0,TileID:157,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:Item,Age:5996,Motion:[0.0,0.0,-0.1]}}}}}}}}}}}}" while bracketsToClose > 0: cmd += "}" bracketsToClose -= 1 commandlist.append(cmd) cmd="/summon FallingSand ~ ~+4 ~ {Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:fill ~ ~1 ~-1 ~ ~-5 ~ air},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:kill @e[type=MinecartCommandBlock,r=4]},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:MinecartCommandBlock,Command:setblock ~ ~ ~ air,Riding:{id:MinecartCommandBlock,Command:/kill @e[type=Item,r=4],Riding:" bracketsToClose=0 cmd += '{id:MinecartCommandBlock,Command:buffer,Riding:{id:MinecartCommandBlock,Command:buffer,Riding:' bracketsToClose += 2 if popoffcommands != []: for c in popoffcommands: if len(cmd) + len(c[0]) + bracketsToClose + c[1] + 195 > 32760: cmd+="{id:MinecartCommandBlock,Command:buffer,Riding:{id:FallingSand,Time:1,Data:0,TileID:157,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:Item,Age:5996,Motion:[0.0,0.0,-0.1]}}}}}}}}}}}}" while bracketsToClose > 0: cmd += "}" bracketsToClose -= 1 commandlist.append(cmd) cmd="/summon FallingSand ~ ~+4 ~ {Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:fill ~ ~1 ~-1 ~ ~-5 ~ air},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:kill @e[type=MinecartCommandBlock,r=4]},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:MinecartCommandBlock,Command:setblock ~ ~ ~ air,Riding:{id:MinecartCommandBlock,Command:/kill @e[type=Item,r=4],Riding:" bracketsToClose=0 cmd += c[0] bracketsToClose += c[1] if redstoneblockcommands != [] or solidcommands != []: if len(cmd) + 51 + bracketsToClose + 195 > 32760: cmd+="{id:MinecartCommandBlock,Command:buffer,Riding:{id:FallingSand,Time:1,Data:0,TileID:157,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:Item,Age:5996,Motion:[0.0,0.0,-0.1]}}}}}}}}}}}}" while bracketsToClose > 0: cmd += "}" bracketsToClose -= 1 commandlist.append(cmd) cmd="/summon FallingSand ~ ~+4 ~ {Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:fill ~ ~1 ~-1 ~ ~-5 ~ air},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:kill @e[type=MinecartCommandBlock,r=4]},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:MinecartCommandBlock,Command:setblock ~ ~ ~ air,Riding:{id:MinecartCommandBlock,Command:/kill @e[type=Item,r=4],Riding:" bracketsToClose=0 cmd += '{id:MinecartCommandBlock,Command:buffer,Riding:{id:MinecartCommandBlock,Command:buffer,Riding:' bracketsToClose += 2 if redstoneblockcommands != []: for c in redstoneblockcommands: if len(cmd) + len(c[0]) + bracketsToClose + c[1] + 195 > 32760: cmd+="{id:MinecartCommandBlock,Command:buffer,Riding:{id:FallingSand,Time:1,Data:0,TileID:157,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:Item,Age:5996,Motion:[0.0,0.0,-0.1]}}}}}}}}}}}}" while bracketsToClose > 0: cmd += "}" bracketsToClose -= 1 commandlist.append(cmd) cmd="/summon FallingSand ~ ~+4 ~ {Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:fill ~ ~1 ~-1 ~ ~-5 ~ air},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:kill @e[type=MinecartCommandBlock,r=4]},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:MinecartCommandBlock,Command:setblock ~ ~ ~ air,Riding:{id:MinecartCommandBlock,Command:/kill @e[type=Item,r=4],Riding:" bracketsToClose=0 cmd += c[0] bracketsToClose += c[1] if solidcommands != []: if len(cmd) + 51 + bracketsToClose + 195 > 32760: cmd+="{id:MinecartCommandBlock,Command:buffer,Riding:{id:FallingSand,Time:1,Data:0,TileID:157,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:Item,Age:5996,Motion:[0.0,0.0,-0.1]}}}}}}}}}}}}" while bracketsToClose > 0: cmd += "}" bracketsToClose -= 1 commandlist.append(cmd) cmd="/summon FallingSand ~ ~+4 ~ {Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:fill ~ ~1 ~-1 ~ ~-5 ~ air},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:kill @e[type=MinecartCommandBlock,r=4]},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:MinecartCommandBlock,Command:setblock ~ ~ ~ air,Riding:{id:MinecartCommandBlock,Command:/kill @e[type=Item,r=4],Riding:" bracketsToClose=0 cmd += '{id:MinecartCommandBlock,Command:buffer,Riding:{id:MinecartCommandBlock,Command:buffer,Riding:' bracketsToClose += 2 if solidcommands != []: for c in solidcommands: if len(cmd) + len(c[0]) + bracketsToClose + c[1] + 195 > 32760: cmd+="{id:MinecartCommandBlock,Command:buffer,Riding:{id:FallingSand,Time:1,Data:0,TileID:157,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:Item,Age:5996,Motion:[0.0,0.0,-0.1]}}}}}}}}}}}}" while bracketsToClose > 0: cmd += "}" bracketsToClose -= 1 commandlist.append(cmd) cmd="/summon FallingSand ~ ~+4 ~ {Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:fill ~ ~1 ~-1 ~ ~-5 ~ air},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:kill @e[type=MinecartCommandBlock,r=4]},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:MinecartCommandBlock,Command:setblock ~ ~ ~ air,Riding:{id:MinecartCommandBlock,Command:/kill @e[type=Item,r=4],Riding:" bracketsToClose=0 cmd += c[0] bracketsToClose += c[1] cmd+="{id:MinecartCommandBlock,Command:buffer,Riding:{id:FallingSand,Time:1,Data:0,TileID:157,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:Item,Age:5996,Motion:[0.0,0.0,-0.1]}}}}}}}}}}}}" while bracketsToClose > 0: cmd += "}" bracketsToClose -= 1 commandlist.append(cmd) schematic = MCSchematic((len(commandlist)*2-1, 1, 1), mats=level.materials) cx = 0 for command in commandlist: schematic.setBlockAt(cx, 0, 0, 137) schematic.setBlockDataAt(cx, 0, 0, 0) control = TAG_Compound() control["id"] = TAG_String(u'Control') control["CustomName"] = TAG_String(u"builder") control["z"] = TAG_Int(0) control["y"] = TAG_Int(0) control["x"] = TAG_Int(cx) control["Command"] = TAG_String(command) schematic.TileEntities.append(control) cx += 2 editor.addCopiedSchematic(schematic) if cmdBlockPosing=="Relative": cmd="summon FallingSand ~ ~+4 ~ {Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:fill ~ ~1 ~-1 ~ ~-5 ~ air},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:kill @e[type=MinecartCommandBlock,r=4]},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:MinecartCommandBlock,Command:setblock ~ ~ ~ air,Riding:{id:MinecartCommandBlock,Command:/kill @e[type=Item,r=4],Riding:{id:MinecartCommandBlock,Command:/tellraw @a {text:\"Thanks to gentlegiantJGC and xafonyz for making the MCedit filter to make this possible\",color:gold},Riding:" bracketsToClose=1 if entitiescommand != []: for c in entitiescommand: if len(cmd) + len(c[0]) + bracketsToClose + c[1] + 195 > 32710: cmd = "/execute @e[name=OCSSMarker,type=ArmorStand] ~ ~ ~ "+cmd+"{id:MinecartCommandBlock,Command:buffer,Riding:{id:FallingSand,Time:1,Data:0,TileID:157,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:Item,Age:5996,Motion:[0.0,0.0,-0.1]}}}}}}}}}}}}" while bracketsToClose > 0: cmd += "}" bracketsToClose -= 1 commandlist.append(cmd) cmd="summon FallingSand ~ ~+4 ~ {Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:fill ~ ~1 ~-1 ~ ~-5 ~ air},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:kill @e[type=MinecartCommandBlock,r=4]},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:MinecartCommandBlock,Command:setblock ~ ~ ~ air,Riding:{id:MinecartCommandBlock,Command:/kill @e[type=Item,r=4],Riding:" bracketsToClose=0 cmd += c[0] bracketsToClose += c[1] if popoffcommands != [] or redstoneblockcommands != [] or solidcommands != []: if len(cmd) + 51 + bracketsToClose + 195 > 32710: cmd = "/execute @e[name=OCSSMarker,type=ArmorStand] ~ ~ ~ "+cmd+"{id:MinecartCommandBlock,Command:buffer,Riding:{id:FallingSand,Time:1,Data:0,TileID:157,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:Item,Age:5996,Motion:[0.0,0.0,-0.1]}}}}}}}}}}}}" while bracketsToClose > 0: cmd += "}" bracketsToClose -= 1 commandlist.append(cmd) cmd="summon FallingSand ~ ~+4 ~ {Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:fill ~ ~1 ~-1 ~ ~-5 ~ air},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:kill @e[type=MinecartCommandBlock,r=4]},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:MinecartCommandBlock,Command:setblock ~ ~ ~ air,Riding:{id:MinecartCommandBlock,Command:/kill @e[type=Item,r=4],Riding:" bracketsToClose=0 cmd += '{id:MinecartCommandBlock,Command:buffer,Riding:{id:MinecartCommandBlock,Command:buffer,Riding:' bracketsToClose += 2 if popoffcommands != []: for c in popoffcommands: if len(cmd) + len(c[0]) + bracketsToClose + c[1] + 195 > 32710: cmd="/execute @e[name=OCSSMarker,type=ArmorStand] ~ ~ ~ "+cmd+"{id:MinecartCommandBlock,Command:buffer,Riding:{id:FallingSand,Time:1,Data:0,TileID:157,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:Item,Age:5996,Motion:[0.0,0.0,-0.1]}}}}}}}}}}}}" while bracketsToClose > 0: cmd += "}" bracketsToClose -= 1 commandlist.append(cmd) cmd="summon FallingSand ~ ~+4 ~ {Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:fill ~ ~1 ~-1 ~ ~-5 ~ air},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:kill @e[type=MinecartCommandBlock,r=4]},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:MinecartCommandBlock,Command:setblock ~ ~ ~ air,Riding:{id:MinecartCommandBlock,Command:/kill @e[type=Item,r=4],Riding:" bracketsToClose=0 cmd += c[0] bracketsToClose += c[1] if redstoneblockcommands != [] or solidcommands != []: if len(cmd) + 51 + bracketsToClose + 195 > 32710: cmd="/execute @e[name=OCSSMarker,type=ArmorStand] ~ ~ ~ "+cmd+"{id:MinecartCommandBlock,Command:buffer,Riding:{id:FallingSand,Time:1,Data:0,TileID:157,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:Item,Age:5996,Motion:[0.0,0.0,-0.1]}}}}}}}}}}}}" while bracketsToClose > 0: cmd += "}" bracketsToClose -= 1 commandlist.append(cmd) cmd="summon FallingSand ~ ~+4 ~ {Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:fill ~ ~1 ~-1 ~ ~-5 ~ air},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:kill @e[type=MinecartCommandBlock,r=4]},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:MinecartCommandBlock,Command:setblock ~ ~ ~ air,Riding:{id:MinecartCommandBlock,Command:/kill @e[type=Item,r=4],Riding:" bracketsToClose=0 cmd += '{id:MinecartCommandBlock,Command:buffer,Riding:{id:MinecartCommandBlock,Command:buffer,Riding:' bracketsToClose += 2 if redstoneblockcommands != []: for c in redstoneblockcommands: if len(cmd) + len(c[0]) + bracketsToClose + c[1] + 195 > 32710: cmd = "/execute @e[name=OCSSMarker,type=ArmorStand] ~ ~ ~ "+cmd+"{id:MinecartCommandBlock,Command:buffer,Riding:{id:FallingSand,Time:1,Data:0,TileID:157,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:Item,Age:5996,Motion:[0.0,0.0,-0.1]}}}}}}}}}}}}" while bracketsToClose > 0: cmd += "}" bracketsToClose -= 1 commandlist.append(cmd) cmd="summon FallingSand ~ ~+4 ~ {Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:fill ~ ~1 ~-1 ~ ~-5 ~ air},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:kill @e[type=MinecartCommandBlock,r=4]},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:MinecartCommandBlock,Command:setblock ~ ~ ~ air,Riding:{id:MinecartCommandBlock,Command:/kill @e[type=Item,r=4],Riding:" bracketsToClose=0 cmd += c[0] bracketsToClose += c[1] if solidcommands != []: if len(cmd) + 51 + bracketsToClose + 195 > 32710: cmd = "/execute @e[name=OCSSMarker,type=ArmorStand] ~ ~ ~ "+cmd+"{id:MinecartCommandBlock,Command:buffer,Riding:{id:FallingSand,Time:1,Data:0,TileID:157,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:Item,Age:5996,Motion:[0.0,0.0,-0.1]}}}}}}}}}}}}" while bracketsToClose > 0: cmd += "}" bracketsToClose -= 1 commandlist.append(cmd) cmd="summon FallingSand ~ ~+4 ~ {Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:fill ~ ~1 ~-1 ~ ~-5 ~ air},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:kill @e[type=MinecartCommandBlock,r=4]},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:MinecartCommandBlock,Command:setblock ~ ~ ~ air,Riding:{id:MinecartCommandBlock,Command:/kill @e[type=Item,r=4],Riding:" bracketsToClose=0 cmd += '{id:MinecartCommandBlock,Command:buffer,Riding:{id:MinecartCommandBlock,Command:buffer,Riding:' bracketsToClose += 2 if solidcommands != []: for c in solidcommands: if len(cmd) + len(c[0]) + bracketsToClose + c[1] + 195 > 32710: cmd = "/execute @e[name=OCSSMarker,type=ArmorStand] ~ ~ ~ "+cmd+"{id:MinecartCommandBlock,Command:buffer,Riding:{id:FallingSand,Time:1,Data:0,TileID:157,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:Item,Age:5996,Motion:[0.0,0.0,-0.1]}}}}}}}}}}}}" while bracketsToClose > 0: cmd += "}" bracketsToClose -= 1 commandlist.append(cmd) cmd="summon FallingSand ~ ~+4 ~ {Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:fill ~ ~1 ~-1 ~ ~-5 ~ air},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:kill @e[type=MinecartCommandBlock,r=4]},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:MinecartCommandBlock,Command:setblock ~ ~ ~ air,Riding:{id:MinecartCommandBlock,Command:/kill @e[type=Item,r=4],Riding:" bracketsToClose=0 cmd += c[0] bracketsToClose += c[1] cmd+="{id:MinecartCommandBlock,Command:buffer,Riding:{id:FallingSand,Time:1,Data:0,TileID:157,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:Item,Age:5996,Motion:[0.0,0.0,-0.1]}}}}}}}}}}}}" while bracketsToClose > 0: cmd += "}" bracketsToClose -= 1 if len(commandlist) > 0: cmd = "/execute @e[name=OCSSMarker,type=ArmorStand] ~ ~ ~ "+cmd commandlist.append(cmd) if len(commandlist) == 1: schematic = MCSchematic((1, 1, 1), mats=level.materials) for command in commandlist: schematic.setBlockAt(0, 0, 0, 137) schematic.setBlockDataAt(0, 0, 0, 0) control = TAG_Compound() control["id"] = TAG_String(u'Control') control["CustomName"] = TAG_String(u"builder") control["z"] = TAG_Int(0) control["y"] = TAG_Int(0) control["x"] = TAG_Int(0) control["Command"] = TAG_String(command) schematic.TileEntities.append(control) editor.addCopiedSchematic(schematic) else: schematic = MCSchematic((len(commandlist)*2+1, 1, 1), mats=level.materials) cx = 2 for command in commandlist: schematic.setBlockAt(cx, 0, 0, 137) schematic.setBlockDataAt(cx, 0, 0, 0) control = TAG_Compound() control["id"] = TAG_String(u'Control') control["CustomName"] = TAG_String(u"builder") control["z"] = TAG_Int(0) control["y"] = TAG_Int(0) control["x"] = TAG_Int(cx) control["Command"] = TAG_String(command) schematic.TileEntities.append(control) cx += 2 schematic.setBlockAt(0, 0, 0, 137) schematic.setBlockDataAt(0, 0, 0, 0) control = TAG_Compound() control["id"] = TAG_String(u'Control') control["CustomName"] = TAG_String(u"builder") control["z"] = TAG_Int(0) control["y"] = TAG_Int(0) control["x"] = TAG_Int(0) control["Command"] = TAG_String('/summon FallingSand ~ ~+4 ~ {Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:fill ~ ~1 ~-1 ~ ~-5 ~ air},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:kill @e[type=MinecartCommandBlock,r=4]},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:MinecartCommandBlock,Command:setblock ~ ~ ~ air,Riding:{id:MinecartCommandBlock,Command:/kill @e[type=Item,r=4],Riding:{id:MinecartCommandBlock,Command:"/summon ArmorStand ~ ~-1.05 ~0.3125 {CustomName:OCSSMarker,NoGravity:1}",Riding:{id:MinecartCommandBlock,Command:"setblock ~ ~-2 ~ stone",Riding:{id:MinecartCommandBlock,Command:buffer,Riding:{id:FallingSand,Time:1,Data:0,TileID:157,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:Item,Age:5996,Motion:[0.0,0.0,-0.1]}}}}}}}}}}}}}}') schematic.TileEntities.append(control) editor.addCopiedSchematic(schematic)
def Matrix(level,box,R,spacing): op = "Matrix" #level2 = level.extractSchematic(box) # Working set level2 = MCSchematic((box.width,box.height,box.length)) box2 = BoundingBox((0,0,0),(box.width,box.height,box.length)) smoothamount = 1 ox = box.minx oy = box.miny oz = box.minz w = box.width h = box.height d = box.length (x,y,z) = (ox,oy,oz) while y < box.maxy: if y%10 == 0: print str(time.ctime())+" Running X "+op+" "+str(y) z = oz while z < box.maxz: x = ox while x < box.maxx: p000 = (x,y,z) p001 = (x,y,z+spacing) p010 = (x,y+spacing,z) p011 = (x,y+spacing,z+spacing) p100 = (x+spacing,y,z) p101 = (x+spacing,y,z+spacing) p110 = (x+spacing,y+spacing,z) p111 = (x+spacing,y+spacing,z+spacing) PSet = [] PSet.append(makePathUnique(calcLinesSmooth1(smoothamount,[p000,p001]))) PSet.append(makePathUnique(calcLinesSmooth1(smoothamount,[p000,p010]))) PSet.append(makePathUnique(calcLinesSmooth1(smoothamount,[p000,p100]))) PSet.append(makePathUnique(calcLinesSmooth1(smoothamount,[p001,p011]))) PSet.append(makePathUnique(calcLinesSmooth1(smoothamount,[p100,p110]))) PSet.append(makePathUnique(calcLinesSmooth1(smoothamount,[p010,p110]))) PSet.append(makePathUnique(calcLinesSmooth1(smoothamount,[p010,p011]))) PSet.append(makePathUnique(calcLinesSmooth1(smoothamount,[p100,p101]))) PSet.append(makePathUnique(calcLinesSmooth1(smoothamount,[p001,p101]))) PSet.append(makePathUnique(calcLinesSmooth1(smoothamount,[p101,p111]))) PSet.append(makePathUnique(calcLinesSmooth1(smoothamount,[p011,p111]))) PSet.append(makePathUnique(calcLinesSmooth1(smoothamount,[p110,p111]))) PSet.append(makePathUnique(calcLinesSmooth1(smoothamount,[p000,p111]))) PSet.append(makePathUnique(calcLinesSmooth1(smoothamount,[p010,p101]))) PSet.append(makePathUnique(calcLinesSmooth1(smoothamount,[p100,p001]))) PSet.append(makePathUnique(calcLinesSmooth1(smoothamount,[p110,p011]))) PSet.append(makePathUnique(calcLinesSmooth1(smoothamount,[p110,p001]))) PSet.append(makePathUnique(calcLinesSmooth1(smoothamount,[p011,p100]))) PSet.append(makePathUnique(calcLinesSmooth1(smoothamount,[p000,p101]))) PSet.append(makePathUnique(calcLinesSmooth1(smoothamount,[p010,p111]))) PSet.append(makePathUnique(calcLinesSmooth1(smoothamount,[p000,p110]))) PSet.append(makePathUnique(calcLinesSmooth1(smoothamount,[p010,p100]))) PSet.append(makePathUnique(calcLinesSmooth1(smoothamount,[p000,p011]))) PSet.append(makePathUnique(calcLinesSmooth1(smoothamount,[p010,p001]))) PSet.append(makePathUnique(calcLinesSmooth1(smoothamount,[p010,p001]))) PSet.append(makePathUnique(calcLinesSmooth1(smoothamount,[p011,p101]))) PSet.append(makePathUnique(calcLinesSmooth1(smoothamount,[p001,p110]))) # PSet = flatten(PSet) #print PSet for PLine in PSet: for (x1,y1,z1) in PLine: setBlock(level2,getBlock(level,x1,y1,z1),x1-box.minx,y1-box.miny,z1-box.minz) x += spacing z += spacing y += spacing # Calculate the cube here level.copyBlocksFrom(level2, box2, (box.minx, box.miny, box.minz ))
def window(dim,materials): ''' Create a window design of the specified size ''' model = MCSchematic(shape=dim) # This will be returned. A model of a window width and height-wise with depth features (x,y,z) = dim depth = z width = x height = y heightHalf = y>>1 heightQtr = heightHalf>>1 # Design half the window and mirror it width-wise widthHalf = x>>1 if widthHalf<<1 < width: widthHalf += 1 # If the width is odd then there is a centre position that needs to be drawn otherwise there would be a gap shapeWindowHalf = MCSchematic(shape=(widthHalf,height,depth)) shapeFill(shapeWindowHalf,materials[0],(0,0,0),(widthHalf-1,height-1,0)) # A window is glass in the centre, Stone with vertical design elements outside that, and window sill and top GLASSTOP = randint(heightQtr,heightHalf) # Distances from the centre GLASSBOT = randint(heightQtr,heightHalf) GLASSEDGE = (width>>1)-1 #randint(width>>2,(width>>1)) if GLASSEDGE >= (width>>1)-1: GLASSEDGE -= 2 if GLASSEDGE < 1: GLASSEDGE = 2 if GLASSTOP >= heightHalf-1: GLASSTOP -= 2 # print GLASSEDGE,shapeWindowHalf # Glass shapeFill(shapeWindowHalf,materials[1%len(materials)],(0,GLASSBOT,0),(GLASSEDGE,heightHalf+GLASSTOP,0)) # Horizontals for y in xrange(0,heightHalf-GLASSBOT): depthhere = randint(0,depth) for z in xrange(1,depthhere): shapeFill(shapeWindowHalf,materials[3%len(materials)],(0,y,z),(widthHalf,y,z)) for y in xrange(heightHalf+GLASSTOP,height): depthhere = randint(0,depth) for z in xrange(1,depthhere): shapeFill(shapeWindowHalf,materials[3%len(materials)],(0,y,z),(widthHalf,y,z)) # Verticals for x in xrange(GLASSEDGE,width): depthhere = randint(0,depth) if x%width-1 == 0: depthhere = randint(1,depth) if depthhere > 0: shapeFill(shapeWindowHalf,materials[2%len(materials)],(x,0,0),(x,height-1,depthhere)) # Render b=range(4096) b.remove(0) # @CodeWarrior0 and @Wout12345 explained how to merge schematics model.copyBlocksFrom(shapeWindowHalf, BoundingBox((0,0,0),(widthHalf,height,depth)), (widthHalf-(width%2),0,0),b) # cloneSchematic(model,shapeWindowHalf,(0,0,0)) #describe(model) shapeWindowHalf.flipNorthSouth() model.copyBlocksFrom(shapeWindowHalf, BoundingBox((0,0,0),(widthHalf,height,depth)), (0,0,0),b) return model
def blockSchematicSwapper(level, box, options): # CONSTANTS method = "blockSchematicSwapper" print '%s: Started at %s' % (method, time.ctime()) (width, height, depth) = getBoxSize(box) centreWidth = width >>1 centreHeight = height >>1 centreDepth = depth >>1 AIR = (0,0) SHAPE = (200,200,200) # END CONSTANTS baseBlock = options["Choose the block to locate:"].ID baseBlockData = options["Choose the block to locate:"].blockData theFileName = options["What is the schematic to use?"] randomSchemas = options["Random Schematics?"] DIRPATH = options["Schematic Set:"] StartSchematicFiles = [] if randomSchemas == True: # Prefill a list of schematic file names which we will choose from later on StartSchematicFiles = glob.glob(DIRPATH+"/*.schematic") for fileName in StartSchematicFiles: print fileName print 'Found %s start schematic files' % (len(StartSchematicFiles)) else: # import the corresponding MCSchematic to the supplied filename print 'Loading schematic from file - %s' % (theFileName) print os.getcwd() charSchematic = MCSchematic(filename=theFileName) modeMatchBlockData = False if options["What should I look for?"] == "Match Block Data": modeMatchBlockData = True # First pass - search down-up for the block of interest. On the first hit at x/z, import schematic and move on with the search # END CONSTANTS found = 0 counter = 0 for x in xrange(box.minx, box.maxx): for z in xrange(box.minz, box.maxz): for y in xrange(box.miny, box.maxy): counter = counter +1 if counter%10000 == 0: print '%s %s: Searching at x=%s y=%s z=%s' % (method, time.ctime(), x, y, z) if modeMatchBlockData == True: if level.blockAt(x,y,z) == baseBlock and level.blockDataAt(x,y,z) == baseBlockData: print 'I found your block %s at %s %s %s with data value %s' % (baseBlock, x, y, z, baseBlockData) # level.copyBlocksFrom(charSchematic, BoundingBox((0,0,0),(1,1,1)), (x, y, z)) if randomSchemas == False: placeASchematic(x,y,z, theFileName, level, box, options) else: chosenSchematic = randint(0,len(StartSchematicFiles)) % len(StartSchematicFiles) placeASchematic(x,y,z, StartSchematicFiles[chosenSchematic], level, box, options) found = found +1 else: if level.blockAt(x,y,z) == baseBlock: print 'I found your block %s at %s %s %s' % (baseBlock, x, y, z) # level.copyBlocksFrom(charSchematic, BoundingBox((0,0,0),(2,2,2)), (x, y, z)) if randomSchemas == False: placeASchematic(x,y,z, theFileName, level, box, options) else: chosenSchematic = randint(0,len(StartSchematicFiles)) % len(StartSchematicFiles) placeASchematic(x,y,z, StartSchematicFiles[chosenSchematic], level, box, options) found = found +1 print '%s: %s. Found %s' % (method, time.ctime(), found) print '%s: Ended at %s' % (method, time.ctime())
def perform(level, box, options): # Traverse all the non-air blocks connected to the selected block at the origin of the box. AIR = 0 STONE = 1 SIZE = 127 WORKING = MCSchematic((2*SIZE,2*SIZE,2*SIZE)) DIAGONAL = options["Include diagonals?"] trackx = SIZE tracky = SIZE trackz = SIZE minx = box.minx miny = box.miny minz = box.minz maxx = box.maxx-1 maxy = box.maxy-1 maxz = box.maxz-1 count = 0 Q = [] Q.append( (box.minx, box.miny, box.minz) ) while len(Q) > 0: print '%s %s %s %s %s %s' % (minx,miny,minz,maxx,maxy,maxz) (x, y, z) = Q.pop() print '%s %s %s Popped' % (x,y,z) tx = trackx+x-box.minx ty = tracky+y-box.miny tz = trackz+z-box.minz if level.blockAt(x, y, z) != AIR and WORKING.blockAt(tx,ty,tz) == AIR: WORKING.setBlockAt(int(tx), int(ty), int(tz), STONE) print '%s %s %s = %s' % (x,y,z,level.blockAt(x, y, z)) if x < minx: minx = x if y < miny: miny = y if z < minz: minz = z if x > maxx: maxx = x if y > maxy: maxy = y if z > maxz: maxz = z Q.append( (x-1, y, z) ) Q.append( (x+1, y, z) ) Q.append( (x, y-1, z) ) Q.append( (x, y+1, z) ) Q.append( (x, y, z-1) ) Q.append( (x, y, z+1) ) # Sancarn (https://www.youtube.com/user/Sancarn) says diagonals are useful for redstone circuits if DIAGONAL == True: Q.append( (x, y-1, z-1) ) Q.append( (x-1, y, z-1) ) Q.append( (x-1, y-1, z) ) Q.append( (x, y+1, z+1) ) Q.append( (x+1, y, z+1) ) Q.append( (x+1, y+1, z) ) Q.append( (x, y+1, z-1) ) Q.append( (x+1, y, z-1) ) Q.append( (x+1, y-1, z) ) Q.append( (x, y-1, z+1) ) Q.append( (x-1, y, z+1) ) Q.append( (x-1, y+1, z) ) Q.append( (x-1, y-1, z-1) ) Q.append( (x-1, y-1, z+1) ) Q.append( (x-1, y+1, z-1) ) Q.append( (x-1, y+1, z+1) ) Q.append( (x+1, y-1, z-1) ) Q.append( (x+1, y-1, z+1) ) Q.append( (x+1, y+1, z-1) ) Q.append( (x+1, y+1, z+1) ) count = count+1 if count%1 == 10000: print '%s' % (len(Q)) editor = inspect.stack()[1][0].f_locals.get('self', None).editor # Texelelf newBox = BoundingBox( (minx,miny,minz), (maxx-minx+1,maxy-miny+1,maxz-minz+1)) editor.selectionTool.setSelection(newBox) # Texelelf editor.mainViewport.cameraPosition = (newBox.size/2)+newBox.origin # Texelelf
def perform(level, box, options): for (chunk, slices, point) in level.getChunkSlices(box): if options["Include blocks"] == True: for t in chunk.TileEntities: x = t["x"].value y = t["y"].value z = t["z"].value if (x, y, z) in box: if options["LastOutput"] == True: if "LastOutput" in t: del t["LastOutput"] if options["Include entities"] == True: for e in chunk.Entities: x = e["Pos"][0].value y = e["Pos"][1].value z = e["Pos"][2].value if (x, y, z) in box: if options["LastOutput"] == True and "LastOutput" in e: del e["LastOutput"] if options["UUID"] == True: if "UUIDMost" in e: del e["UUIDMost"] if "UUIDLeast" in e: del e["UUIDLeast"] if options["AbsorptionAmount"] == True: if "AbsorptionAmount" in e: del e["AbsorptionAmount"] if options["Air"] == True: if "Air" in e: del e["Air"] if options["Attributes"] == True: if "Attributes" in e: del e["Attributes"] if options["DeathTime"] == True: if "DeathTime" in e: del e["DeathTime"] if options["Dimension"] == True: if "Dimension" in e: del e["Dimension"] if options["Fire"] == True: if "Fire" in e: del e["Fire"] if options["HurtByTimestamp"] == True: if "HurtByTimestamp" in e: del e["HurtByTimestamp"] if options["PortalCooldown"] == True: if "PortalCooldown" in e: del e["PortalCooldown"] #Getting inputs includeAir = options["Include air"] includeBlocks = options["Include blocks"] cmdBlockHeight = options["command block height (relative only)"] relativePos = options["Relative position"] cmdBlockPosing = options["Command block positioning"] editor = inspect.stack()[1][0].f_locals.get('self', None).editor commandlist = [] cmdtemp = '' bracketsToClosetemp = 0 popOffBlocks = [ 6, 8, 9, 10, 11, 12, 13, 27, 28, 31, 32, 36, 37, 38, 39, 40, 50, 51, 55, 59, 63, 64, 65, 66, 68, 69, 70, 71, 72, 75, 76, 77, 78, 81, 83, 90, 92, 93, 94, 96, 104, 105, 106, 111, 115, 119, 122, 127, 131, 140, 141, 142, 143, 147, 148, 149, 150, 157, 167, 171, 175, 176, 177, 193, 194, 195, 196, 197 ] solids = [] #Initialising command cmd = "/summon FallingSand ~ ~+4 ~-0.1 {Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:fill ~ ~1 ~-1 ~ ~-5 ~ air},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:kill @e[type=MinecartCommandBlock,r=4]},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:MinecartCommandBlock,Command:setblock ~ ~ ~ air,Riding:{id:MinecartCommandBlock,Command:/kill @e[type=Item,r=4],Riding:" bracketsToClose = 0 #Finding redstone/doors/etc. ... if options["Include blocks"] == True: for y in xrange(box.miny, box.maxy): for x in xrange(box.minx, box.maxx): for z in xrange(box.minz, box.maxz): if level.blockAt(x, y, z) in popOffBlocks: if cmdBlockPosing == "Absolute": blockX = x blockY = y blockZ = z elif cmdBlockPosing == "Relative": blockY = y - box.miny - cmdBlockHeight - 2 if relativePos == "North-West": blockX = x - box.minx + 2 blockZ = z - box.minz + 2 if relativePos == "South-West": blockX = x - box.minx + 2 blockZ = z - box.maxz - 1 if relativePos == "North-East": blockX = x - box.maxx - 1 blockZ = z - box.minz + 2 if relativePos == "South-East": blockX = x - box.maxx - 1 blockZ = z - box.maxz - 1 else: raise Exception("WTF?") if (includeBlocks == True and level.blockAt(x, y, z) != 0): bracketsToClosetemp = 1 if level.tileEntityAt(x, y, z) == None: cmdtemp = '{id:MinecartCommandBlock,Command:"setblock' + { True: " ~", False: " " }[cmdBlockPosing == "Relative"] + str(blockX) + { True: " ~", False: " " }[cmdBlockPosing == "Relative"] + str(blockY) + { True: " ~", False: " " }[cmdBlockPosing == "Relative"] + str( blockZ) + ' ' + IDsToName[str( level.blockAt( x, y, z))] + ' ' + str( level.blockDataAt(x, y, z) ) + ' replace",Riding:' if level.tileEntityAt(x, y, z) != None: cmdtemp = '{id:MinecartCommandBlock,Command:"setblock' + { True: " ~", False: " " }[cmdBlockPosing == "Relative"] + str(blockX) + { True: " ~", False: " " }[cmdBlockPosing == "Relative"] + str(+blockY) + { True: " ~", False: " " }[cmdBlockPosing == "Relative"] + str( blockZ) + ' ' + IDsToName[str( level.blockAt( x, y, z))] + ' ' + str( level.blockDataAt(x, y, z) ) + ' replace {' + NBT2Command( level.tileEntityAt( x, y, z)) + '}",Riding:' if includeAir == True and level.blockAt(x, y, z) == 0: bracketsToClosetemp = 1 if level.tileEntityAt(x, y, z) == None: cmdtemp = '{id:MinecartCommandBlock,Command:"setblock' + { True: " ~", False: " " }[cmdBlockPosing == "Relative"] + str(blockX) + { True: " ~", False: " " }[cmdBlockPosing == "Relative"] + str(blockY) + { True: " ~", False: " " }[cmdBlockPosing == "Relative"] + str( blockZ) + ' ' + IDsToName[str( level.blockAt( x, y, z))] + ' ' + str( level.blockDataAt(x, y, z) ) + ' replace",Riding:' if level.tileEntityAt(x, y, z) != None: cmdtemp = '{id:MinecartCommandBlock,Command:"setblock' + { True: " ~", False: " " }[cmdBlockPosing == "Relative"] + str(blockX) + { True: " ~", False: " " }[cmdBlockPosing == "Relative"] + str(blockY) + { True: " ~", False: " " }[cmdBlockPosing == "Relative"] + str( blockZ) + ' ' + IDsToName[str( level.blockAt( x, y, z))] + ' ' + str( level.blockDataAt(x, y, z) ) + ' replace {' + NBT2Command( level.tileEntityAt( x, y, z)) + '}",Riding:' if cmdtemp != '': if len(cmd) + len( cmdtemp ) + bracketsToClose + 195 > 32760 and cmdBlockPosing == "Absolute": cmd += "{id:MinecartCommandBlock,Command:buffer,Riding:{id:FallingSand,Time:1,Data:0,TileID:157,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:Item,Age:5996,Motion:[0.0,0.0,-0.1]}}}}}}}}}}}}" while bracketsToClose > 0: cmd += "}" bracketsToClose -= 1 commandlist.append(cmd) cmd = "/summon FallingSand ~ ~+4 ~-0.1 {Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:fill ~ ~1 ~-1 ~ ~-5 ~ air},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:kill @e[type=MinecartCommandBlock,r=4]},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:MinecartCommandBlock,Command:setblock ~ ~ ~ air,Riding:{id:MinecartCommandBlock,Command:/kill @e[type=Item,r=4],Riding:" bracketsToClose = 0 cmd += cmdtemp cmdtemp = '' bracketsToClose += bracketsToClosetemp bracketsToClosetemp = 0 else: solids.append([x, y, z]) if len( cmd ) + 94 + bracketsToClose + 195 > 32760 and cmdBlockPosing == "Absolute": cmd += "{id:MinecartCommandBlock,Command:buffer,Riding:{id:FallingSand,Time:1,Data:0,TileID:157,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:Item,Age:5996,Motion:[0.0,0.0,-0.1]}}}}}}}}}}}}" while bracketsToClose > 0: cmd += "}" bracketsToClose -= 1 commandlist.append(cmd) cmd = "/summon FallingSand ~ ~+4 ~-0.1 {Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:fill ~ ~1 ~-1 ~ ~-5 ~ air},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:kill @e[type=MinecartCommandBlock,r=4]},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:MinecartCommandBlock,Command:setblock ~ ~ ~ air,Riding:{id:MinecartCommandBlock,Command:/kill @e[type=Item,r=4],Riding:" bracketsToClose = 0 else: cmd += '{id:MinecartCommandBlock,Command:buffer,Riding:{id:MinecartCommandBlock,Command:buffer,Riding:' bracketsToClose += 2 cmdtemp = '' bracketsToClosetemp = 0 #Building command for s in solids: x = s[0] y = s[1] z = s[2] if cmdBlockPosing == "Absolute": blockX = x blockY = y blockZ = z elif cmdBlockPosing == "Relative": blockY = y - box.miny - cmdBlockHeight - 2 if relativePos == "North-West": blockX = x - box.minx + 2 blockZ = z - box.minz + 2 if relativePos == "South-West": blockX = x - box.minx + 2 blockZ = z - box.maxz - 1 if relativePos == "North-East": blockX = x - box.maxx - 1 blockZ = z - box.minz + 2 if relativePos == "South-East": blockX = x - box.maxx - 1 blockZ = z - box.maxz - 1 else: raise Exception("WTF?") if (includeBlocks == True and level.blockAt(x, y, z) != 0): bracketsToClosetemp = 1 if level.tileEntityAt(x, y, z) == None: cmdtemp = '{id:MinecartCommandBlock,Command:"setblock' + { True: " ~", False: " " }[cmdBlockPosing == "Relative"] + str(blockX) + { True: " ~", False: " " }[cmdBlockPosing == "Relative"] + str(blockY) + { True: " ~", False: " " }[cmdBlockPosing == "Relative"] + str(blockZ) + ' ' + IDsToName[str( level.blockAt(x, y, z))] + ' ' + str( level.blockDataAt(x, y, z)) + ' replace",Riding:' if level.tileEntityAt(x, y, z) != None: cmdtemp = '{id:MinecartCommandBlock,Command:"setblock' + { True: " ~", False: " " }[cmdBlockPosing == "Relative"] + str(blockX) + { True: " ~", False: " " }[cmdBlockPosing == "Relative"] + str(+blockY) + { True: " ~", False: " " }[cmdBlockPosing == "Relative"] + str( blockZ) + ' ' + IDsToName[str(level.blockAt( x, y, z))] + ' ' + str(level.blockDataAt( x, y, z)) + ' replace {' + NBT2Command( level.tileEntityAt(x, y, z)) + '}",Riding:' if includeAir == True and level.blockAt(x, y, z) == 0: bracketsToClosetemp = 1 if level.tileEntityAt(x, y, z) == None: cmdtemp = '{id:MinecartCommandBlock,Command:"setblock' + { True: " ~", False: " " }[cmdBlockPosing == "Relative"] + str(blockX) + { True: " ~", False: " " }[cmdBlockPosing == "Relative"] + str(blockY) + { True: " ~", False: " " }[cmdBlockPosing == "Relative"] + str(blockZ) + ' ' + IDsToName[str( level.blockAt(x, y, z))] + ' ' + str( level.blockDataAt(x, y, z)) + ' replace",Riding:' if level.tileEntityAt(x, y, z) != None: cmdtemp = '{id:MinecartCommandBlock,Command:"setblock' + { True: " ~", False: " " }[cmdBlockPosing == "Relative"] + str(blockX) + { True: " ~", False: " " }[cmdBlockPosing == "Relative"] + str(blockY) + { True: " ~", False: " " }[cmdBlockPosing == "Relative"] + str( blockZ) + ' ' + IDsToName[str(level.blockAt( x, y, z))] + ' ' + str(level.blockDataAt( x, y, z)) + ' replace {' + NBT2Command( level.tileEntityAt(x, y, z)) + '}",Riding:' if cmdtemp != '': if len(cmd) + len( cmdtemp ) + bracketsToClose + 195 > 32760 and cmdBlockPosing == "Absolute": cmd += "{id:MinecartCommandBlock,Command:buffer,Riding:{id:FallingSand,Time:1,Data:0,TileID:157,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:Item,Age:5996,Motion:[0.0,0.0,-0.1]}}}}}}}}}}}}" while bracketsToClose > 0: cmd += "}" bracketsToClose -= 1 commandlist.append(cmd) cmd = "/summon FallingSand ~ ~+4 ~-0.1 {Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:fill ~ ~1 ~-1 ~ ~-5 ~ air},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:kill @e[type=MinecartCommandBlock,r=4]},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:MinecartCommandBlock,Command:setblock ~ ~ ~ air,Riding:{id:MinecartCommandBlock,Command:/kill @e[type=Item,r=4],Riding:" bracketsToClose = 0 cmd += cmdtemp cmdtemp = '' bracketsToClose += bracketsToClosetemp bracketsToClosetemp = 0 if options["Include entities"] == True: for (chunk, slices, point) in level.getChunkSlices(box): for e in chunk.Entities: ex = e["Pos"][0].value ey = e["Pos"][1].value ez = e["Pos"][2].value if (ex, ey, ez) in box: if cmdBlockPosing == "Absolute": entityX = ex entityY = ey entityZ = ez elif cmdBlockPosing == "Relative": entityY = ey - box.miny - cmdBlockHeight - 2.05 if relativePos == "North-West": entityX = ex - box.minx + 1.5 entityZ = ez - box.minz + 1.7 if relativePos == "South-West": entityX = ex - box.minx + 1.5 entityZ = ez - box.maxz - 1.3 if relativePos == "North-East": entityX = ex - box.maxx - 1.5 entityZ = ez - box.minz + 1.7 if relativePos == "South-East": entityX = ex - box.maxx - 1.5 entityZ = ez - box.maxz - 1.3 else: raise Exception("WTF?") cmdtemp = "{id:MinecartCommandBlock,Command:\"summon " + str( e["id"].value) + " " + { True: "~", False: "" }[cmdBlockPosing == "Relative"] + str(entityX) + { True: " ~", False: " " }[cmdBlockPosing == "Relative"] + str(+entityY) + { True: " ~", False: " " }[cmdBlockPosing == "Relative"] + str( entityZ) + " {" + NBT2Command(e) + "}\",Riding:" if len(cmd) + len( cmdtemp ) + bracketsToClose + 195 > 32760 and cmdBlockPosing == "Absolute": cmd += "{id:MinecartCommandBlock,Command:buffer,Riding:{id:FallingSand,Time:1,Data:0,TileID:157,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:Item,Age:5996,Motion:[0.0,0.0,-0.1]}}}}}}}}}}}}" while bracketsToClose > 0: cmd += "}" bracketsToClose -= 1 commandlist.append(cmd) cmd = "/summon FallingSand ~ ~+4 ~-0.1 {Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:fill ~ ~1 ~-1 ~ ~-5 ~ air},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:FallingSand,Time:1,Block:minecraft:command_block,TileEntityData:{Command:kill @e[type=MinecartCommandBlock,r=4]},Riding:{id:FallingSand,Time:1,Data:0,TileID:1,Riding:{id:MinecartCommandBlock,Command:setblock ~ ~ ~ air,Riding:{id:MinecartCommandBlock,Command:/kill @e[type=Item,r=4],Riding:" bracketsToClose = 0 cmd += cmdtemp bracketsToClose += 1 #Closing command's brackets if cmdBlockPosing == "Relative": #Ending command cmd += "{id:MinecartCommandBlock,Command:buffer,Riding:{id:FallingSand,Time:1,Data:0,TileID:157,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:Item,Age:5996,Motion:[0.0,0.0,-0.1]}}}}}}}}}}}}" while bracketsToClose > 0: cmd += "}" bracketsToClose -= 1 if len(cmd) > 32767: raise Exception("Command too long by " + str(len(cmd) - 32767) + " characters") #Finding control command block's place and placing it if relativePos == "North-West": level.setBlockAt(box.minx - 2, box.miny + cmdBlockHeight, box.minz - 2, 137) setCmd(box.minx - 2, box.miny + cmdBlockHeight, box.minz - 2, cmd, level) if relativePos == "South-West": level.setBlockAt(box.minx - 2, box.miny + cmdBlockHeight, box.maxz + 1, 137) setCmd(box.minx - 2, box.miny + cmdBlockHeight, box.maxz + 1, cmd, level) if relativePos == "North-East": level.setBlockAt(box.maxx + 1, box.miny + cmdBlockHeight, box.minz - 2, 137) setCmd(box.maxx + 1, box.miny + cmdBlockHeight, box.minz - 2, cmd, level) if relativePos == "South-East": level.setBlockAt(box.maxx + 1, box.miny + cmdBlockHeight, box.maxz + 1, 137) setCmd(box.maxx + 1, box.miny + cmdBlockHeight, box.maxz + 1, cmd, level) if cmdBlockPosing == "Absolute": cmd += "{id:MinecartCommandBlock,Command:buffer,Riding:{id:FallingSand,Time:1,Data:0,TileID:157,Riding:{id:FallingSand,Time:1,Data:0,TileID:152,Riding:{id:Item,Age:5996,Motion:[0.0,0.0,-0.1]}}}}}}}}}}}}" while bracketsToClose > 0: cmd += "}" bracketsToClose -= 1 commandlist.append(cmd) schematic = MCSchematic((len(commandlist) * 2, 1, 1), mats=level.materials) cx = 0 for command in commandlist: schematic.setBlockAt(cx, 0, 0, 137) schematic.setBlockDataAt(cx, 0, 0, 0) control = TAG_Compound() control["id"] = TAG_String(u'Control') control["CustomName"] = TAG_String(u"builder") control["z"] = TAG_Int(0) control["y"] = TAG_Int(0) control["x"] = TAG_Int(cx) control["Command"] = TAG_String(command) schematic.TileEntities.append(control) cx += 2 editor.addCopiedSchematic(schematic)