def perform(level, box, options): name1 = options["Entity #1 Name:"] name2 = options["Entity #2 Name:"] remove = options["Remove Entity's Names"] for (chunk, slices, point) in level.getChunkSlices(box): 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 e["CustomName"].value != '': if e["CustomName"].value == name1: e["Leashed"] = TAG_Byte(1) e["Leash"] = TAG_Compound() e["Leash"]["UUIDMost"] = TAG_Long(UM) e["Leash"]["UUIDLeast"] = TAG_Long(UL) if remove: e["CustomName"] = TAG_String() elif e["CustomName"].value == name2: UL = e["UUIDLeast"].value UM = e["UUIDMost"].value if remove: e["CustomName"] = TAG_String() chunk.dirty = True
def createEndGateway(level, options, block_ids, block_datas): for key in bk: chunk = level.getChunk(bk[key]["x"] / 16, bk[key]["z"] / 16) e = TAG_Compound() e["ExactTeleport"] = TAG_Byte(options["ExactTeleport: "]) e["x"] = TAG_Int(bk[key]["x"]) e["y"] = TAG_Int(bk[key]["y"]) e["z"] = TAG_Int(bk[key]["z"]) ep = TAG_Compound() ep["X"] = TAG_Int(tp.get("x")) ep["Y"] = TAG_Int(tp.get("y")) ep["Z"] = TAG_Int(tp.get("z")) e["ExitPortal"] = ep if options["1.11+: "]: e["id"] = TAG_String("minecraft:end_gateway") else: e["id"] = TAG_String("EndGateway") e["Age"] = TAG_Long(9223372036854775807) if options["Invisible Teleporter: "]: setBlock(level, (36, 0), bk[key]["x"], bk[key]["y"], bk[key]["z"]) else: setBlock(level, (block_ids, block_datas), bk[key]["x"], bk[key]["y"], bk[key]["z"]) chunk.TileEntities.append(e)
def toNative( canonical): # Version specific mapping to NBT from universal class # Data transformation, and any validation position = canonical.position customname = canonical.customname commandstats = canonical.commandstats # Dictionary {}. This is a runtime artifact. Should it be translated? TODO: Find out. command = canonical.command successcount = canonical.successcount lastoutput = canonical.lastoutput trackoutput = canonical.trackoutput powered = canonical.powered auto = canonical.auto conditionmet = canonical.conditionmet updatelastexecution = canonical.updatelastexecution lastexecution = canonical.lastexecution id = getNativeID() (x, y, z) = canonical.position # Create native-compatible NBT and return it control = TAG_Compound() control["id"] = TAG_String(id) control["auto"] = TAG_Byte(auto) control["powered"] = TAG_Byte(powered) control["LastExecution"] = TAG_Long(lastexecution) control["SuccessCount"] = TAG_Int(successcount) control["UpdateLastExecution"] = TAG_Byte(updatelastexecution) control["conditionMet"] = TAG_Byte(conditionmet) control["CustomName"] = TAG_String(customname) control["Command"] = TAG_String(command) control["LastOutput"] = TAG_String(lastoutput) control["TrackOutput"] = TAG_Byte(trackoutput) control["x"] = TAG_Int(x) control["y"] = TAG_Int(y) control["z"] = TAG_Int(z) return control
def performed(level, box, options): for seed in xrange(options["Max Seed"]): if goodSeed(box, long(seed)): level.root_tag["Data"]["RandomSeed"] = TAG_Long(seed) print "Found good seed: " + str(seed) return print "Didn't find good seed."
def CreateNewMapFilePE(level, number, colors): map = TAG_Compound() map["mapId"] = TAG_Long(number) map["parentMapId"] = TAG_Long(-1) map["decorations"] = TAG_List() map["dimension"] = TAG_Byte(0) map["fullyExplored"] = TAG_Byte(1) map["scale"] = TAG_Byte(4) map["height"] = TAG_Short(128) map["width"] = TAG_Short(128) map["xCenter"] = TAG_Int(2147483647) map["zCenter"] = TAG_Int(2147483647) map["colors"] = TAG_Byte_Array(colors) with level.worldFile.world_db() as db: wop = level.worldFile.writeOptions with nbt.littleEndianNBT(): db.Put(wop, 'map_' + str(number), map.save(compressed=False))
def toNative( canonical): # Version specific mapping to NBT from universal class # Data transformation, and any validation associations = updateAssociations() position = canonical.position customname = canonical.customname lock = canonical.lock items = canonical.items # list of items, which includes lists of lore and enchants loottable = canonical.loottable loottableseed = canonical.loottableseed id = getNativeID() (x, y, z) = canonical.position # Create native-compatible NBT and return it control = TAG_Compound() control["id"] = TAG_String(id) control["CustomName"] = TAG_String(customname) if lock != "": control["Lock"] = TAG_String(lock) if loottable != "": control["LootTable"] = TAG_String(loottable) control["LootTableSeed"] = TAG_Long(loottableseed) control["x"] = TAG_Int(x) control["y"] = TAG_Int(y) control["z"] = TAG_Int(z) control["Items"] = TAG_List() itemsTag = control["Items"] for (item_id, item_damage, item_slot, item_count, item_display_name, item_display_lore_l, item_tag_ench_l, item_potion) in items: item = TAG_Compound() item["id"] = TAG_Short(int(itemNameToNumber(item_id, associations))) item["Damage"] = TAG_Short(item_damage) item["Count"] = TAG_Byte(item_count) item["Slot"] = TAG_Byte(item_slot) if len(item_tag_ench_l) > 0 or item_display_name != "" or len( item_display_lore_l) > 0 or item_potion != "": item["tag"] = TAG_Compound() tag = item["tag"] if len(item_tag_ench_l) > 0: tag["ench"] = TAG_List() ench = tag["ench"] for (ench_id, ench_lvl) in item_tag_ench_l: theEnch = TAG_Compound() theEnch["id"] = TAG_Short(ench_id) theEnch["lvl"] = TAG_Short(ench_lvl) ench.append(theEnch) if len(item_display_name) != "": tag["display"] = TAG_Compound() display = tag["display"] display["Name"] = TAG_String(item_display_name) if len(item_display_lore_l) > 0: display["Lore"] = TAG_List() for lore in item_display_lore_l: display["Lore"].append(TAG_String(lore)) if item_potion != "": tag["Potion"] = TAG_String(item_potion) itemsTag.append(item) control["isMovable"] = TAG_Byte(1) return control
def createChest(lootTable, lootSeed, cx, cy, cz): if (lootSeed == 0): lootSeed = random.getrandbits(32) newte = TileEntity.Create("Chest") newte["Items"] = TAG_List() newte["LootTable"] = TAG_String(lootTable) newte["LootTableSeed"] = TAG_Long(lootSeed) newte["x"] = TAG_Int(cx) newte["y"] = TAG_Int(cy) newte["z"] = TAG_Int(cz) return newte
def CreateItemFramePE(x, y, z, mapid): iframe = TAG_Compound() iframe["id"] = TAG_String("ItemFrame") iframe["x"] = TAG_Int(x) iframe["y"] = TAG_Int(y) iframe["z"] = TAG_Int(z) iframe["Item"] = TAG_Compound() iframe["Item"]["id"] = TAG_Short(358) iframe["Item"]["Damage"] = TAG_Short(0) iframe["Item"]["Count"] = TAG_Byte(1) iframe["Item"]["tag"] = TAG_Compound() iframe["Item"]["tag"]["map_uuid"] = TAG_Long(mapid) return iframe
def perform(level, box, options): # Read in the supplied text from the nominated file filename = options["File path"] text = loadTextFromFile(filename) tagName = options["Tag to replace"] tagType = options["Tag type"] for (chunk, _, _) in level.getChunkSlices(box): print "TileEntities:" for e in chunk.TileEntities: print e #if e["id"].value == "ChalkboardBlock": if tagName in e: if tagType == "TAG_String" and type(e[tagName]) is TAG_String: e[tagName] = TAG_String(text) chunk.dirty = True elif tagType == "TAG_Byte" and type(e[tagName]) is TAG_Byte: e[tagName] = TAG_Byte(int(text)) chunk.dirty = True elif tagType == "TAG_Int" and type(e[tagName]) is TAG_Int: e[tagName] = TAG_Int(int(text)) chunk.dirty = True elif tagType == "TAG_Short" and type(e[tagName]) is TAG_Short: e[tagName] = TAG_Short(int(text)) chunk.dirty = True elif tagType == "TAG_Long" and type(e[tagName]) is TAG_Long: e[tagName] = TAG_Long(int(text)) chunk.dirty = True elif tagType == "TAG_Float" and type(e[tagName]) is TAG_Float: e[tagName] = TAG_Float(float(text)) chunk.dirty = True elif tagType == "TAG_Double" and type( e[tagName]) is TAG_Double: e[tagName] = TAG_Double(float(text)) chunk.dirty = True else: print "Tag", tagName, "of type", tagType, "is a", type( e[tagName])
def createChestBlockData2(x, y, z, options, seedtag, ItemsSmokeBox): e = TAG_Compound() e["x"] = TAG_Int(x) e["y"] = TAG_Int(y) e["z"] = TAG_Int(z) if options["(1.11+)"]: e["id"] = TAG_String("chest") else: e["id"] = TAG_String("Chest") e["Items"] = TAG_List() e["LootTableSeed"] = TAG_Long(int(seedtag)) e["CustomName"] = TAG_String("Lucky Crate") if options["(Random Loot ID)"]: foo = [ 'nether_bridge', 'village_blacksmith', 'stronghold_crossing', 'spawn_bonus_chest', 'jungle_temple', 'simple_dungeon', 'igloo_chest', 'end_city_treasure', 'desert_pyramid', 'abandoned_mineshaft' ] e["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: e["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) return e
def perform(level, box, options): try: level.gamePlatform except: raise Exception( 'This filter requires level.gamePlatform. You will need a version of MCedit that has this' ) global idcount nearest = options[ "Use Nearest-Color Transparency (recommended for lossy image formats):"] tmode = options["Transparency Mode:"] tcolor = options["Transparency Color:"] if tmode == "Use Default Color (#FF00FF)": transparent = (255, 0, 255) elif tmode == "User-Specified Color Below": if tcolor[0] == "#": alphacolor = int(tcolor[1:7], 16) transparent = (alphacolor >> 16, (alphacolor >> 8) & 0xff, alphacolor & 0xff) else: raise Exception( "ERROR! The provided transparency color was formatted incorrectly! Colors must in hexadecimal format, in the form #RRGGBB" ) return else: transparent = None invulnerable = options["Item Frames are invulnerable:"] imgpath = options["Image path:"] facing = options["Item Frames are facing:"] backing = options["Item Frame backing block (replaces air blocks only):"] if backing.ID == 0: raise Exception("ERROR! The backing block CANNOT be air!") return toosmall = options["If selection is too small for image size:"] if level.gamePlatform == 'Java': if level.dimNo: datafolder = level.parentWorld.worldFolder.getFolderPath("data") else: datafolder = level.worldFolder.getFolderPath("data") if not os.path.exists(datafolder): try: os.makedirs(datafolder) except: raise OSError( "ERROR! Data folder does not exist and could not be created. Please create a \"data\" folder at: " + datafolder) return idcountpath = os.path.join(datafolder, "idcounts.dat") if os.path.exists(idcountpath): idcountfile = nbt.load(idcountpath) if "map" in idcountfile: idcount = idcountfile["map"].value else: idcount = 0 idcountfile["map"] = TAG_Short(0) else: idcount = 0 idcountfile = TAG_Compound() idcountfile["map"] = TAG_Short(0) elif level.gamePlatform == 'PE': try: with level.worldFile.world_db() as db: rop = level.worldFile.readOptions idcountfile = loadNBTCompoundList(db.Get(rop, 'MCeditMapIt'))[0] if "map" in idcountfile: idcount = idcountfile["map"].value else: idcount = 0 idcountfile["map"] = TAG_Long(0) except: idcount = 0 idcountfile = TAG_Compound() idcountfile["map"] = TAG_Long(0) if imgpath != "None": if os.path.exists(imgpath): image_path = imgpath else: image_path = mcplatform.askOpenFile(title="Select an Image", schematics=False) else: image_path = mcplatform.askOpenFile(title="Select an Image", schematics=False) if image_path == None: raise Exception("ERROR: No file provided!") return surface = pygame.image.load(image_path) # Adrian Brightmoore # Modification to allow auto-resize to selection dimensions sx, sy, sz = box.size xsize, ysize, zsize = box.size * 128 if toosmall == "Scale to selection": if (facing == "Eastwards (-X to +X)" or facing == "Westwards (+X to -X)"): surface = pygame.transform.smoothscale(surface, (zsize, ysize)) elif (facing == "Northwards (+Z to -Z)" or facing == "Southwards (-Z to +Z)"): surface = pygame.transform.smoothscale(surface, (xsize, ysize)) (height, width) = surface.get_size() # End modification to allow auto-resize to selection dimensions loopx = int(math.ceil(float(width) / 128.0)) loopy = int(math.ceil(float(height) / 128.0)) if level.gamePlatform == 'Java': if (loopx * loopy) + idcount > 32767: raise Exception( "\nERROR! The image size is too large or there are not enough maps left for this world.\n" "Only 32,767 map files are allowed per world, and there are", idcount, "maps in this world.\n" "The image specified requires", (loopx * loopy), "maps.\n") return # elif level.gamePlatform == 'PE': # could do similar code to above but the limit is 2^63 rather than 2^15 so it will never be reached ever chestorframe = "item frames" if ysize < width: if toosmall == "Cancel Image Processing": raise Exception( "\nERROR! The selection height is too small! Your selection should be at least " + str(loopx) + "H in size.\n" "\n" "Cancelled image processing.") else: print "Creating chests instead of Item Frames" chestorframe = "chests" if chestorframe == "item frames" and (facing == "Eastwards (-X to +X)" or facing == "Westwards (+X to -X)"): if zsize < height or sx < 2: if toosmall == "Cancel Image Processing": raise Exception( "\nERROR! The selection size is too small; it selection should be at least\n" "2W x " + str(loopy) + "L x " + str(loopx) + "H in size.\n" "\n" "Cancelled image processing.") else: print "Creating chests instead of Item Frames" chestorframe = "chests" elif chestorframe == "item frames" and (facing == "Northwards (+Z to -Z)" or facing == "Southwards (-Z to +Z)"): if xsize < height or sz < 2: if toosmall == "Cancel Image Processing": raise Exception( "\nERROR! The selection size is too small; it should be at least\n" "" + str(loopy) + "W x 2L x " + str(loopx) + "H in size.\n" "\n" "Cancelled image processing.") else: print "Creating chests instead of Item Frames" chestorframe = "chests" image = numpy.fromstring(pygame.image.tostring(surface, "RGB"), dtype=numpy.uint8).reshape(width, height, 3) progresscount = 1 progressmax = loopx * loopy startid = idcount + 1 def processImageJava(image, loopx, loopy, width, height, cache, transparent, nearest, image_path, progresscount, progressmax): global idcount for lx in xrange(loopx): for ly in xrange(loopy): yield idcount - 1, progressmax, "of image " + image_path progresscount += 1 idcount += 1 converted = numpy.zeros((128, 128), dtype=numpy.uint8) offsetx = lx * 128 offsety = ly * 128 for x in xrange(128): for y in xrange(128): if (offsetx + x) >= width: break elif (offsety + y) >= height: break r, g, b = (image[offsetx + x, offsety + y, 0], image[offsetx + x, offsety + y, 1], image[offsetx + x, offsety + y, 2]) if (r, g, b) in cache: converted[x, y] = cache[(r, g, b)] else: converted[x, y] = FindClosestPaletteIndex( r, g, b, transparent, nearest) if (offsetx + x) >= width: break CreateNewMapFileJava(datafolder, idcount, converted) def processImagePE(image, loopx, loopy, width, height, image_path, progresscount, progressmax): global idcount for lx in xrange(loopx): for ly in xrange(loopy): yield idcount - 1, progressmax, "of image " + image_path progresscount += 1 idcount += 1 print idcount converted = numpy.zeros((65536), dtype=numpy.uint8) offsetx = lx * 128 offsety = ly * 128 for x in xrange(128): for y in xrange(128): if (offsetx + x) >= width: break elif (offsety + y) >= height: break r, g, b = (image[offsetx + x, offsety + y, 0], image[offsetx + x, offsety + y, 1], image[offsetx + x, offsety + y, 2]) converted[4 * (x * 128 + y)] = r converted[4 * (x * 128 + y) + 1] = g converted[4 * (x * 128 + y) + 2] = b converted[4 * (x * 128 + y) + 3] = 255 if (offsetx + x) >= width: break CreateNewMapFilePE(level, idcount, converted) if level.gamePlatform == 'Java': level.showProgress( "Processing image pieces:", processImageJava(image, loopx, loopy, width, height, cache, transparent, nearest, image_path, progresscount, progressmax)) elif level.gamePlatform == 'PE': level.showProgress( "Processing image pieces:", processImagePE(image, loopx, loopy, width, height, image_path, progresscount, progressmax)) print idcount endid = idcount print endid if level.gamePlatform == 'Java': idcountfile["map"] = TAG_Short(idcount) idcountfile.save(idcountpath, compressed=False) elif level.gamePlatform == 'PE': idcountfile["map"] = TAG_Long(idcount) with level.worldFile.world_db() as db: wop = level.worldFile.writeOptions with nbt.littleEndianNBT(): db.Put(wop, 'MCeditMapIt', idcountfile.save(compressed=False)) print "Finished processing image " + image_path + ". Creating " + chestorframe + "..." if chestorframe == "item frames": if level.gamePlatform == 'Java': if facing == "Northwards (+Z to -Z)" or facing == "Southwards (-Z to +Z)": if facing == "Northwards (+Z to -Z)": dir = 0 posIncrement = False else: dir = 2 posIncrement = True else: if facing == "Eastwards (-X to +X)": dir = 3 posIncrement = True else: dir = 1 posIncrement = False if facing == "Northwards (+Z to -Z)" or facing == "Southwards (-Z to +Z)": z = box.minz if posIncrement: z += 1 for y in xrange(box.miny - 1 + loopx, box.miny - 1, -1): for x in xrange(box.minx, box.minx + loopy) if posIncrement else xrange( box.minx - 1 + loopy, box.minx - 1, -1): level.setBlockAt(x, y, z, 0) level.setBlockDataAt(x, y, z, 0) if level.blockAt(x, y, z + (-1 if posIncrement else 1)) == 0: level.setBlockAt(x, y, z + (-1 if posIncrement else 1), backing.ID) level.setBlockDataAt( x, y, z + (-1 if posIncrement else 1), backing.blockData) chunk = level.getChunk(x >> 4, z >> 4) chunk.Entities.append( CreateItemFrameJava(x, y, z, dir, startid, invulnerable)) chunk.dirty = True startid += 1 elif facing == "Eastwards (-X to +X)" or facing == "Westwards (+X to -X)": x = box.minx if posIncrement: x += 1 for y in xrange(box.miny - 1 + loopx, box.miny - 1, -1): for z in xrange(box.minz, box.minz + loopy) if not posIncrement else xrange( box.minz - 1 + loopy, box.minz - 1, -1): level.setBlockAt(x, y, z, 0) level.setBlockDataAt(x, y, z, 0) if level.blockAt(x + (-1 if posIncrement else 1), y, z) == 0: level.setBlockAt(x + (-1 if posIncrement else 1), y, z, backing.ID) level.setBlockDataAt( x + (-1 if posIncrement else 1), y, z, backing.blockData) chunk = level.getChunk(x >> 4, z >> 4) chunk.Entities.append( CreateItemFrameJava(x, y, z, dir, startid, invulnerable)) chunk.dirty = True startid += 1 elif level.gamePlatform == 'PE': if facing == "Northwards (+Z to -Z)" or facing == "Southwards (-Z to +Z)": if facing == "Northwards (+Z to -Z)": dir = 3 posIncrement = False else: dir = 2 posIncrement = True else: if facing == "Eastwards (-X to +X)": dir = 0 posIncrement = True else: dir = 1 posIncrement = False if facing == "Northwards (+Z to -Z)" or facing == "Southwards (-Z to +Z)": z = box.minz if posIncrement: z += 1 for y in xrange(box.miny - 1 + loopx, box.miny - 1, -1): for x in xrange(box.minx, box.minx + loopy) if posIncrement else xrange( box.minx - 1 + loopy, box.minx - 1, -1): level.setBlockAt(x, y, z, 199) level.setBlockDataAt(x, y, z, dir) if level.blockAt(x, y, z + (-1 if posIncrement else 1)) == 0: level.setBlockAt(x, y, z + (-1 if posIncrement else 1), backing.ID) level.setBlockDataAt( x, y, z + (-1 if posIncrement else 1), backing.blockData) chunk = level.getChunk(x >> 4, z >> 4) chunk.TileEntities.append( CreateItemFramePE(x, y, z, startid)) chunk.dirty = True startid += 1 elif facing == "Eastwards (-X to +X)" or facing == "Westwards (+X to -X)": x = box.minx if posIncrement: x += 1 for y in xrange(box.miny - 1 + loopx, box.miny - 1, -1): for z in xrange(box.minz, box.minz + loopy) if not posIncrement else xrange( box.minz - 1 + loopy, box.minz - 1, -1): level.setBlockAt(x, y, z, 199) level.setBlockDataAt(x, y, z, dir) if level.blockAt(x + (-1 if posIncrement else 1), y, z) == 0: level.setBlockAt(x + (-1 if posIncrement else 1), y, z, backing.ID) level.setBlockDataAt( x + (-1 if posIncrement else 1), y, z, backing.blockData) chunk = level.getChunk(x >> 4, z >> 4) chunk.TileEntities.append( CreateItemFramePE(x, y, z, startid)) chunk.dirty = True startid += 1 else: if level.gamePlatform == 'Java': breakout = False entsToAdd = [] for y in xrange(box.miny, box.maxy): for z in xrange(box.minz, box.maxz): for x in xrange(box.minx, box.maxx): newchest = TAG_Compound() newchest["id"] = TAG_String("Chest") newchest["x"] = TAG_Int(x) newchest["y"] = TAG_Int(y) newchest["z"] = TAG_Int(z) newchest["Lock"] = TAG_String() newchest["Items"] = TAG_List() mapitem = TAG_Compound() mapitem["id"] = TAG_String("minecraft:filled_map") mapitem["Count"] = TAG_Byte(1) mapitem["Damage"] = TAG_Short(0) mapitem["Slot"] = TAG_Byte(0) for c in xrange(27): newitem = deepcopy(mapitem) newitem["Slot"] = TAG_Byte(c) newitem["Damage"] = TAG_Short(startid) newchest["Items"].append(newitem) startid += 1 if startid > endid: breakout = True break level.setBlockAt(x, y, z, 54) level.setBlockDataAt(x, y, z, 4) entsToAdd.append( (level.getChunk(x >> 4, z >> 4), deepcopy(newchest))) if breakout: break if breakout: break if breakout: break elif level.gamePlatform == 'PE': breakout = False entsToAdd = [] for y in xrange(box.miny, box.maxy): for z in xrange(box.minz, box.maxz): for x in xrange(box.minx, box.maxx): newchest = TAG_Compound() newchest["id"] = TAG_String("Chest") newchest["x"] = TAG_Int(x) newchest["y"] = TAG_Int(y) newchest["z"] = TAG_Int(z) newchest["Items"] = TAG_List() mapitem = TAG_Compound() mapitem["id"] = TAG_Short(358) mapitem["Count"] = TAG_Byte(16) mapitem["Damage"] = TAG_Short(0) mapitem["tag"] = TAG_Compound() for c in xrange(27): newitem = deepcopy(mapitem) newitem["Slot"] = TAG_Byte(c) newitem["tag"]["map_uuid"] = TAG_Long(startid) newchest["Items"].append(newitem) startid += 1 if startid > endid: breakout = True break level.setBlockAt(x, y, z, 54) level.setBlockDataAt(x, y, z, 4) entsToAdd.append( (level.getChunk(x >> 4, z >> 4), deepcopy(newchest))) if breakout: break if breakout: break if breakout: break for (chunk, entity) in entsToAdd: chunk.TileEntities.append(entity) chunk.dirty = True print "-------------------" print "Filtering complete."
def createChestBlockData(x, y, z, options, seedtag, ItemsSmokeBox): foo = [ 'nether_bridge', 'village_blacksmith', 'stronghold_crossing', 'spawn_bonus_chest', 'jungle_temple', 'simple_dungeon', 'igloo_chest', 'end_city_treasure', 'desert_pyramid', 'abandoned_mineshaft' ] chest = TAG_Compound() chest["y"] = TAG_Int(y) if options["(1.11+)"]: chest["id"] = TAG_String("chest") else: chest["id"] = TAG_String("Chest") chest["x"] = TAG_Int(x) chest["z"] = TAG_Int(z) items = TAG_List() minecraftchest = TAG_Compound() minecraftchest["id"] = TAG_String(u'minecraft:chest') minecraftchest["Damage"] = TAG_Short(0) minecraftchest["Count"] = TAG_Byte(64) tag = TAG_Compound() blockEntityTag = TAG_Compound() blockEntityTag["CustomName"] = TAG_String(u'Lucky Crate') if options["(Random Loot ID)"]: blockEntityTag["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: blockEntityTag["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) blockEntityTag["LootTableSeed"] = TAG_Long(int(seedtag)) tag["BlockEntityTag"] = blockEntityTag display = TAG_Compound() display["Name"] = TAG_String(u'Lucky Crate') tag["display"] = display minecraftchest["tag"] = tag minecraftchest["Slot"] = TAG_Byte(0) items.append(minecraftchest) minecraftchest2 = TAG_Compound() minecraftchest2["id"] = TAG_String(u'minecraft:chest') minecraftchest2["Damage"] = TAG_Short(0) minecraftchest2["Count"] = TAG_Byte(64) tag2 = TAG_Compound() blockEntityTag2 = TAG_Compound() blockEntityTag2["CustomName"] = TAG_String(u'Lucky Crate') if options["(Random Loot ID)"]: blockEntityTag2["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: blockEntityTag2["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) blockEntityTag2["LootTableSeed"] = TAG_Long(int(seedtag)) tag2["BlockEntityTag"] = blockEntityTag2 display2 = TAG_Compound() display2["Name"] = TAG_String(u'Lucky Crate') tag2["display"] = display2 minecraftchest2["tag"] = tag2 minecraftchest2["Slot"] = TAG_Byte(1) items.append(minecraftchest2) minecraftchest3 = TAG_Compound() minecraftchest3["id"] = TAG_String(u'minecraft:chest') minecraftchest3["Damage"] = TAG_Short(0) minecraftchest3["Count"] = TAG_Byte(64) tag3 = TAG_Compound() blockEntityTag3 = TAG_Compound() blockEntityTag3["CustomName"] = TAG_String(u'Lucky Crate') if options["(Random Loot ID)"]: blockEntityTag3["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: blockEntityTag3["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) blockEntityTag3["LootTableSeed"] = TAG_Long(int(seedtag)) tag3["BlockEntityTag"] = blockEntityTag3 display3 = TAG_Compound() display3["Name"] = TAG_String(u'Lucky Crate') tag3["display"] = display3 minecraftchest3["tag"] = tag3 minecraftchest3["Slot"] = TAG_Byte(2) items.append(minecraftchest3) minecraftchest4 = TAG_Compound() minecraftchest4["id"] = TAG_String(u'minecraft:chest') minecraftchest4["Damage"] = TAG_Short(0) minecraftchest4["Count"] = TAG_Byte(64) tag4 = TAG_Compound() blockEntityTag4 = TAG_Compound() blockEntityTag4["CustomName"] = TAG_String(u'Lucky Crate') if options["(Random Loot ID)"]: blockEntityTag4["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: blockEntityTag4["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) blockEntityTag4["LootTableSeed"] = TAG_Long(int(seedtag)) tag4["BlockEntityTag"] = blockEntityTag4 display4 = TAG_Compound() display4["Name"] = TAG_String(u'Lucky Crate') tag4["display"] = display4 minecraftchest4["tag"] = tag4 minecraftchest4["Slot"] = TAG_Byte(3) items.append(minecraftchest4) minecraftchest5 = TAG_Compound() minecraftchest5["id"] = TAG_String(u'minecraft:chest') minecraftchest5["Damage"] = TAG_Short(0) minecraftchest5["Count"] = TAG_Byte(64) tag5 = TAG_Compound() blockEntityTag5 = TAG_Compound() blockEntityTag5["CustomName"] = TAG_String(u'Lucky Crate') if options["(Random Loot ID)"]: blockEntityTag5["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: blockEntityTag5["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) blockEntityTag5["LootTableSeed"] = TAG_Long(int(seedtag)) tag5["BlockEntityTag"] = blockEntityTag5 display5 = TAG_Compound() display5["Name"] = TAG_String(u'Lucky Crate') tag5["display"] = display5 minecraftchest5["tag"] = tag5 minecraftchest5["Slot"] = TAG_Byte(4) items.append(minecraftchest5) minecraftchest6 = TAG_Compound() minecraftchest6["id"] = TAG_String(u'minecraft:chest') minecraftchest6["Damage"] = TAG_Short(0) minecraftchest6["Count"] = TAG_Byte(64) tag6 = TAG_Compound() blockEntityTag6 = TAG_Compound() blockEntityTag6["CustomName"] = TAG_String(u'Lucky Crate') if options["(Random Loot ID)"]: blockEntityTag6["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: blockEntityTag6["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) blockEntityTag6["LootTableSeed"] = TAG_Long(int(seedtag)) tag6["BlockEntityTag"] = blockEntityTag6 display6 = TAG_Compound() display6["Name"] = TAG_String(u'Lucky Crate') tag6["display"] = display6 minecraftchest6["tag"] = tag6 minecraftchest6["Slot"] = TAG_Byte(5) items.append(minecraftchest6) minecraftchest7 = TAG_Compound() minecraftchest7["id"] = TAG_String(u'minecraft:chest') minecraftchest7["Damage"] = TAG_Short(0) minecraftchest7["Count"] = TAG_Byte(64) tag7 = TAG_Compound() blockEntityTag7 = TAG_Compound() blockEntityTag7["CustomName"] = TAG_String(u'Lucky Crate') if options["(Random Loot ID)"]: blockEntityTag7["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: blockEntityTag7["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) blockEntityTag7["LootTableSeed"] = TAG_Long(int(seedtag)) tag7["BlockEntityTag"] = blockEntityTag7 display7 = TAG_Compound() display7["Name"] = TAG_String(u'Lucky Crate') tag7["display"] = display7 minecraftchest7["tag"] = tag7 minecraftchest7["Slot"] = TAG_Byte(6) items.append(minecraftchest7) minecraftchest8 = TAG_Compound() minecraftchest8["id"] = TAG_String(u'minecraft:chest') minecraftchest8["Damage"] = TAG_Short(0) minecraftchest8["Count"] = TAG_Byte(64) tag8 = TAG_Compound() blockEntityTag8 = TAG_Compound() blockEntityTag8["CustomName"] = TAG_String(u'Lucky Crate') if options["(Random Loot ID)"]: blockEntityTag8["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: blockEntityTag8["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) blockEntityTag8["LootTableSeed"] = TAG_Long(int(seedtag)) tag8["BlockEntityTag"] = blockEntityTag8 display8 = TAG_Compound() display8["Name"] = TAG_String(u'Lucky Crate') tag8["display"] = display8 minecraftchest8["tag"] = tag8 minecraftchest8["Slot"] = TAG_Byte(7) items.append(minecraftchest8) minecraftchest9 = TAG_Compound() minecraftchest9["id"] = TAG_String(u'minecraft:chest') minecraftchest9["Damage"] = TAG_Short(0) minecraftchest9["Count"] = TAG_Byte(64) tag9 = TAG_Compound() blockEntityTag9 = TAG_Compound() blockEntityTag9["CustomName"] = TAG_String(u'Lucky Crate') if options["(Random Loot ID)"]: blockEntityTag9["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: blockEntityTag9["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) blockEntityTag9["LootTableSeed"] = TAG_Long(int(seedtag)) tag9["BlockEntityTag"] = blockEntityTag9 display9 = TAG_Compound() display9["Name"] = TAG_String(u'Lucky Crate') tag9["display"] = display9 minecraftchest9["tag"] = tag9 minecraftchest9["Slot"] = TAG_Byte(8) items.append(minecraftchest9) minecraftchest10 = TAG_Compound() minecraftchest10["id"] = TAG_String(u'minecraft:chest') minecraftchest10["Damage"] = TAG_Short(0) minecraftchest10["Count"] = TAG_Byte(64) tag10 = TAG_Compound() blockEntityTag10 = TAG_Compound() blockEntityTag10["CustomName"] = TAG_String(u'Lucky Crate') if options["(Random Loot ID)"]: blockEntityTag10["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: blockEntityTag10["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) blockEntityTag10["LootTableSeed"] = TAG_Long(int(seedtag)) tag10["BlockEntityTag"] = blockEntityTag10 display10 = TAG_Compound() display10["Name"] = TAG_String(u'Lucky Crate') tag10["display"] = display10 minecraftchest10["tag"] = tag10 minecraftchest10["Slot"] = TAG_Byte(9) items.append(minecraftchest10) minecraftchest11 = TAG_Compound() minecraftchest11["id"] = TAG_String(u'minecraft:chest') minecraftchest11["Damage"] = TAG_Short(0) minecraftchest11["Count"] = TAG_Byte(64) tag11 = TAG_Compound() blockEntityTag11 = TAG_Compound() blockEntityTag11["CustomName"] = TAG_String(u'Lucky Crate') if options["(Random Loot ID)"]: blockEntityTag11["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: blockEntityTag11["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) blockEntityTag11["LootTableSeed"] = TAG_Long(int(seedtag)) tag11["BlockEntityTag"] = blockEntityTag11 display11 = TAG_Compound() display11["Name"] = TAG_String(u'Lucky Crate') tag11["display"] = display11 minecraftchest11["tag"] = tag11 minecraftchest11["Slot"] = TAG_Byte(10) items.append(minecraftchest11) minecraftchest12 = TAG_Compound() minecraftchest12["id"] = TAG_String(u'minecraft:chest') minecraftchest12["Damage"] = TAG_Short(0) minecraftchest12["Count"] = TAG_Byte(64) tag12 = TAG_Compound() blockEntityTag12 = TAG_Compound() blockEntityTag12["CustomName"] = TAG_String(u'Lucky Crate') if options["(Random Loot ID)"]: blockEntityTag12["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: blockEntityTag12["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) blockEntityTag12["LootTableSeed"] = TAG_Long(int(seedtag)) tag12["BlockEntityTag"] = blockEntityTag12 display12 = TAG_Compound() display12["Name"] = TAG_String(u'Lucky Crate') tag12["display"] = display12 minecraftchest12["tag"] = tag12 minecraftchest12["Slot"] = TAG_Byte(10) items.append(minecraftchest12) minecraftchest13 = TAG_Compound() minecraftchest13["id"] = TAG_String(u'minecraft:chest') minecraftchest13["Damage"] = TAG_Short(0) minecraftchest13["Count"] = TAG_Byte(64) tag13 = TAG_Compound() blockEntityTag13 = TAG_Compound() blockEntityTag13["CustomName"] = TAG_String(u'Lucky Crate') if options["(Random Loot ID)"]: blockEntityTag13["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: blockEntityTag13["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) blockEntityTag13["LootTableSeed"] = TAG_Long(int(seedtag)) tag13["BlockEntityTag"] = blockEntityTag13 display13 = TAG_Compound() display13["Name"] = TAG_String(u'Lucky Crate') tag13["display"] = display13 minecraftchest13["tag"] = tag13 minecraftchest13["Slot"] = TAG_Byte(11) items.append(minecraftchest13) minecraftchest14 = TAG_Compound() minecraftchest14["id"] = TAG_String(u'minecraft:chest') minecraftchest14["Damage"] = TAG_Short(0) minecraftchest14["Count"] = TAG_Byte(64) tag14 = TAG_Compound() blockEntityTag14 = TAG_Compound() blockEntityTag14["CustomName"] = TAG_String(u'Lucky Crate') if options["(Random Loot ID)"]: blockEntityTag14["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: blockEntityTag14["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) blockEntityTag14["LootTableSeed"] = TAG_Long(int(seedtag)) tag14["BlockEntityTag"] = blockEntityTag14 display14 = TAG_Compound() display14["Name"] = TAG_String(u'Lucky Crate') tag14["display"] = display14 minecraftchest14["tag"] = tag14 minecraftchest14["Slot"] = TAG_Byte(12) items.append(minecraftchest14) minecraftchest15 = TAG_Compound() minecraftchest15["id"] = TAG_String(u'minecraft:chest') minecraftchest15["Damage"] = TAG_Short(0) minecraftchest15["Count"] = TAG_Byte(64) tag15 = TAG_Compound() blockEntityTag15 = TAG_Compound() blockEntityTag15["CustomName"] = TAG_String(u'Lucky Crate') if options["(Random Loot ID)"]: blockEntityTag15["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: blockEntityTag15["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) blockEntityTag15["LootTableSeed"] = TAG_Long(int(seedtag)) tag15["BlockEntityTag"] = blockEntityTag15 display15 = TAG_Compound() display15["Name"] = TAG_String(u'Lucky Crate') tag15["display"] = display15 minecraftchest15["tag"] = tag15 minecraftchest15["Slot"] = TAG_Byte(13) items.append(minecraftchest15) minecraftchest16 = TAG_Compound() minecraftchest16["id"] = TAG_String(u'minecraft:chest') minecraftchest16["Damage"] = TAG_Short(0) minecraftchest16["Count"] = TAG_Byte(64) tag16 = TAG_Compound() blockEntityTag16 = TAG_Compound() blockEntityTag16["CustomName"] = TAG_String(u'Lucky Crate') if options["(Random Loot ID)"]: blockEntityTag16["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: blockEntityTag16["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) blockEntityTag16["LootTableSeed"] = TAG_Long(int(seedtag)) tag16["BlockEntityTag"] = blockEntityTag16 display16 = TAG_Compound() display16["Name"] = TAG_String(u'Lucky Crate') tag16["display"] = display16 minecraftchest16["tag"] = tag16 minecraftchest16["Slot"] = TAG_Byte(14) items.append(minecraftchest16) minecraftchest17 = TAG_Compound() minecraftchest17["id"] = TAG_String(u'minecraft:chest') minecraftchest17["Damage"] = TAG_Short(0) minecraftchest17["Count"] = TAG_Byte(64) tag17 = TAG_Compound() blockEntityTag17 = TAG_Compound() blockEntityTag17["CustomName"] = TAG_String(u'Lucky Crate') if options["(Random Loot ID)"]: blockEntityTag17["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: blockEntityTag17["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) blockEntityTag17["LootTableSeed"] = TAG_Long(int(seedtag)) tag17["BlockEntityTag"] = blockEntityTag17 display17 = TAG_Compound() display17["Name"] = TAG_String(u'Lucky Crate') tag17["display"] = display17 minecraftchest17["tag"] = tag17 minecraftchest17["Slot"] = TAG_Byte(15) items.append(minecraftchest17) minecraftchest18 = TAG_Compound() minecraftchest18["id"] = TAG_String(u'minecraft:chest') minecraftchest18["Damage"] = TAG_Short(0) minecraftchest18["Count"] = TAG_Byte(64) tag18 = TAG_Compound() blockEntityTag18 = TAG_Compound() blockEntityTag18["CustomName"] = TAG_String(u'Lucky Crate') if options["(Random Loot ID)"]: blockEntityTag18["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: blockEntityTag18["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) blockEntityTag18["LootTableSeed"] = TAG_Long(int(seedtag)) tag18["BlockEntityTag"] = blockEntityTag18 display18 = TAG_Compound() display18["Name"] = TAG_String(u'Lucky Crate') tag18["display"] = display18 minecraftchest18["tag"] = tag18 minecraftchest18["Slot"] = TAG_Byte(16) items.append(minecraftchest18) minecraftchest19 = TAG_Compound() minecraftchest19["id"] = TAG_String(u'minecraft:chest') minecraftchest19["Damage"] = TAG_Short(0) minecraftchest19["Count"] = TAG_Byte(64) tag19 = TAG_Compound() blockEntityTag19 = TAG_Compound() blockEntityTag19["CustomName"] = TAG_String(u'Lucky Crate') if options["(Random Loot ID)"]: blockEntityTag19["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: blockEntityTag19["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) blockEntityTag19["LootTableSeed"] = TAG_Long(int(seedtag)) tag19["BlockEntityTag"] = blockEntityTag19 display19 = TAG_Compound() display19["Name"] = TAG_String(u'Lucky Crate') tag19["display"] = display19 minecraftchest19["tag"] = tag19 minecraftchest19["Slot"] = TAG_Byte(17) items.append(minecraftchest19) minecraftchest20 = TAG_Compound() minecraftchest20["id"] = TAG_String(u'minecraft:chest') minecraftchest20["Damage"] = TAG_Short(0) minecraftchest20["Count"] = TAG_Byte(64) tag20 = TAG_Compound() blockEntityTag20 = TAG_Compound() blockEntityTag20["CustomName"] = TAG_String(u'Lucky Crate') if options["(Random Loot ID)"]: blockEntityTag20["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: blockEntityTag20["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) blockEntityTag20["LootTableSeed"] = TAG_Long(int(seedtag)) tag20["BlockEntityTag"] = blockEntityTag20 display20 = TAG_Compound() display20["Name"] = TAG_String(u'Lucky Crate') tag20["display"] = display20 minecraftchest20["tag"] = tag20 minecraftchest20["Slot"] = TAG_Byte(18) items.append(minecraftchest20) minecraftchest21 = TAG_Compound() minecraftchest21["id"] = TAG_String(u'minecraft:chest') minecraftchest21["Damage"] = TAG_Short(0) minecraftchest21["Count"] = TAG_Byte(64) tag21 = TAG_Compound() blockEntityTag21 = TAG_Compound() blockEntityTag21["CustomName"] = TAG_String(u'Lucky Crate') if options["(Random Loot ID)"]: blockEntityTag21["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: blockEntityTag21["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) blockEntityTag21["LootTableSeed"] = TAG_Long(int(seedtag)) tag21["BlockEntityTag"] = blockEntityTag21 display21 = TAG_Compound() display21["Name"] = TAG_String(u'Lucky Crate') tag21["display"] = display21 minecraftchest21["tag"] = tag21 minecraftchest21["Slot"] = TAG_Byte(19) items.append(minecraftchest21) minecraftchest22 = TAG_Compound() minecraftchest22["id"] = TAG_String(u'minecraft:chest') minecraftchest22["Damage"] = TAG_Short(0) minecraftchest22["Count"] = TAG_Byte(64) tag22 = TAG_Compound() blockEntityTag22 = TAG_Compound() blockEntityTag22["CustomName"] = TAG_String(u'Lucky Crate') if options["(Random Loot ID)"]: blockEntityTag22["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: blockEntityTag22["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) blockEntityTag22["LootTableSeed"] = TAG_Long(int(seedtag)) tag22["BlockEntityTag"] = blockEntityTag22 display22 = TAG_Compound() display22["Name"] = TAG_String(u'Lucky Crate') tag22["display"] = display22 minecraftchest22["tag"] = tag22 minecraftchest22["Slot"] = TAG_Byte(20) items.append(minecraftchest22) minecraftchest23 = TAG_Compound() minecraftchest23["id"] = TAG_String(u'minecraft:chest') minecraftchest23["Damage"] = TAG_Short(0) minecraftchest23["Count"] = TAG_Byte(64) tag23 = TAG_Compound() blockEntityTag23 = TAG_Compound() blockEntityTag23["CustomName"] = TAG_String(u'Lucky Crate') if options["(Random Loot ID)"]: blockEntityTag23["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: blockEntityTag23["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) blockEntityTag23["LootTableSeed"] = TAG_Long(int(seedtag)) tag23["BlockEntityTag"] = blockEntityTag23 display23 = TAG_Compound() display23["Name"] = TAG_String(u'Lucky Crate') tag23["display"] = display23 minecraftchest23["tag"] = tag23 minecraftchest23["Slot"] = TAG_Byte(21) items.append(minecraftchest23) minecraftchest24 = TAG_Compound() minecraftchest24["id"] = TAG_String(u'minecraft:chest') minecraftchest24["Damage"] = TAG_Short(0) minecraftchest24["Count"] = TAG_Byte(64) tag24 = TAG_Compound() blockEntityTag24 = TAG_Compound() blockEntityTag24["CustomName"] = TAG_String(u'Lucky Crate') if options["(Random Loot ID)"]: blockEntityTag24["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: blockEntityTag24["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) blockEntityTag24["LootTableSeed"] = TAG_Long(int(seedtag)) tag24["BlockEntityTag"] = blockEntityTag24 display24 = TAG_Compound() display24["Name"] = TAG_String(u'Lucky Crate') tag24["display"] = display24 minecraftchest24["tag"] = tag24 minecraftchest24["Slot"] = TAG_Byte(22) items.append(minecraftchest24) minecraftchest25 = TAG_Compound() minecraftchest25["id"] = TAG_String(u'minecraft:chest') minecraftchest25["Damage"] = TAG_Short(0) minecraftchest25["Count"] = TAG_Byte(64) tag25 = TAG_Compound() blockEntityTag25 = TAG_Compound() blockEntityTag25["CustomName"] = TAG_String(u'Lucky Crate') if options["(Random Loot ID)"]: blockEntityTag25["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: blockEntityTag25["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) blockEntityTag25["LootTableSeed"] = TAG_Long(int(seedtag)) tag25["BlockEntityTag"] = blockEntityTag25 display25 = TAG_Compound() display25["Name"] = TAG_String(u'Lucky Crate') tag25["display"] = display25 minecraftchest25["tag"] = tag25 minecraftchest25["Slot"] = TAG_Byte(23) items.append(minecraftchest25) minecraftchest26 = TAG_Compound() minecraftchest26["id"] = TAG_String(u'minecraft:chest') minecraftchest26["Damage"] = TAG_Short(0) minecraftchest26["Count"] = TAG_Byte(64) tag26 = TAG_Compound() blockEntityTag26 = TAG_Compound() blockEntityTag26["CustomName"] = TAG_String(u'Lucky Crate') if options["(Random Loot ID)"]: blockEntityTag26["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: blockEntityTag26["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) blockEntityTag26["LootTableSeed"] = TAG_Long(int(seedtag)) tag26["BlockEntityTag"] = blockEntityTag26 display26 = TAG_Compound() display26["Name"] = TAG_String(u'Lucky Crate') tag26["display"] = display26 minecraftchest26["tag"] = tag26 minecraftchest26["Slot"] = TAG_Byte(25) items.append(minecraftchest26) minecraftchest27 = TAG_Compound() minecraftchest27["id"] = TAG_String(u'minecraft:chest') minecraftchest27["Damage"] = TAG_Short(0) minecraftchest27["Count"] = TAG_Byte(64) tag27 = TAG_Compound() blockEntityTag27 = TAG_Compound() blockEntityTag27["CustomName"] = TAG_String(u'Lucky Crate') if options["(Random Loot ID)"]: blockEntityTag27["LootTable"] = TAG_String("minecraft:chests/" + random.choice(foo)) else: blockEntityTag27["LootTable"] = TAG_String("minecraft:chests/" + str(ItemsSmokeBox)) blockEntityTag27["LootTableSeed"] = TAG_Long(int(seedtag)) tag27["BlockEntityTag"] = blockEntityTag27 display27 = TAG_Compound() display27["Name"] = TAG_String(u'Lucky Crate') tag27["display"] = display27 minecraftchest27["tag"] = tag27 minecraftchest27["Slot"] = TAG_Byte(27) items.append(minecraftchest27) chest["Items"] = items return chest
def perform(level, box, options): #Block ID Selection blockids = dict([(trn._(a), b) for a, b in Smokeboxs.items()])[options["Block: "]] #Editing Operation editop = Ops[options["Operation: "]] #Create if editop == "create": #Scan Selection Box for x in xrange(box.minx, box.maxx): for y in xrange(box.miny, box.maxy): for z in xrange(box.minz, box.maxz): #Define Chunk Accessor chunk7 = level.getChunk(x / 16, z / 16) #Get Data Of TileEntitiy tiles2 = level.tileEntityAt(x, y, z) #Check If A TileEntity Exist In The Selection if tiles2 in chunk7.TileEntities and tiles2 != None: #Remove TileEntity chunk7.TileEntities.remove(tiles2) #Set Block From Input level.setBlockAt(x, y, z, blockids) level.setBlockDataAt(x, y, z, options["Data: "]) #Create TileEntity NBT Data endGateway2 = TAG_Compound() endGateway2["ExactTeleport"] = TAG_Byte( options["ExactTeleport: "]) endGateway2["x"] = TAG_Int(x) endGateway2["y"] = TAG_Int(y) endGateway2["z"] = TAG_Int(z) exitPortal2 = TAG_Compound() exitPortal2["X"] = TAG_Int(options["GoTo X: "]) exitPortal2["Y"] = TAG_Int(options["GoTo Y: "]) exitPortal2["Z"] = TAG_Int(options["GoTo Z: "]) endGateway2["ExitPortal"] = exitPortal2 endGateway2["Age"] = TAG_Long(options["Age: "]) #If 1.11+ World Changes id if options["1.11+: "]: endGateway2["id"] = TAG_String("minecraft:end_gateway") else: endGateway2["id"] = TAG_String("EndGateway") #Add TileEntity chunk7.TileEntities.append(endGateway2) #Marks Chunks As Dirt For ReLighting chunk7.dirty = True #Edit elif editop == "edit": #Scan Selection Box for (chunk, slices, point) in level.getChunkSlices(box): #Scan Chunks In Selection For TileEntities for te in chunk.TileEntities: #Get TileEntities X,Y,Z Coordinates x = te["x"].value y = te["y"].value z = te["z"].value #Check If TileEntities Are In Selection Box if (x, y, z) in box: #Check If Its An Endgateway if te["id"].value in [ "EndGateway", "minecraft:end_gateway" ]: #Place Block And Data level.setBlockAt(x, y, z, blockids) level.setBlockDataAt(x, y, z, options["Data: "]) #Create TileEntity NBT Data te["ExactTeleport"] = TAG_Byte( options["ExactTeleport: "]) te["Age"] = TAG_Long(options["Age: "]) te["ExitPortal"]["X"] = TAG_Int(options["GoTo X: "]) te["ExitPortal"]["Y"] = TAG_Int(options["GoTo Y: "]) te["ExitPortal"]["Z"] = TAG_Int(options["GoTo Z: "]) #If 1.11+ World Changes id if options["1.11+: "]: te["id"] = TAG_String("minecraft:end_gateway") else: te["id"] = TAG_String("EndGateway") #Marks Chunks As Dirt For ReLighting chunk.dirty = True #Remove elif editop == "remove": #Deleted EndGateWays In The Selection deleteAllEndGateWays(box, level) else: #Print Error Unknown Operation! Message To Console print "Error Unknown Operation!" raise ValueError('Error Unknown Operation! Tracingback: ') #Print Completed Sucessfully! Message To Console print "Completed Sucessfully!"