def lavaDispenser(x, y, z): trap = TAG_Compound() trap["id"] = TAG_String(u'Trap') items = TAG_List() item = TAG_Compound() item["id"] = TAG_Short(327) item["Damage"] = TAG_Short(0) item["Count"] = TAG_Byte(1) item["Slot"] = TAG_Byte(4) items.append(item) trap["Items"] = items trap["x"] = TAG_Int(x) trap["y"] = TAG_Int(y) trap["z"] = TAG_Int(z) return trap
def createShop(level, x, y, z): chest = level.tileEntityAt(x, y, z) if chest == None: return priceList = {} saleList = {} profession = 0 riches = 0 for item in chest["Items"]: slot = item["Slot"].value if slot >= 0 and slot <= 8: priceList[slot] = item elif slot >= 9 and slot <= 17: saleList[slot-9] = item elif slot == 18: if item["id"].value == 35: dmg = item["Damage"].value if dmg == 12: profession = 0 #brown villager elif dmg == 0: profession = 1 #white villager elif dmg == 2 or dmg == 6 or dmg == 10 or dmg == 14: profession = 2 #purple villager elif dmg == 15 or dmg == 7: profession = 3 #black apron villager elif dmg == 8: profession = 4 #white apron villager elif dmg == 5 or dmg == 13: profession = 5 #green villager else: riches += item["Count"].value #other slots are used to count towards the "riches" total villager = TAG_Compound() villager["OnGround"] = TAG_Byte(1) villager["Air"] = TAG_Short(300) villager["AttackTime"] = TAG_Short(0) villager["DeathTime"] = TAG_Short(0) villager["Fire"] = TAG_Short(-1) villager["Health"] = TAG_Short(20) villager["HurtTime"] = TAG_Short(0) villager["Age"] = TAG_Int(0) villager["Profession"] = TAG_Int(profession) villager["Riches"] = TAG_Int(riches) villager["FallDistance"] = TAG_Float(0) villager["id"] = TAG_String("Villager") villager["Motion"] = TAG_List() villager["Motion"].append(TAG_Double(0)) villager["Motion"].append(TAG_Double(0)) villager["Motion"].append(TAG_Double(0)) villager["Pos"] = TAG_List() villager["Pos"].append(TAG_Double(x + 0.5)) villager["Pos"].append(TAG_Double(y)) villager["Pos"].append(TAG_Double(z + 0.5)) villager["Rotation"] = TAG_List() villager["Rotation"].append(TAG_Float(0)) villager["Rotation"].append(TAG_Float(0)) villager["Offers"] = TAG_Compound() villager["Offers"]["Recipes"] = TAG_List() for i in range(9): if i in priceList and i in saleList: offer = TAG_Compound() offer["buy"] = priceList[i] offer["sell"] = saleList[i] villager["Offers"]["Recipes"].append(offer) level.setBlockAt(x, y, z, 0) chunk = level.getChunk(x / 16, z / 16) chunk.Entities.append(villager) chunk.TileEntities.remove(chest) chunk.dirty = True
spawner["z"] = TAG_Int(z) spawner["Delay"] = TAG_Short(delay) spawner["MinSpawnDelay"] = TAG_Short(loopTicks) spawner["MaxSpawnDelay"] = TAG_Short(loopTicks) spawner["SpawnCount"] = TAG_Short(1) spawner["MaxNearbyEntities"] = TAG_Short(10000) spawner["RequiredPlayerRange"] = TAG_Short(range) # Creates a spawner with certain aspects return spawner def createPotion((x, y, z), (vx, vy, vz), effect, duration, amp, potionId): thrownPotion = TAG_Compound() thrownPotion["yTile"] = TAG_Short(-1) motion = TAG_List() motion.append(TAG_Double(vx)) motion.append(TAG_Double(vy)) motion.append(TAG_Double(vz)) thrownPotion["Motion"] = motion thrownPotion["OnGround"] = TAG_Byte(0) thrownPotion["inGround"] = TAG_Byte(0) thrownPotion["shake"] = TAG_Byte(0) thrownPotion["Dimension"] = TAG_Int(0) thrownPotion["inTile"] = TAG_Byte(0) thrownPotion["Air"] = TAG_Short(300) thrownPotion["id"] = TAG_String(u'ThrownPotion') pos = TAG_List() pos.append(TAG_Double(x))
def perform(level, box, options): for x in xrange(box.minx, box.maxx): for y in xrange(box.miny, box.maxy): for z in xrange(box.minz, box.maxz): block = level.blockAt(x, y, z) data = level.blockDataAt(x, y, z) extrab = options["Use Slime Blocks"] ItemsSmokeBox2 = Smokeboxs2[options["Minecraft Type"]] chunk = level.getChunk(x / 16, z / 16) areaEffectCloud = TAG_Compound() if options["1.11+ or 1.11.2+"]: areaEffectCloud["id"] = TAG_String(u'area_effect_cloud') if options["1.11+ or 1.11.2+"] != True: areaEffectCloud["id"] = TAG_String(u'AreaEffectCloud') areaEffectCloud["ownerUUID"] = TAG_String(u'') areaEffectCloud["OnGround"] = TAG_Byte(0) areaEffectCloud["Dimension"] = TAG_Int(0) areaEffectCloud["Air"] = TAG_Short(300) areaEffectCloud["ParticleParam2"] = TAG_Int(0) areaEffectCloud["ParticleParam1"] = TAG_Int(0) if ItemsSmokeBox2 == "PC": areaEffectCloud["Particle"] = TAG_String(u"take") if ItemsSmokeBox2 != "PC": areaEffectCloud["Particle"] = TAG_Int(0) areaEffectCloud["ReapplicationDelay"] = TAG_Int(0) rotation = TAG_List() rotation.append(TAG_Float(0.0)) rotation.append(TAG_Float(0.0)) areaEffectCloud["Rotation"] = rotation areaEffectCloud["FallDistance"] = TAG_Float(0.0) effects = TAG_List() effect = TAG_Compound() effect["Amplifier"] = TAG_Byte(15) effect["Id"] = TAG_Byte(25) effect["Duration"] = TAG_Int(10) effect["Ambient"] = TAG_Byte(0) effect["ShowParticles"] = TAG_Byte(0) effects.append(effect) effect2 = TAG_Compound() effect2["Amplifier"] = TAG_Byte(100) effect2["Id"] = TAG_Byte(11) effect2["Duration"] = TAG_Int(100) effect2["Ambient"] = TAG_Byte(0) effect2["ShowParticles"] = TAG_Byte(0) effects.append(effect2) effect3 = TAG_Compound() effect3["Amplifier"] = TAG_Byte(20) effect3["Id"] = TAG_Byte(8) effect3["Duration"] = TAG_Int(40) effect3["Ambient"] = TAG_Byte(0) effect3["ShowParticles"] = TAG_Byte(0) effects.append(effect3) areaEffectCloud["Effects"] = effects areaEffectCloud["Fire"] = TAG_Short(0) areaEffectCloud["Invulnerable"] = TAG_Byte(0) areaEffectCloud["PortalCooldown"] = TAG_Int(0) areaEffectCloud["CustomName"] = TAG_String(u'') areaEffectCloud["createdOnHost"] = TAG_Byte(0) areaEffectCloud["Silent"] = TAG_Byte(1) areaEffectCloud["NoGravity"] = TAG_Byte(1) areaEffectCloud["Glowing"] = TAG_Byte(0) areaEffectCloud["Age"] = TAG_Int(1) areaEffectCloud["RadiusOnUse"] = TAG_Float(0.0) areaEffectCloud["Duration"] = TAG_Int(2147483647) areaEffectCloud["DurationOnUse"] = TAG_Int(0) areaEffectCloud["WaitTime"] = TAG_Int(0) areaEffectCloud["RadiusPerTick"] = TAG_Float(0.0) areaEffectCloud["Radius"] = TAG_Float(2.5) areaEffectCloud["Color"] = TAG_Int(0) areaEffectCloud["Potion"] = TAG_String(u'minecraft:leaping') pos = TAG_List() pos.append(TAG_Double(x + 0.5)) pos.append(TAG_Double(y + 5)) pos.append(TAG_Double(z + 0.5)) areaEffectCloud["Pos"] = pos motion = TAG_List() motion.append(TAG_Double(0.0)) motion.append(TAG_Double(0.0)) motion.append(TAG_Double(0.0)) areaEffectCloud["Motion"] = motion areaEffectCloud2 = TAG_Compound() if options["1.11+ or 1.11.2+"]: areaEffectCloud2["id"] = TAG_String(u'area_effect_cloud') if options["1.11+ or 1.11.2+"] != True: areaEffectCloud2["id"] = TAG_String(u'AreaEffectCloud') areaEffectCloud2["ownerUUID"] = TAG_String(u'') areaEffectCloud2["OnGround"] = TAG_Byte(0) areaEffectCloud2["Dimension"] = TAG_Int(0) areaEffectCloud2["Air"] = TAG_Short(300) areaEffectCloud2["ParticleParam2"] = TAG_Int(0) areaEffectCloud2["ParticleParam1"] = TAG_Int(0) if ItemsSmokeBox2 == "PC": areaEffectCloud2["Particle"] = TAG_String(u"take") if ItemsSmokeBox2 != "PC": areaEffectCloud2["Particle"] = TAG_Int(0) areaEffectCloud2["ReapplicationDelay"] = TAG_Int(0) rotation2 = TAG_List() rotation2.append(TAG_Float(0.0)) rotation2.append(TAG_Float(0.0)) areaEffectCloud2["Rotation"] = rotation2 areaEffectCloud2["FallDistance"] = TAG_Float(0.0) effects2 = TAG_List() effect4 = TAG_Compound() effect4["Amplifier"] = TAG_Byte(15) effect4["Id"] = TAG_Byte(25) effect4["Duration"] = TAG_Int(10) effect4["Ambient"] = TAG_Byte(0) effect4["ShowParticles"] = TAG_Byte(0) effects2.append(effect4) effect5 = TAG_Compound() effect5["Amplifier"] = TAG_Byte(100) effect5["Id"] = TAG_Byte(11) effect5["Duration"] = TAG_Int(100) effect5["Ambient"] = TAG_Byte(0) effect5["ShowParticles"] = TAG_Byte(0) effects2.append(effect5) effect6 = TAG_Compound() effect6["Amplifier"] = TAG_Byte(20) effect6["Id"] = TAG_Byte(8) effect6["Duration"] = TAG_Int(40) effect6["Ambient"] = TAG_Byte(0) effect6["ShowParticles"] = TAG_Byte(0) effects2.append(effect6) areaEffectCloud2["Effects"] = effects2 areaEffectCloud2["Fire"] = TAG_Short(0) areaEffectCloud2["Invulnerable"] = TAG_Byte(0) areaEffectCloud2["PortalCooldown"] = TAG_Int(0) areaEffectCloud2["CustomName"] = TAG_String(u'') areaEffectCloud2["createdOnHost"] = TAG_Byte(0) areaEffectCloud2["Silent"] = TAG_Byte(1) areaEffectCloud2["NoGravity"] = TAG_Byte(1) areaEffectCloud2["Glowing"] = TAG_Byte(0) areaEffectCloud2["Age"] = TAG_Int(1) areaEffectCloud2["RadiusOnUse"] = TAG_Float(0.0) areaEffectCloud2["Duration"] = TAG_Int(2147483647) areaEffectCloud2["DurationOnUse"] = TAG_Int(0) areaEffectCloud2["WaitTime"] = TAG_Int(0) areaEffectCloud2["RadiusPerTick"] = TAG_Float(0.0) areaEffectCloud2["Radius"] = TAG_Float(2.5) areaEffectCloud2["Color"] = TAG_Int(0) areaEffectCloud2["Potion"] = TAG_String(u'minecraft:leaping') pos2 = TAG_List() pos2.append(TAG_Double(x + 0.5)) pos2.append(TAG_Double(y + 1.1)) pos2.append(TAG_Double(z + 0.5)) areaEffectCloud2["Pos"] = pos2 motion2 = TAG_List() motion2.append(TAG_Double(0.0)) motion2.append(TAG_Double(0.0)) motion2.append(TAG_Double(0.0)) areaEffectCloud2["Motion"] = motion2 chunk.Entities.append(areaEffectCloud2) chunk.Entities.append(areaEffectCloud) print "Created Trampoline! Successfully" chunk.dirty = True #Blackwool #3x3 level.setBlockAt(x, y + 1, z, 171) level.setBlockDataAt(x, y + 1, z, 15) level.setBlockAt(x + 1, y + 1, z, 171) level.setBlockDataAt(x + 1, y + 1, z, 15) level.setBlockAt(x, y + 1, z + 1, 171) level.setBlockDataAt(x, y + 1, z + 1, 15) level.setBlockAt(x + 1, y + 1, z + 1, 171) level.setBlockDataAt(x + 1, y + 1, z + 1, 15) level.setBlockAt(x, y + 1, z - 1, 171) level.setBlockDataAt(x, y + 1, z - 1, 15) level.setBlockAt(x - 1, y + 1, z, 171) level.setBlockDataAt(x - 1, y + 1, z, 15) level.setBlockAt(x - 1, y + 1, z - 1, 171) level.setBlockDataAt(x - 1, y + 1, z - 1, 15) level.setBlockAt(x + 1, y + 1, z - 1, 171) level.setBlockDataAt(x + 1, y + 1, z - 1, 15) level.setBlockAt(x - 1, y + 1, z + 1, 171) level.setBlockDataAt(x - 1, y + 1, z + 1, 15) #Blackwool #2 3x3 Empty Circle level.setBlockAt(x + 2, y + 1, z, 171) level.setBlockDataAt(x + 2, y + 1, z, 15) level.setBlockAt(x - 2, y + 1, z, 171) level.setBlockDataAt(x - 2, y + 1, z, 15) level.setBlockAt(x, y + 1, z + 2, 171) level.setBlockDataAt(x, y + 1, z + 2, 15) level.setBlockAt(x, y + 1, z - 2, 171) level.setBlockDataAt(x, y + 1, z - 2, 15) level.setBlockAt(x + 2, y + 1, z - 1, 171) level.setBlockDataAt(x + 2, y + 1, z - 1, 15) level.setBlockAt(x - 1, y + 1, z + 2, 171) level.setBlockDataAt(x - 1, y + 1, z + 2, 15) level.setBlockAt(x + 1, y + 1, z + 2, 171) level.setBlockDataAt(x + 1, y + 1, z + 2, 15) level.setBlockAt(x + 2, y + 1, z + 1, 171) level.setBlockDataAt(x + 2, y + 1, z + 1, 15) level.setBlockAt(x + 1, y + 1, z + -2, 171) level.setBlockDataAt(x + 1, y + 1, z - 2, 15) level.setBlockAt(x - 2, y + 1, z + 1, 171) level.setBlockDataAt(x - 2, y + 1, z + 1, 15) level.setBlockAt(x - 2, y + 1, z - 1, 171) level.setBlockDataAt(x - 2, y + 1, z - 1, 15) level.setBlockAt(x - 1, y + 1, z - 2, 171) level.setBlockDataAt(x - 1, y + 1, z - 2, 15) #Blue Wool 5x5 / 3x3 level.setBlockAt(x + 3, y + 1, z, 171) level.setBlockDataAt(x + 3, y + 1, z, 11) level.setBlockAt(x - 3, y + 1, z, 171) level.setBlockDataAt(x - 3, y + 1, z, 11) level.setBlockAt(x, y + 1, z + 3, 171) level.setBlockDataAt(x, y + 1, z + 3, 11) level.setBlockAt(x, y + 1, z - 3, 171) level.setBlockDataAt(x, y + 1, z - 3, 11) level.setBlockAt(x + 1, y + 1, z - 3, 171) level.setBlockDataAt(x + 1, y + 1, z - 3, 11) level.setBlockAt(x - 1, y + 1, z - 3, 171) level.setBlockDataAt(x - 1, y + 1, z - 3, 11) level.setBlockAt(x + 3, y + 1, z - 1, 171) level.setBlockDataAt(x + 3, y + 1, z - 1, 11) level.setBlockAt(x - 3, y + 1, z - 1, 171) level.setBlockDataAt(x - 3, y + 1, z - 1, 11) level.setBlockAt(x + 3, y + 1, z + 1, 171) level.setBlockDataAt(x + 3, y + 1, z + 1, 11) level.setBlockAt(x - 3, y + 1, z + 1, 171) level.setBlockDataAt(x - 3, y + 1, z + 1, 11) level.setBlockAt(x + 1, y + 1, z + 3, 171) level.setBlockDataAt(x + 1, y + 1, z + 3, 11) level.setBlockAt(x - 1, y + 1, z + 3, 171) level.setBlockDataAt(x - 1, y + 1, z + 3, 11) # level.setBlockAt(x - 2, y + 1, z + 2, 171) level.setBlockDataAt(x - 2, y + 1, z + 2, 11) level.setBlockAt(x + 2, y + 1, z - 2, 171) level.setBlockDataAt(x + 2, y + 1, z - 2, 11) level.setBlockAt(x + 2, y + 1, z + 2, 171) level.setBlockDataAt(x + 2, y + 1, z + 2, 11) level.setBlockAt(x + 2, y + 1, z - 2, 171) level.setBlockDataAt(x + 2, y + 1, z - 2, 11) level.setBlockAt(x - 2, y + 1, z - 2, 171) level.setBlockDataAt(x - 2, y + 1, z - 2, 11) if extrab == True: #Slime Block #3x3 level.setBlockAt(x, y, z, 165) level.setBlockDataAt(x, y, z, 0) level.setBlockAt(x + 1, y, z, 165) level.setBlockDataAt(x + 1, y, z, 0) level.setBlockAt(x, y, z + 1, 165) level.setBlockDataAt(x, y, z + 1, 0) level.setBlockAt(x + 1, y, z + 1, 165) level.setBlockDataAt(x + 1, y, z + 1, 0) level.setBlockAt(x, y, z - 1, 165) level.setBlockDataAt(x, y, z - 1, 0) level.setBlockAt(x - 1, y, z, 165) level.setBlockDataAt(x - 1, y, z, 0) level.setBlockAt(x - 1, y, z - 1, 165) level.setBlockDataAt(x - 1, y, z - 1, 0) level.setBlockAt(x + 1, y, z - 1, 165) level.setBlockDataAt(x + 1, y, z - 1, 0) level.setBlockAt(x - 1, y, z + 1, 165) level.setBlockDataAt(x - 1, y, z + 1, 0) #Part 2 Slime 3x3 Empty Circle level.setBlockAt(x + 2, y, z, 165) level.setBlockDataAt(x + 2, y, z, 0) level.setBlockAt(x - 2, y, z, 165) level.setBlockDataAt(x - 2, y, z, 0) level.setBlockAt(x, y, z + 2, 165) level.setBlockDataAt(x, y, z + 2, 0) level.setBlockAt(x, y, z - 2, 165) level.setBlockDataAt(x, y, z - 2, 0) level.setBlockAt(x + 2, y, z - 1, 165) level.setBlockDataAt(x + 2, y, z - 1, 0) level.setBlockAt(x - 1, y, z + 2, 165) level.setBlockDataAt(x - 1, y, z + 2, 0) level.setBlockAt(x + 1, y, z + 2, 165) level.setBlockDataAt(x + 1, y, z + 2, 0) level.setBlockAt(x + 2, y, z + 1, 165) level.setBlockDataAt(x + 2, y, z + 1, 0) level.setBlockAt(x + 1, y, z + -2, 165) level.setBlockDataAt(x + 1, y, z - 2, 0) level.setBlockAt(x - 2, y, z + 1, 165) level.setBlockDataAt(x - 2, y, z + 1, 0) level.setBlockAt(x - 2, y, z - 1, 165) level.setBlockDataAt(x - 2, y, z - 1, 0) level.setBlockAt(x - 1, y, z - 2, 165) level.setBlockDataAt(x - 1, y, z - 2, 0) #Part 3 Slime Outer Ring level.setBlockAt(x + 3, y, z, 165) level.setBlockDataAt(x + 3, y, z, 0) level.setBlockAt(x - 3, y, z, 165) level.setBlockDataAt(x - 3, y, z, 0) level.setBlockAt(x, y, z + 3, 165) level.setBlockDataAt(x, y, z + 3, 0) level.setBlockAt(x, y, z - 3, 165) level.setBlockDataAt(x, y, z - 3, 0) level.setBlockAt(x + 1, y, z - 3, 165) level.setBlockDataAt(x + 1, y, z - 3, 0) level.setBlockAt(x - 1, y, z - 3, 165) level.setBlockDataAt(x - 1, y, z - 3, 0) level.setBlockAt(x + 3, y, z - 1, 165) level.setBlockDataAt(x + 3, y, z - 1, 0) level.setBlockAt(x - 3, y, z - 1, 165) level.setBlockDataAt(x - 3, y, z - 1, 0) level.setBlockAt(x + 3, y, z + 1, 165) level.setBlockDataAt(x + 3, y, z + 1, 0) level.setBlockAt(x - 3, y, z + 1, 165) level.setBlockDataAt(x - 3, y, z + 1, 0) level.setBlockAt(x + 1, y, z + 3, 165) level.setBlockDataAt(x + 1, y, z + 3, 0) level.setBlockAt(x - 1, y, z + 3, 165) level.setBlockDataAt(x - 1, y, z + 3, 0) level.setBlockAt(x - 2, y, z + 2, 165) level.setBlockDataAt(x - 2, y, z + 2, 0) level.setBlockAt(x + 2, y, z - 2, 165) level.setBlockDataAt(x + 2, y, z - 2, 0) level.setBlockAt(x + 2, y, z + 2, 165) level.setBlockDataAt(x + 2, y, z + 2, 0) level.setBlockAt(x + 2, y, z - 2, 165) level.setBlockDataAt(x + 2, y, z - 2, 0) level.setBlockAt(x - 2, y, z - 2, 165) level.setBlockDataAt(x - 2, y, z - 2, 0) else: #String Middle Block #3x3 level.setBlockAt(x, y, z, 166) level.setBlockDataAt(x, y, z, 0) level.setBlockAt(x + 1, y, z, 166) level.setBlockDataAt(x + 1, y, z, 0) level.setBlockAt(x, y, z + 1, 166) level.setBlockDataAt(x, y, z + 1, 0) level.setBlockAt(x + 1, y, z + 1, 166) level.setBlockDataAt(x + 1, y, z + 1, 0) level.setBlockAt(x, y, z - 1, 166) level.setBlockDataAt(x, y, z - 1, 0) level.setBlockAt(x - 1, y, z, 166) level.setBlockDataAt(x - 1, y, z, 0) level.setBlockAt(x - 1, y, z - 1, 166) level.setBlockDataAt(x - 1, y, z - 1, 0) level.setBlockAt(x + 1, y, z - 1, 166) level.setBlockDataAt(x + 1, y, z - 1, 0) level.setBlockAt(x - 1, y, z + 1, 166) level.setBlockDataAt(x - 1, y, z + 1, 0) #String Block Inner #3x3 level.setBlockAt(x + 2, y, z, 166) level.setBlockDataAt(x + 2, y, z, 0) level.setBlockAt(x - 2, y, z, 166) level.setBlockDataAt(x - 2, y, z, 0) level.setBlockAt(x, y, z + 2, 166) level.setBlockDataAt(x, y, z + 2, 0) level.setBlockAt(x, y, z - 2, 166) level.setBlockDataAt(x, y, z - 2, 0) level.setBlockAt(x + 2, y, z - 1, 166) level.setBlockDataAt(x + 2, y, z - 1, 0) level.setBlockAt(x - 1, y, z + 2, 166) level.setBlockDataAt(x - 1, y, z + 2, 0) level.setBlockAt(x + 1, y, z + 2, 166) level.setBlockDataAt(x + 1, y, z + 2, 0) level.setBlockAt(x + 2, y, z + 1, 166) level.setBlockDataAt(x + 2, y, z + 1, 0) level.setBlockAt(x + 1, y, z + -2, 166) level.setBlockDataAt(x + 1, y, z - 2, 0) level.setBlockAt(x - 2, y, z + 1, 166) level.setBlockDataAt(x - 2, y, z + 1, 0) level.setBlockAt(x - 2, y, z - 1, 166) level.setBlockDataAt(x - 2, y, z - 1, 0) level.setBlockAt(x - 1, y, z - 2, 166) level.setBlockDataAt(x - 1, y, z - 2, 0) #Iron Fence Block #3x3 Outer level.setBlockAt(x + 3, y, z, 101) level.setBlockDataAt(x + 3, y, z, 0) level.setBlockAt(x - 3, y, z, 101) level.setBlockDataAt(x - 3, y, z, 0) level.setBlockAt(x, y, z + 3, 101) level.setBlockDataAt(x, y, z + 3, 0) level.setBlockAt(x, y, z - 3, 101) level.setBlockDataAt(x, y, z - 3, 0) level.setBlockAt(x + 1, y, z - 3, 101) level.setBlockDataAt(x + 1, y, z - 3, 0) level.setBlockAt(x - 1, y, z - 3, 101) level.setBlockDataAt(x - 1, y, z - 3, 0) level.setBlockAt(x + 3, y, z - 1, 101) level.setBlockDataAt(x + 3, y, z - 1, 0) level.setBlockAt(x - 3, y, z - 1, 101) level.setBlockDataAt(x - 3, y, z - 1, 0) level.setBlockAt(x + 3, y, z + 1, 101) level.setBlockDataAt(x + 3, y, z + 1, 0) level.setBlockAt(x - 3, y, z + 1, 101) level.setBlockDataAt(x - 3, y, z + 1, 0) level.setBlockAt(x + 1, y, z + 3, 101) level.setBlockDataAt(x + 1, y, z + 3, 0) level.setBlockAt(x - 1, y, z + 3, 101) level.setBlockDataAt(x - 1, y, z + 3, 0) level.setBlockAt(x - 2, y, z + 2, 101) level.setBlockDataAt(x - 2, y, z + 2, 0) level.setBlockAt(x + 2, y, z - 2, 101) level.setBlockDataAt(x + 2, y, z - 2, 0) level.setBlockAt(x + 2, y, z + 2, 101) level.setBlockDataAt(x + 2, y, z + 2, 0) level.setBlockAt(x + 2, y, z - 2, 101) level.setBlockDataAt(x + 2, y, z - 2, 0) level.setBlockAt(x - 2, y, z - 2, 101) level.setBlockDataAt(x - 2, y, z - 2, 0)
def perform(level, box, options): for x in xrange(box.minx, box.maxx): for y in xrange(box.miny, box.maxy): for z in xrange(box.minz, box.maxz): block = level.blockAt(x, y, z) data = level.blockDataAt(x, y, z) extrab = options["Use Slime Blocks"] ItemsSmokeBox2 = Smokeboxs2[options["Minecraft Type"]] chunk = level.getChunk(x / 16, z / 16) areaEffectCloud = TAG_Compound() if options["1.11+ or 1.11.2+"]: areaEffectCloud["id"] = TAG_String(u'area_effect_cloud') if options["1.11+ or 1.11.2+"] != True: areaEffectCloud["id"] = TAG_String(u'AreaEffectCloud') areaEffectCloud["ownerUUID"] = TAG_String(u'') areaEffectCloud["OnGround"] = TAG_Byte(0) areaEffectCloud["Dimension"] = TAG_Int(0) areaEffectCloud["Air"] = TAG_Short(300) areaEffectCloud["ParticleParam2"] = TAG_Int(0) areaEffectCloud["ParticleParam1"] = TAG_Int(0) if ItemsSmokeBox2 == "PC": areaEffectCloud["Particle"] = TAG_String(u"take") if ItemsSmokeBox2 != "PC": areaEffectCloud["Particle"] = TAG_Int(0) areaEffectCloud["ReapplicationDelay"] = TAG_Int(0) rotation = TAG_List() rotation.append(TAG_Float(0.0)) rotation.append(TAG_Float(0.0)) areaEffectCloud["Rotation"] = rotation areaEffectCloud["FallDistance"] = TAG_Float(0.0) effects = TAG_List() effect = TAG_Compound() effect["Amplifier"] = TAG_Byte(15) effect["Id"] = TAG_Byte(25) effect["Duration"] = TAG_Int(10) effect["Ambient"] = TAG_Byte(0) effect["ShowParticles"] = TAG_Byte(0) effects.append(effect) effect2 = TAG_Compound() effect2["Amplifier"] = TAG_Byte(100) effect2["Id"] = TAG_Byte(11) effect2["Duration"] = TAG_Int(100) effect2["Ambient"] = TAG_Byte(0) effect2["ShowParticles"] = TAG_Byte(0) effects.append(effect2) effect3 = TAG_Compound() effect3["Amplifier"] = TAG_Byte(20) effect3["Id"] = TAG_Byte(8) effect3["Duration"] = TAG_Int(40) effect3["Ambient"] = TAG_Byte(0) effect3["ShowParticles"] = TAG_Byte(0) effects.append(effect3) areaEffectCloud["Effects"] = effects areaEffectCloud["Fire"] = TAG_Short(0) areaEffectCloud["Invulnerable"] = TAG_Byte(0) areaEffectCloud["PortalCooldown"] = TAG_Int(0) areaEffectCloud["CustomName"] = TAG_String(u'') areaEffectCloud["createdOnHost"] = TAG_Byte(0) areaEffectCloud["Silent"] = TAG_Byte(1) areaEffectCloud["NoGravity"] = TAG_Byte(1) areaEffectCloud["Glowing"] = TAG_Byte(0) areaEffectCloud["Age"] = TAG_Int(1) areaEffectCloud["RadiusOnUse"] = TAG_Float(0.0) areaEffectCloud["Duration"] = TAG_Int(2147483647) areaEffectCloud["DurationOnUse"] = TAG_Int(0) areaEffectCloud["WaitTime"] = TAG_Int(0) areaEffectCloud["RadiusPerTick"] = TAG_Float(0.0) areaEffectCloud["Radius"] = TAG_Float(2.5) areaEffectCloud["Color"] = TAG_Int(0) areaEffectCloud["Potion"] = TAG_String(u'minecraft:leaping') pos = TAG_List() pos.append(TAG_Double(x+0.5)) pos.append(TAG_Double(y+5)) pos.append(TAG_Double(z+0.5)) areaEffectCloud["Pos"] = pos motion = TAG_List() motion.append(TAG_Double(0.0)) motion.append(TAG_Double(0.0)) motion.append(TAG_Double(0.0)) areaEffectCloud["Motion"] = motion areaEffectCloud2 = TAG_Compound() if options["1.11+ or 1.11.2+"]: areaEffectCloud2["id"] = TAG_String(u'area_effect_cloud') if options["1.11+ or 1.11.2+"] != True: areaEffectCloud2["id"] = TAG_String(u'AreaEffectCloud') areaEffectCloud2["ownerUUID"] = TAG_String(u'') areaEffectCloud2["OnGround"] = TAG_Byte(0) areaEffectCloud2["Dimension"] = TAG_Int(0) areaEffectCloud2["Air"] = TAG_Short(300) areaEffectCloud2["ParticleParam2"] = TAG_Int(0) areaEffectCloud2["ParticleParam1"] = TAG_Int(0) if ItemsSmokeBox2 == "PC": areaEffectCloud2["Particle"] = TAG_String(u"take") if ItemsSmokeBox2 != "PC": areaEffectCloud2["Particle"] = TAG_Int(0) areaEffectCloud2["ReapplicationDelay"] = TAG_Int(0) rotation2 = TAG_List() rotation2.append(TAG_Float(0.0)) rotation2.append(TAG_Float(0.0)) areaEffectCloud2["Rotation"] = rotation2 areaEffectCloud2["FallDistance"] = TAG_Float(0.0) effects2 = TAG_List() effect4 = TAG_Compound() effect4["Amplifier"] = TAG_Byte(15) effect4["Id"] = TAG_Byte(25) effect4["Duration"] = TAG_Int(10) effect4["Ambient"] = TAG_Byte(0) effect4["ShowParticles"] = TAG_Byte(0) effects2.append(effect4) effect5 = TAG_Compound() effect5["Amplifier"] = TAG_Byte(100) effect5["Id"] = TAG_Byte(11) effect5["Duration"] = TAG_Int(100) effect5["Ambient"] = TAG_Byte(0) effect5["ShowParticles"] = TAG_Byte(0) effects2.append(effect5) effect6 = TAG_Compound() effect6["Amplifier"] = TAG_Byte(20) effect6["Id"] = TAG_Byte(8) effect6["Duration"] = TAG_Int(40) effect6["Ambient"] = TAG_Byte(0) effect6["ShowParticles"] = TAG_Byte(0) effects2.append(effect6) areaEffectCloud2["Effects"] = effects2 areaEffectCloud2["Fire"] = TAG_Short(0) areaEffectCloud2["Invulnerable"] = TAG_Byte(0) areaEffectCloud2["PortalCooldown"] = TAG_Int(0) areaEffectCloud2["CustomName"] = TAG_String(u'') areaEffectCloud2["createdOnHost"] = TAG_Byte(0) areaEffectCloud2["Silent"] = TAG_Byte(1) areaEffectCloud2["NoGravity"] = TAG_Byte(1) areaEffectCloud2["Glowing"] = TAG_Byte(0) areaEffectCloud2["Age"] = TAG_Int(1) areaEffectCloud2["RadiusOnUse"] = TAG_Float(0.0) areaEffectCloud2["Duration"] = TAG_Int(2147483647) areaEffectCloud2["DurationOnUse"] = TAG_Int(0) areaEffectCloud2["WaitTime"] = TAG_Int(0) areaEffectCloud2["RadiusPerTick"] = TAG_Float(0.0) areaEffectCloud2["Radius"] = TAG_Float(2.5) areaEffectCloud2["Color"] = TAG_Int(0) areaEffectCloud2["Potion"] = TAG_String(u'minecraft:leaping') pos2 = TAG_List() pos2.append(TAG_Double(x+0.5)) pos2.append(TAG_Double(y+1.1)) pos2.append(TAG_Double(z+0.5)) areaEffectCloud2["Pos"] = pos2 motion2 = TAG_List() motion2.append(TAG_Double(0.0)) motion2.append(TAG_Double(0.0)) motion2.append(TAG_Double(0.0)) areaEffectCloud2["Motion"] = motion2 chunk.Entities.append(areaEffectCloud2) chunk.Entities.append(areaEffectCloud) print "Created Trampoline! Successfully" chunk.dirty = True #Blackwool #3x3 level.setBlockAt(x, y+1, z, 171) level.setBlockDataAt(x, y+1, z, 15) level.setBlockAt(x+1, y+1, z, 171) level.setBlockDataAt(x+1, y+1, z, 15) level.setBlockAt(x, y+1, z+1, 171) level.setBlockDataAt(x, y+1, z+1, 15) level.setBlockAt(x+1, y+1, z+1, 171) level.setBlockDataAt(x+1, y+1, z+1, 15) level.setBlockAt(x, y+1, z-1, 171) level.setBlockDataAt(x, y+1, z-1, 15) level.setBlockAt(x-1, y+1, z, 171) level.setBlockDataAt(x-1, y+1, z, 15) level.setBlockAt(x-1, y+1, z-1, 171) level.setBlockDataAt(x-1, y+1, z-1, 15) level.setBlockAt(x+1, y+1, z-1, 171) level.setBlockDataAt(x+1, y+1, z-1, 15) level.setBlockAt(x-1, y+1, z+1, 171) level.setBlockDataAt(x-1, y+1, z+1, 15) #Blackwool #2 3x3 Empty Circle level.setBlockAt(x+2, y+1, z, 171) level.setBlockDataAt(x+2, y+1, z, 15) level.setBlockAt(x-2, y+1, z, 171) level.setBlockDataAt(x-2, y+1, z, 15) level.setBlockAt(x, y+1, z+2, 171) level.setBlockDataAt(x, y+1, z+2, 15) level.setBlockAt(x, y+1, z-2, 171) level.setBlockDataAt(x, y+1, z-2, 15) level.setBlockAt(x+2, y+1, z-1, 171) level.setBlockDataAt(x+2, y+1, z-1, 15) level.setBlockAt(x-1, y+1, z+2, 171) level.setBlockDataAt(x-1, y+1, z+2, 15) level.setBlockAt(x+1, y+1, z+2, 171) level.setBlockDataAt(x+1, y+1, z+2, 15) level.setBlockAt(x+2, y+1, z+1, 171) level.setBlockDataAt(x+2, y+1, z+1, 15) level.setBlockAt(x+1, y+1, z+-2, 171) level.setBlockDataAt(x+1, y+1, z-2, 15) level.setBlockAt(x-2, y+1, z+1, 171) level.setBlockDataAt(x-2, y+1, z+1, 15) level.setBlockAt(x-2, y+1, z-1, 171) level.setBlockDataAt(x-2, y+1, z-1, 15) level.setBlockAt(x-1, y+1, z-2, 171) level.setBlockDataAt(x-1, y+1, z-2, 15) #Blue Wool 5x5 / 3x3 level.setBlockAt(x+3, y+1, z, 171) level.setBlockDataAt(x+3, y+1, z, 11) level.setBlockAt(x-3, y+1, z, 171) level.setBlockDataAt(x-3, y+1, z, 11) level.setBlockAt(x, y+1, z+3, 171) level.setBlockDataAt(x, y+1, z+3, 11) level.setBlockAt(x, y+1, z-3, 171) level.setBlockDataAt(x, y+1, z-3, 11) level.setBlockAt(x+1, y+1, z-3, 171) level.setBlockDataAt(x+1, y+1, z-3, 11) level.setBlockAt(x-1, y+1, z-3, 171) level.setBlockDataAt(x-1, y+1, z-3, 11) level.setBlockAt(x+3, y+1, z-1, 171) level.setBlockDataAt(x+3, y+1, z-1, 11) level.setBlockAt(x-3, y+1, z-1, 171) level.setBlockDataAt(x-3, y+1, z-1, 11) level.setBlockAt(x+3, y+1, z+1, 171) level.setBlockDataAt(x+3, y+1, z+1, 11) level.setBlockAt(x-3, y+1, z+1, 171) level.setBlockDataAt(x-3, y+1, z+1, 11) level.setBlockAt(x+1, y+1, z+3, 171) level.setBlockDataAt(x+1, y+1, z+3, 11) level.setBlockAt(x-1, y+1, z+3, 171) level.setBlockDataAt(x-1, y+1, z+3, 11) # level.setBlockAt(x-2, y+1, z+2, 171) level.setBlockDataAt(x-2, y+1, z+2, 11) level.setBlockAt(x+2, y+1, z-2, 171) level.setBlockDataAt(x+2, y+1, z-2, 11) level.setBlockAt(x+2, y+1, z+2, 171) level.setBlockDataAt(x+2, y+1, z+2, 11) level.setBlockAt(x+2, y+1, z-2, 171) level.setBlockDataAt(x+2, y+1, z-2, 11) level.setBlockAt(x-2, y+1, z-2, 171) level.setBlockDataAt(x-2, y+1, z-2, 11) if extrab == True: #Slime Block #3x3 level.setBlockAt(x, y, z, 165) level.setBlockDataAt(x, y, z, 0) level.setBlockAt(x+1, y, z, 165) level.setBlockDataAt(x+1, y, z, 0) level.setBlockAt(x, y, z+1, 165) level.setBlockDataAt(x, y, z+1, 0) level.setBlockAt(x+1, y, z+1, 165) level.setBlockDataAt(x+1, y, z+1, 0) level.setBlockAt(x, y, z-1, 165) level.setBlockDataAt(x, y, z-1, 0) level.setBlockAt(x-1, y, z, 165) level.setBlockDataAt(x-1, y, z, 0) level.setBlockAt(x-1, y, z-1, 165) level.setBlockDataAt(x-1, y, z-1, 0) level.setBlockAt(x+1, y, z-1, 165) level.setBlockDataAt(x+1, y, z-1, 0) level.setBlockAt(x-1, y, z+1, 165) level.setBlockDataAt(x-1, y, z+1, 0) #Part 2 Slime 3x3 Empty Circle level.setBlockAt(x+2, y, z, 165) level.setBlockDataAt(x+2, y, z, 0) level.setBlockAt(x-2, y, z, 165) level.setBlockDataAt(x-2, y, z, 0) level.setBlockAt(x, y, z+2, 165) level.setBlockDataAt(x, y, z+2, 0) level.setBlockAt(x, y, z-2, 165) level.setBlockDataAt(x, y, z-2, 0) level.setBlockAt(x+2, y, z-1, 165) level.setBlockDataAt(x+2, y, z-1, 0) level.setBlockAt(x-1, y, z+2, 165) level.setBlockDataAt(x-1, y, z+2, 0) level.setBlockAt(x+1, y, z+2, 165) level.setBlockDataAt(x+1, y, z+2, 0) level.setBlockAt(x+2, y, z+1, 165) level.setBlockDataAt(x+2, y, z+1, 0) level.setBlockAt(x+1, y, z+-2, 165) level.setBlockDataAt(x+1, y, z-2, 0) level.setBlockAt(x-2, y, z+1, 165) level.setBlockDataAt(x-2, y, z+1, 0) level.setBlockAt(x-2, y, z-1, 165) level.setBlockDataAt(x-2, y, z-1, 0) level.setBlockAt(x-1, y, z-2, 165) level.setBlockDataAt(x-1, y, z-2, 0) #Part 3 Slime Outer Ring level.setBlockAt(x+3, y, z, 165) level.setBlockDataAt(x+3, y, z, 0) level.setBlockAt(x-3, y, z, 165) level.setBlockDataAt(x-3, y, z, 0) level.setBlockAt(x, y, z+3, 165) level.setBlockDataAt(x, y, z+3, 0) level.setBlockAt(x, y, z-3, 165) level.setBlockDataAt(x, y, z-3, 0) level.setBlockAt(x+1, y, z-3, 165) level.setBlockDataAt(x+1, y, z-3, 0) level.setBlockAt(x-1, y, z-3, 165) level.setBlockDataAt(x-1, y, z-3, 0) level.setBlockAt(x+3, y, z-1, 165) level.setBlockDataAt(x+3, y, z-1, 0) level.setBlockAt(x-3, y, z-1, 165) level.setBlockDataAt(x-3, y, z-1, 0) level.setBlockAt(x+3, y, z+1, 165) level.setBlockDataAt(x+3, y, z+1, 0) level.setBlockAt(x-3, y, z+1, 165) level.setBlockDataAt(x-3, y, z+1, 0) level.setBlockAt(x+1, y, z+3, 165) level.setBlockDataAt(x+1, y, z+3, 0) level.setBlockAt(x-1, y, z+3, 165) level.setBlockDataAt(x-1, y, z+3, 0) level.setBlockAt(x-2, y, z+2, 165) level.setBlockDataAt(x-2, y, z+2, 0) level.setBlockAt(x+2, y, z-2, 165) level.setBlockDataAt(x+2, y, z-2, 0) level.setBlockAt(x+2, y, z+2, 165) level.setBlockDataAt(x+2, y, z+2, 0) level.setBlockAt(x+2, y, z-2, 165) level.setBlockDataAt(x+2, y, z-2, 0) level.setBlockAt(x-2, y, z-2, 165) level.setBlockDataAt(x-2, y, z-2, 0) else: #String Middle Block #3x3 level.setBlockAt(x, y, z, 166) level.setBlockDataAt(x, y, z, 0) level.setBlockAt(x+1, y, z, 166) level.setBlockDataAt(x+1, y, z, 0) level.setBlockAt(x, y, z+1, 166) level.setBlockDataAt(x, y, z+1, 0) level.setBlockAt(x+1, y, z+1, 166) level.setBlockDataAt(x+1, y, z+1, 0) level.setBlockAt(x, y, z-1, 166) level.setBlockDataAt(x, y, z-1, 0) level.setBlockAt(x-1, y, z, 166) level.setBlockDataAt(x-1, y, z, 0) level.setBlockAt(x-1, y, z-1, 166) level.setBlockDataAt(x-1, y, z-1, 0) level.setBlockAt(x+1, y, z-1, 166) level.setBlockDataAt(x+1, y, z-1, 0) level.setBlockAt(x-1, y, z+1, 166) level.setBlockDataAt(x-1, y, z+1, 0) #String Block Inner #3x3 level.setBlockAt(x+2, y, z, 166) level.setBlockDataAt(x+2, y, z, 0) level.setBlockAt(x-2, y, z, 166) level.setBlockDataAt(x-2, y, z, 0) level.setBlockAt(x, y, z+2, 166) level.setBlockDataAt(x, y, z+2, 0) level.setBlockAt(x, y, z-2, 166) level.setBlockDataAt(x, y, z-2, 0) level.setBlockAt(x+2, y, z-1, 166) level.setBlockDataAt(x+2, y, z-1, 0) level.setBlockAt(x-1, y, z+2, 166) level.setBlockDataAt(x-1, y, z+2, 0) level.setBlockAt(x+1, y, z+2, 166) level.setBlockDataAt(x+1, y, z+2, 0) level.setBlockAt(x+2, y, z+1, 166) level.setBlockDataAt(x+2, y, z+1, 0) level.setBlockAt(x+1, y, z+-2, 166) level.setBlockDataAt(x+1, y, z-2, 0) level.setBlockAt(x-2, y, z+1, 166) level.setBlockDataAt(x-2, y, z+1, 0) level.setBlockAt(x-2, y, z-1, 166) level.setBlockDataAt(x-2, y, z-1, 0) level.setBlockAt(x-1, y, z-2, 166) level.setBlockDataAt(x-1, y, z-2, 0) #Iron Fence Block #3x3 Outer level.setBlockAt(x+3, y, z, 101) level.setBlockDataAt(x+3, y, z, 0) level.setBlockAt(x-3, y, z, 101) level.setBlockDataAt(x-3, y, z, 0) level.setBlockAt(x, y, z+3, 101) level.setBlockDataAt(x, y, z+3, 0) level.setBlockAt(x, y, z-3, 101) level.setBlockDataAt(x, y, z-3, 0) level.setBlockAt(x+1, y, z-3, 101) level.setBlockDataAt(x+1, y, z-3, 0) level.setBlockAt(x-1, y, z-3, 101) level.setBlockDataAt(x-1, y, z-3, 0) level.setBlockAt(x+3, y, z-1, 101) level.setBlockDataAt(x+3, y, z-1, 0) level.setBlockAt(x-3, y, z-1, 101) level.setBlockDataAt(x-3, y, z-1, 0) level.setBlockAt(x+3, y, z+1, 101) level.setBlockDataAt(x+3, y, z+1, 0) level.setBlockAt(x-3, y, z+1, 101) level.setBlockDataAt(x-3, y, z+1, 0) level.setBlockAt(x+1, y, z+3, 101) level.setBlockDataAt(x+1, y, z+3, 0) level.setBlockAt(x-1, y, z+3, 101) level.setBlockDataAt(x-1, y, z+3, 0) level.setBlockAt(x-2, y, z+2, 101) level.setBlockDataAt(x-2, y, z+2, 0) level.setBlockAt(x+2, y, z-2, 101) level.setBlockDataAt(x+2, y, z-2, 0) level.setBlockAt(x+2, y, z+2, 101) level.setBlockDataAt(x+2, y, z+2, 0) level.setBlockAt(x+2, y, z-2, 101) level.setBlockDataAt(x+2, y, z-2, 0) level.setBlockAt(x-2, y, z-2, 101) level.setBlockDataAt(x-2, y, z-2, 0)
def makeItemFrameEntity(x, y, z, facing, itemtag=None, itemRotation=0): itemFrame = TAG_Compound() itemFrame["id"] = TAG_String(u'ItemFrame') pos = TAG_List() pos.append(TAG_Double(x + 0.5 + 0.4375*[0, 1, 0, -1][facing])) pos.append(TAG_Double(y + 0.5)) pos.append(TAG_Double(z + 0.5 + 0.4375*[-1, 0, 1, 0][facing])) itemFrame["Pos"] = pos motion = TAG_List() motion.append(TAG_Double(0.0)) motion.append(TAG_Double(0.0)) motion.append(TAG_Double(0.0)) itemFrame["Motion"] = motion rotation = TAG_List() rotation.append(TAG_Float(0.0)) rotation.append(TAG_Float(0.0)) itemFrame["Rotation"] = rotation itemFrame["FallDistance"] = TAG_Float(0.0) itemFrame["Fire"] = TAG_Short(0) itemFrame["Air"] = TAG_Short(300) itemFrame["OnGround"] = TAG_Byte(0) itemFrame["Dimension"] = TAG_Int(0) itemFrame["Invulnerable"] = TAG_Byte(0) itemFrame["PortalCooldown"] = TAG_Int(0) itemFrame["UUIDLeast"] = TAG_Long(0) itemFrame["UUIDMost"] = TAG_Long(0) itemFrame["TileX"] = TAG_Int(x + [0, 1, 0, -1][facing]) itemFrame["TileY"] = TAG_Int(y) itemFrame["TileZ"] = TAG_Int(z + [-1, 0, 1, 0][facing]) itemFrame["Direction"] = TAG_Byte(facing) if itemtag: itemFrame["Item"] = itemtag itemFrame["ItemDropChance"] = TAG_Float(1) itemFrame["ItemRotation"] = TAG_Byte(itemRotation) return itemFrame
def bogusSpawn(cx, cz): properties = TAG_Compound() properties["id"] = TAG_String(u'Item') properties["Age"] = TAG_Short(19) motion = TAG_List() motion.append(TAG_Double(0)) motion.append(TAG_Double(0)) motion.append(TAG_Double(0)) properties["Motion"] = motion properties["OnGround"] = TAG_Byte(1) properties["Health"] = TAG_Short(5) properties["Dimension"] = TAG_Int(0) properties["Air"] = TAG_Short(300) pos = TAG_List() pos.append(TAG_Double(cx)) pos.append(TAG_Double(-100)) pos.append(TAG_Double(cz)) properties["Pos"] = pos properties["PortalCooldown"] = TAG_Int(0) item = TAG_Compound() item["id"] = TAG_Short(24) item["Damage"] = TAG_Short(0) item["Count"] = TAG_Byte(1) properties["Item"] = item properties["Fire"] = TAG_Short(-1) properties["FallDistance"] = TAG_Float(0.0) rotation = TAG_List() rotation.append(TAG_Float(0)) rotation.append(TAG_Float(0)) properties["Rotation"] = rotation properties["Invulnerable"] = TAG_Byte(0) return properties
def createShop(level, x, y, z, emptyTrade, invincible, profession, unlimited, xp, nomove, silent, name, yaxis, xaxis, IsCustomHead, legacy, SkullType, PlayerName): chest = level.tileEntityAt(x, y, z) if chest is None: return priceList = {} priceListB = {} saleList = {} for item in chest["Items"]: slot = item["Slot"].value if 0 <= slot <= 8: priceList[slot] = item elif 9 <= slot <= 17: priceListB[slot - 9] = item elif 18 <= slot <= 26: saleList[slot - 18] = item villager = TAG_Compound() villager["PersistenceRequired"] = TAG_Byte(1) villager["OnGround"] = TAG_Byte(1) villager["Air"] = TAG_Short(300) villager["AttackTime"] = TAG_Short(0) villager["DeathTime"] = TAG_Short(0) villager["Fire"] = TAG_Short(-1) villager["Health"] = TAG_Short(20) villager["HurtTime"] = TAG_Short(0) villager["Age"] = TAG_Int(0) villager["Profession"] = TAG_Int(profession) villager["Career"] = TAG_Int(1) villager["CareerLevel"] = TAG_Int(1000) villager["Riches"] = TAG_Int(200) villager["FallDistance"] = TAG_Float(0) villager["CustomNameVisible"] = TAG_Byte(1) villager["CustomName"] = TAG_String(name) villager["Invulnerable"] = TAG_Byte(invincible) villager["NoAI"] = TAG_Byte(nomove) villager["id"] = TAG_String("Villager") villager["Motion"] = TAG_List( [TAG_Double(0.0), TAG_Double(0.0), TAG_Double(0.0)]) villager["Pos"] = TAG_List( [TAG_Double(x + 0.5), TAG_Double(y), TAG_Double(z + 0.5)]) villager["Rotation"] = TAG_List([TAG_Float(yaxis), TAG_Float(xaxis)]) villager["Willing"] = TAG_Byte(0) villager["Offers"] = TAG_Compound() villager["Offers"]["Recipes"] = TAG_List() if silent: villager["Silent"] = TAG_Byte(1) else: villager["Silent"] = TAG_Byte(0) for i in range(9): if (i in priceList or i in priceListB) and i in saleList: offer = TAG_Compound() if xp: offer["rewardExp"] = TAG_Byte(1) else: offer["rewardExp"] = TAG_Byte(0) if unlimited: offer["uses"] = TAG_Int(0) offer["maxUses"] = TAG_Int(2000000000) else: offer["uses"] = TAG_Int(0) offer["maxUses"] = TAG_Int(1) if i in priceList: offer["buy"] = priceList[i] if i in priceListB: if i in priceList: offer["buyB"] = priceListB[i] else: offer["buy"] = priceListB[i] offer["sell"] = saleList[i] villager["Offers"]["Recipes"].append(offer) if emptyTrade: offer = TAG_Compound() offer["buy"] = TAG_Compound() offer["buy"]["Count"] = TAG_Byte(1) offer["buy"]["Damage"] = TAG_Short(0) offer["buy"]["id"] = TAG_String("minecraft:barrier") offer["sell"] = TAG_Compound() offer["sell"]["Count"] = TAG_Byte(1) offer["sell"]["Damage"] = TAG_Short(0) offer["sell"]["id"] = TAG_String("minecraft:barrier") villager["Offers"]["Recipes"].append(offer) if IsCustomHead: Head = TAG_Compound() Head["id"] = TAG_String("minecraft:skull") Head["Damage"] = TAG_Short(SkullType) if SkullType == 3 and PlayerName: Head["tag"] = TAG_Compound() Head["tag"]["SkullOwner"] = TAG_String(PlayerName) if legacy == True: villager["Equipment"] = TAG_List([ TAG_Compound(), TAG_Compound(), TAG_Compound(), TAG_Compound(), Head ], ) else: villager["ArmorItems"] = TAG_List( [TAG_Compound(), TAG_Compound(), TAG_Compound(), Head]) level.setBlockAt(x, y, z, 0) chunk = level.getChunk(x / 16, z / 16) chunk.Entities.append(villager) chunk.TileEntities.remove(chest) chunk.dirty = True
def perform(level, box, options): block = options["Block:"].ID data = options["Block Data:"] height = options["Block Height from Cart:"] typ = options["Type of Cart:"] tileEntitiesToRemove = [] if typ == "Ridable": mc = TAG_String("MinecartRideable") elif typ == "Furnace": mc = TAG_String("MinecartFurnace") elif typ == "TNT": mc = TAG_String("MinecartTNT") elif typ == "Chest": mc = TAG_String("MinecartChest") elif typ == "Hopper": mc = TAG_String("MinecartHopper") elif typ == "Spawner": mc = TAG_String("MinecartSpawner") elif typ == "Command Block": mc = TAG_String("MinecartCommandBlock") for (chunk, slices, point) in level.getChunkSlices(box): for t in chunk.TileEntities: x = t["x"].value y = t["y"].value z = t["z"].value tileEntitiesToRemove.append((chunk, t)) level.setBlockAt(x, y, z, 0) cart = TAG_Compound() cart["Air"] = TAG_Short(300) cart["FallDistance"] = TAG_Float(0) cart["Fire"] = TAG_Short(-1) cart["id"] = mc cart["Invulnerable"] = TAG_Byte(0) cart["Motion"] = TAG_List() cart["Motion"].append(TAG_Double(0)) cart["Motion"].append(TAG_Double(-0)) cart["Motion"].append(TAG_Double(0)) cart["OnGround"] = TAG_Byte(1) cart["Pos"] = TAG_List() cart["Pos"].append(TAG_Double(box.minx + 0.5)) cart["Pos"].append(TAG_Double(box.miny + 1)) cart["Pos"].append(TAG_Double(box.minz + 0.5)) cart["Rotation"] = TAG_List() cart["Rotation"].append(TAG_Float(0)) cart["Rotation"].append(TAG_Float(0)) cart["CustomDisplayTile"] = TAG_Byte(1) cart["DisplayTile"] = TAG_Int(block) cart["DisplayData"] = TAG_Int(data) cart["DisplayOffset"] = TAG_Int(height) if typ == "Spawner": for tag in t: if tag not in ["id", "x", "y", "z"]: cart[tag] = t[tag] if typ == "MinecartCommandBlock": if t["id"] == "Control": cart["Command"] = t["Command"] cart["CustomName"] = t["CustomName"] chunk.Entities.append(cart) chunk.dirty = True for (chunk, t) in tileEntitiesToRemove: chunk.TileEntities.remove(t)
def CreateItemFrame(x, y, z, dir, blockID, invuln): TileY = y posy = float(y) + 0.5 if dir == 1: direction = dir rotation = 90.0 TileX = x + 1 TileZ = z posx = float(x) + 0.9375 posz = float(z) + 0.5 elif dir == 3: rotation = 270.0 direction = dir TileX = x - 1 TileZ = z posx = float(x) + 0.0625 posz = float(z) + 0.5 elif dir == 0: rotation = 0.0 direction = 2 TileZ = z + 1 TileX = x posz = float(z) + 0.9375 posx = float(x) + 0.5 elif dir == 2: rotation = 180.0 direction = 0 TileZ = z - 1 TileX = x posz = float(z) + 0.0625 posx = float(x) + 0.5 iframe = TAG_Compound() iframe["id"] = TAG_String("ItemFrame") iframe["Pos"] = TAG_List() iframe["Pos"].append(TAG_Double(posx)) iframe["Pos"].append(TAG_Double(posy)) iframe["Pos"].append(TAG_Double(posz)) iframe["Facing"] = TAG_Byte(dir) iframe["Dir"] = TAG_Byte(dir) iframe["Direction"] = TAG_Byte(direction) iframe["Invulnerable"] = TAG_Byte(invuln) # iframe["ItemRotation"] = TAG_Byte(0) # iframe["OnGround"] = TAG_Byte(0) # iframe["Air"] = TAG_Short(300) # iframe["Fire"] = TAG_Short(0) # iframe["FallDistance"] = TAG_Double(0.0) # iframe["ItemDropChance"] = TAG_Double(1.0) iframe["Motion"] = TAG_List() iframe["Motion"].append(TAG_Double(0.0)) iframe["Motion"].append(TAG_Double(0.0)) iframe["Motion"].append(TAG_Double(0.0)) iframe["TileX"] = TAG_Int(TileX) iframe["TileY"] = TAG_Int(TileY) iframe["TileZ"] = TAG_Int(TileZ) iframe["Rotation"] = TAG_List() iframe["Rotation"].append(TAG_Float(rotation)) iframe["Rotation"].append(TAG_Float(0.0)) iframe["Item"] = TAG_Compound() iframe["Item"]["id"] = TAG_String(names[blockID]) iframe["Item"]["Damage"] = TAG_Short(0) iframe["Item"]["Count"] = TAG_Byte(1) # iframe["Item"]["UUIDLeast"] = TAG_Long(1) # iframe["Item"]["UUIDMost"] = TAG_Long(2) return iframe
def perform(level, box, options): print "Follow Me On Twitter At @RedstonerLabs" ShowBottoms = options["ShowBottom"] Invun = options["Invulnerable"] target1 = options["Y"] target2 = options["X"] target3 = options["Z"] for x in xrange(box.minx, box.maxx): for y in xrange(box.miny, box.maxy): for z in xrange(box.minz, box.maxz): chunk = level.getChunk(x/16, z/16) enderCrystal = TAG_Compound() pos = TAG_List() pos.append(TAG_Double(x+0.5)) pos.append(TAG_Double(y)) pos.append(TAG_Double(z+0.5)) enderCrystal["Pos"] = pos if options["1.11-1.12+Worlds"]: enderCrystal["id"] = TAG_String(u'ender_crystal') else: enderCrystal["id"] = TAG_String(u'EnderCrystal') if options["Offset X,Y,Z Coordinates"]: beamTarget = TAG_Compound() beamTarget["X"] = TAG_Int(x+target2) beamTarget["Y"] = TAG_Int(y+target1) beamTarget["Z"] = TAG_Int(z+target3) enderCrystal["BeamTarget"] = beamTarget else: beamTarget = TAG_Compound() beamTarget["X"] = TAG_Int(target2) beamTarget["Y"] = TAG_Int(target1) beamTarget["Z"] = TAG_Int(target3) enderCrystal["BeamTarget"] = beamTarget enderCrystal["OnGround"] = TAG_Byte(0) motion = TAG_List() motion.append(TAG_Double(0.0)) motion.append(TAG_Double(0.0)) motion.append(TAG_Double(0.0)) enderCrystal["Motion"] = motion enderCrystal["Dimension"] = TAG_Int(0) enderCrystal["Air"] = TAG_Short(300) rotation = TAG_List() rotation.append(TAG_Float(0.0)) rotation.append(TAG_Float(0.0)) enderCrystal["Rotation"] = rotation enderCrystal["FallDistance"] = TAG_Float(0.0) enderCrystal["Fire"] = TAG_Short(0) enderCrystal["Invulnerable"] = TAG_Byte(Invun) enderCrystal["PortalCooldown"] = TAG_Int(0) enderCrystal["Glowing"] = TAG_Byte(0) enderCrystal["ShowBottom"] = TAG_Byte(ShowBottoms) chunk.Entities.append(enderCrystal)
def createArmorStand(level, x, y, z, customName, Invisible, CustomNameVisible, Invulnerable, Marker, NoGravity, MotionX, MotionY, MotionZ, RotationX, RotationY, Small, ShowArms, NoBasePlate, HandItem1, HandItem2, ArmorItem1, ArmorItem2, ArmorItem3, ArmorItem4, ArmorItem4Data, PoseBodyX, PoseBodyY, PoseBodyZ, PoseHeadX, PoseHeadY, PoseHeadZ, PoseRightArmX, PoseRightArmY, PoseRightArmZ, PoseLeftArmX, PoseLeftArmY, PoseLeftArmZ, PoseRightLegX, PoseRightLegY, PoseRightLegZ, PoseLeftLegX, PoseLeftLegY, PoseLeftLegZ): # After @Sethbling print("New ArmorStand named " + customName) mob = TAG_Compound() mob["CustomName"] = TAG_String(customName) mob["Invisible"] = TAG_Byte(Invisible) mob["Small"] = TAG_Byte(Small) mob["ShowArms"] = TAG_Byte(ShowArms) mob["NoBasePlate"] = TAG_Byte(NoBasePlate) mob["CustomNameVisible"] = TAG_Byte(CustomNameVisible) mob["Invulnerable"] = TAG_Byte(Invulnerable) mob["Marker"] = TAG_Byte(Marker) mob["NoGravity"] = TAG_Byte(NoGravity) mob["OnGround"] = TAG_Byte(1) mob["Air"] = TAG_Short(300) mob["DeathTime"] = TAG_Short(0) mob["Fire"] = TAG_Short(-1) mob["Health"] = TAG_Short(20) mob["HurtTime"] = TAG_Short(0) mob["Age"] = TAG_Int(0) mob["FallDistance"] = TAG_Float(0) mob["Motion"] = TAG_List() mob["Motion"].append(TAG_Double(MotionX)) mob["Motion"].append(TAG_Double(MotionY)) mob["Motion"].append(TAG_Double(MotionZ)) mob["Pos"] = TAG_List() mob["Pos"].append(TAG_Double(x + 0.5)) mob["Pos"].append(TAG_Double(y)) mob["Pos"].append(TAG_Double(z + 0.5)) mob["Rotation"] = TAG_List() mob["Rotation"].append(TAG_Float(RotationX)) mob["Rotation"].append(TAG_Float(RotationY)) tl_AI = TAG_List() tc_AI1 = TAG_Compound() tc_AI1["Count"] = TAG_Byte(1) tc_AI1["id"] = TAG_String(HandItem1) tl_AI.append(tc_AI1) tc_AI1 = TAG_Compound() tc_AI1["Count"] = TAG_Byte(1) tc_AI1["id"] = TAG_String(HandItem2) tl_AI.append(tc_AI1) mob["HandItems"] = tl_AI tl_AI = TAG_List() tc_AI1 = TAG_Compound() tc_AI1["Count"] = TAG_Byte(1) tc_AI1["id"] = TAG_String(ArmorItem1) tl_AI.append(tc_AI1) tc_AI1 = TAG_Compound() tc_AI1["Count"] = TAG_Byte(1) tc_AI1["id"] = TAG_String(ArmorItem2) tl_AI.append(tc_AI1) tc_AI1 = TAG_Compound() tc_AI1["Count"] = TAG_Byte(1) tc_AI1["id"] = TAG_String(ArmorItem3) tl_AI.append(tc_AI1) tc_AI1 = TAG_Compound() tc_AI1["Count"] = TAG_Byte(1) tc_AI1["id"] = TAG_String(ArmorItem4) tc_AI1["Damage"] = TAG_Short(ArmorItem4Data) tl_AI.append(tc_AI1) mob["ArmorItems"] = tl_AI tc_Pose = TAG_Compound() tl_Pose = TAG_List() tl_Pose.append(TAG_Float(PoseBodyX)) tl_Pose.append(TAG_Float(PoseBodyY)) tl_Pose.append(TAG_Float(PoseBodyZ)) tc_Pose["Body"] = tl_Pose tl_Pose = TAG_List() tl_Pose.append(TAG_Float(PoseHeadX)) tl_Pose.append(TAG_Float(PoseHeadY)) tl_Pose.append(TAG_Float(PoseHeadZ)) tc_Pose["Head"] = tl_Pose tl_Pose = TAG_List() tl_Pose.append(TAG_Float(PoseRightArmX)) tl_Pose.append(TAG_Float(PoseRightArmY)) tl_Pose.append(TAG_Float(PoseRightArmZ)) tc_Pose["RightArm"] = tl_Pose tl_Pose = TAG_List() tl_Pose.append(TAG_Float(PoseLeftArmX)) tl_Pose.append(TAG_Float(PoseLeftArmY)) tl_Pose.append(TAG_Float(PoseLeftArmZ)) tc_Pose["LeftArm"] = tl_Pose tl_Pose = TAG_List() tl_Pose.append(TAG_Float(PoseRightLegX)) tl_Pose.append(TAG_Float(PoseRightLegY)) tl_Pose.append(TAG_Float(PoseRightLegZ)) tc_Pose["RightLeg"] = tl_Pose tl_Pose = TAG_List() tl_Pose.append(TAG_Float(PoseLeftLegX)) tl_Pose.append(TAG_Float(PoseLeftLegY)) tl_Pose.append(TAG_Float(PoseLeftLegZ)) tc_Pose["LeftLeg"] = tl_Pose mob["Pose"] = tc_Pose mob["id"] = TAG_String("ArmorStand") chunk = level.getChunk(int(x) / CHUNKSIZE, int(z) / CHUNKSIZE) chunk.Entities.append(mob) chunk.dirty = True
def perform(level, box, options): start = time.time() print(start) file_name = options["Export File Name:"] if file_name == "": file_name = "translate-java-2-bedrock.txt" if file_name.find(".txt") < 0: file_name += ".txt" output_text = '' contents = '' if options["Prepare for Bedrock:"]: tileEntitiesToReplace = [] tileEntitiesToRemove = [] entitiesToRemove = [] entitiesToUpdate = [] tileEntityContainer = [] entityContainer = [] for (chunk, slices, point) in level.getChunkSlices(box): # get list of all entities in selection for t in chunk.TileEntities: x = t["x"].value y = t["y"].value z = t["z"].value coords = str(x) +","+ str(y) +","+str(z) id = fixID(t["id"].value) if (coords) not in tileEntityContainer: tileEntityContainer.append(coords) if (x,y,z) in box: if id in removeTileEntities: # tile entities that need to be removed tileEntitiesToRemove.append((chunk, t)) else: # tile entities that need to be translated tileEntitiesToReplace.append((chunk, t)) # get all entities in selection for e in chunk.Entities: x = e["Pos"][0].value y = e["Pos"][1].value z = e["Pos"][2].value id = fixID(e["id"].value) coords = str(x) +","+ str(y) +","+str(z) if (coords) not in entityContainer: entityContainer.append(coords) if (x,y,z) in box: # delete tile entity entitiesToRemove.append((chunk, e)) # removed replacement code until entities can be translated #if (id in removeEntities): #entitiesToRemove.append((chunk, e)) #else: #entitiesToUpdate.append((chunk, e)) if tileEntitiesToReplace: for (chunk, t) in tileEntitiesToReplace: iIgnore = 0 x = t["x"].value y = t["y"].value z = t["z"].value id = fixID(t["id"].value) # check to see if the ID needs to be translated if id in tileEntityNameReplacements: id = tileEntityNameReplacements[id] blockid = level.blockAt(x,y,z) contents += "----"+id+" "+str(x)+","+str(y)+","+str(z)+"\n" contents += str(chunk)+"\n"+ str(t) + "\n\n" chunk.TileEntities.remove(t) newte = TileEntity.Create(id) TileEntity.setpos(newte, (x, y, z)) # rewrite spawner data - no features carried over as bedrock doesn't support # SpawnData or SpawnPotentials # adding MinSpawnDelay, MaxSpawnDelay, MaxNearbyEntities, etc is a good idea if ("Banner" in id): newte = t del newte["Patterns"] if ("Skull" in id): newte = t newte["MouthMoving"] = TAG_Byte(0) newte["MouthTickCount"] = TAG_Int(0) if ("MobSpawner" in id): try: entityName = t["SpawnData"]["id"].value.replace("minecraft:","") except KeyError: entityName = t["EntityId"].value if not str(entityName).isdigit(): entityName = fixID(entityName) print(entityName) if (entityName in idMappings["entities"]): newte = t if "SpawnData" in newte: del newte["SpawnData"] if "SpawnPotentials" in newte: del newte["SpawnPotentials"] if entityName.isdigit(): entityId = entityName else: entityId = idMappings["entities"][entityName] newte["EntityId"] = TAG_Int(int(entityId)) else: print("ENTITY NOT FOUND REPLACED WITH ZOMBIE: "+str(entityName)+" "+str(x)+","+str(y)+","+str(z)) contents += "ENTITY NOT FOUND REPLACED WITH ZOMBIE: "+str(entityName)+" "+str(x)+","+str(y)+","+str(z)+"\n" newte = t if "SpawnData" in newte: del newte["SpawnData"] if "SpawnPotentials" in newte: del newte["SpawnPotentials"] newte["EntityId"] = TAG_Int(32) # MCEdit doesn't add all the needed tags when creating a new tile entity if ("Items" in t) and (not "Items" in newte): newte["Items"]=TAG_List() # if the tile entity has an inventory, convert the inventory if ("Items" in t) and ("Items" in newte): for i in t["Items"]: if not str(i["id"].value).isdigit(): itemNew = stripID(i["id"].value) if itemNew in idMappings["items"]: idItems = idMappings["items"][itemNew] elif itemNew in idMappings: idItems = idMappings[itemNew]["id"] else: idItems = 248 print("ITEM NOT FOUND: "+str(i["id"].value)+" "+str(x)+","+str(y)+","+str(z)) contents += "ITEM NOT FOUND: "+str(i["id"].value)+" "+str(x)+","+str(y)+","+str(z)+"\n" else: idItems = i["id"].value idItems = int(idItems) item = TAG_Compound() item["id"] = TAG_Short(idItems) if stripID(i["id"].value) == "lava_bucket": item["Damage"] = TAG_Short(10) elif stripID(i["id"].value) == "water_bucket": item["Damage"] = TAG_Short(8) elif stripID(i["id"].value) == "milk_bucket": item["Damage"] = TAG_Short(1) else: item["Damage"] = TAG_Short(i["Damage"].value) item["Count"] = TAG_Byte(i["Count"].value) item["Slot"] = TAG_Byte(i["Slot"].value) if "tag" in i: pset=0 item["tag"] = TAG_Compound(i["tag"].value) if ("Potion" in item["tag"]) and (not itemNew in idMappings): potion = stripID(item["tag"]["Potion"].value) if potion in idMappings["potions"]: item["Damage"] = TAG_Short(int(idMappings["potions"][potion])) elif ("Potion" in item["tag"]) and (itemNew in idMappings): potion = stripID(item["tag"]["Potion"].value) item["Damage"] = TAG_Short(int(idMappings[itemNew][potion])) del item["tag"]["Potion"] if ("ench" in i["tag"]): enchHolder = TAG_List() for e in i["tag"]["ench"]: ench = TAG_Compound() enchId = e["id"].value enchLvl = e["lvl"].value if str(enchId) in idMappings["enchantments"]: enchId = int(idMappings["enchantments"][str(enchId)]) ench["lvl"] = TAG_Short(enchLvl) ench["id"] = TAG_Short(enchId) enchHolder.append(ench) item["tag"]["ench"] = enchHolder if "StoredEnchantments" in i["tag"]: enchHolder = TAG_List() for e in i["tag"]["StoredEnchantments"]: ench = TAG_Compound() enchId = e["id"].value enchLvl = e["lvl"].value if str(enchId) in idMappings["enchantments"]: enchId = int(idMappings["enchantments"][str(enchId)]) ench["lvl"] = TAG_Short(enchLvl) ench["id"] = TAG_Short(enchId) enchHolder.append(ench) item["tag"]["ench"] = enchHolder del item["tag"]["StoredEnchantments"] if "CanPlaceOn" in i["tag"]: canPlaceOn = TAG_List() for p in i["tag"]["CanPlaceOn"]: canPlaceOn.append(TAG_String(p.value.replace("minecraft:",""))) del item["tag"]["CanPlaceOn"] item["CanPlaceOn"] = canPlaceOn if "CanDestroy" in i["tag"]: canDestroy = TAG_List() for p in i["tag"]["CanDestroy"]: canDestroy.append(TAG_String(p.value.replace("minecraft:",""))) del item["tag"]["CanDestroy"] item["CanDestroy"] = canDestroy newte["Items"].append(item) # convert command block data after fixing the ID earlier if id == "CommandBlock": newte = t if "UpdateLastExecution" in newte: del newte["UpdateLastExecution"] if "auto" not in newte: newte["auto"] = TAG_Byte(0) if "powered" not in newte: newte["powered"] = TAG_Byte(0) if "SuccessCount" not in newte: newte["SuccessCount"] = TAG_Int(0) if "conditionMet" not in newte: newte["conditionMet"] = TAG_Byte(0) if "TrackOutput" not in newte: newte["TrackOutput"] = TAG_Byte(0) if ("CustomName" not in newte) or newte["CustomName"] == TAG_String(u'@'): newte["CustomName"] = TAG_String('') # my attempt at converting signs with or without json data # still probably breaks some (most?) signs that are json formatted if id == "Sign": if "Text1" in t: if t["Text1"].value.find('"text":') > 0: text1 = t["Text1"].value text1 = json.loads(text1) text1 = text1["text"] newte["Text1"] = TAG_String(text1) else: text1 = t["Text1"].value if not text1 == "": if (text1[0] == '"' and text1[:1] == '"'): text1 = text1[:-1] text1 = text1[1:] newte["Text1"] = TAG_String(text1) if "Text2" in t: if t["Text2"].value.find('"text":') > 0: text2 = t["Text2"].value text2 = json.loads(text2) text2 = text2["text"] newte["Text2"] = TAG_String(text2) else: text2 = t["Text2"].value if not text2 == "": if (text2[0] == '"' and text2[:1] == '"'): text2 = text2[:-1] text2 = text2[1:] newte["Text2"] = TAG_String(text2) if "Text3" in t: if t["Text3"].value.find('"text":') > 0: text3 = t["Text3"].value text3 = json.loads(text3) text3 = text3["text"] newte["Text3"] = TAG_String(text3) else: text3 = t["Text3"].value if not text3 == "": if (text3[0] == '"' and text3[:1] == '"'): text3 = text3[:-1] text3 = text3[1:] newte["Text3"] = TAG_String(text3) if "Text4" in t: if t["Text4"].value.find('"text":') > 0: text4 = t["Text4"].value text4 = json.loads(text4) text4 = text4["text"] newte["Text4"] = TAG_String(text4) else: text4 = t["Text4"].value if not text4 == "": if (text4[0] == '"' and text4[:1] == '"'): text4 = text4[:-1] text4 = text4[1:] newte["Text4"] = TAG_String(text4) # convert new style brewing stands (with blaze powder) to old style # will need to be reverted for 1.2 (which uses blaze powder) # also translates some tags if id == "BrewingStand": itemHolder = TAG_List() if "BrewTime" in t: newte["CookTime"] = t["BrewTime"] else: newte["CookTime"] = t["CookTime"] for i in t["Items"]: item = TAG_Compound() if i["Slot"].value == 3: slotID = stripID(i["id"].value) slotID = idMappings['items'][slotID] item["Slot"] = TAG_Byte(0) item["id"] = TAG_Short(int(slotID)) item["Damage"] = i["Damage"] item["Count"] = i["Count"] elif i["Slot"].value == 0: slotID = stripID(i["id"].value) slotID = idMappings['items'][slotID] item["Slot"] = TAG_Byte(1) item["Count"] = i["Count"] item["id"] = TAG_Short(int(slotID)) if "tag" in i: potionType = stripID(i["tag"]["Potion"].value) item["Damage"] = TAG_Short(int(idMappings['potions'][potionType])) else: potionType = i["Damage"].value item["Damage"] = TAG_Short(int(idMappings['potions'][potionType])) elif i["Slot"].value == 1: slotID = stripID(i["id"].value) slotID = idMappings['items'][slotID] item["Slot"] = TAG_Byte(2) item["Count"] = i["Count"] item["id"] = TAG_Short(int(slotID)) if "tag" in i: potionType = stripID(i["tag"]["Potion"].value) item["Damage"] = TAG_Short(int(idMappings['potions'][potionType])) else: potionType = i["Damage"].value item["Damage"] = TAG_Short(int(idMappings['potions'][potionType])) elif i["Slot"].value == 2: slotID = stripID(i["id"].value) slotID = idMappings['items'][slotID] item["Slot"] = TAG_Byte(3) item["Count"] = i["Count"] item["id"] = TAG_Short(int(slotID)) if "tag" in i: potionType = stripID(i["tag"]["Potion"].value) item["Damage"] = TAG_Short(int(idMappings['potions'][potionType])) else: potionType = i["Damage"].value item["Damage"] = TAG_Short(int(idMappings['potions'][potionType])) itemHolder.append(item) newte["Items"] = itemHolder newte["id"] = TAG_String(str(id)) chunk.TileEntities.append(newte) # playing around with java mode. If enabled it removes the block be keeps # the tile entity data. usecase would be to copy the tile entity data over # a world converted with a different tool if options["Java Mode:"]: level.setBlockAt(x, y, z, 0) else: level.setBlockAt(x, y, z, blockid) if tileEntitiesToRemove: for (chunk, t) in tileEntitiesToRemove: x = t["x"].value y = t["y"].value z = t["z"].value id = fixID(t["id"].value) contents += "----"+id+" "+str(x)+","+str(y)+","+str(z)+"\n" contents += str(chunk)+"\n"+ str(t) + "\n\n" chunk.TileEntities.remove(t) level.setBlockAt(x, y, z, 0) if entitiesToRemove: for (chunk, e) in entitiesToRemove: x = e["Pos"][0].value y = e["Pos"][1].value z = e["Pos"][2].value id = fixID(e["id"].value) contents += "----"+id+" "+str(x)+","+str(y)+","+str(z)+"\n" contents += str(chunk)+"\n"+ str(e) + "\n\n" chunk.Entities.remove(e) # beginning of translate entity data # not currently used if entitiesToUpdate: for (chunk, e) in entitiesToUpdate: x = e["Pos"][0].value y = e["Pos"][1].value z = e["Pos"][2].value id = fixID(e["id"].value) newEntity = e newEntity["id"] = TAG_String(id) contents += "----"+id+" "+str(x)+","+str(y)+","+str(z)+"\n" contents += str(chunk)+"\n"+ str(e) + "\n\n" chunk.Entities.remove(e) chunk.Entities.append(newEntity) output_text += contents chunk.dirty = True output_text = output_text.encode('utf-8') with open(file_name, "w") as text_file: text_file.write(output_text) end = time.time() finalTime = end - start print(end) print("It took " + str(finalTime) + " seconds to complete the requested operation")
def shield(level, x, y, z, tx, ty): #define function e = TAG_Compound() #make the entity #the rest is defining all the data that is required by the entity e["id"] = TAG_String("ArmorStand") e["Invisible"] = TAG_Byte(1) e["NoGravity"] = TAG_Byte(1) e["HandItems"] = TAG_List() e["HandItems"].append(TAG_Compound()) e["HandItems"][0]["Count"] = TAG_Byte(1) e["HandItems"][0]["Damage"] = TAG_Short(0) e["HandItems"][0]["id"] = TAG_String("minecraft:stone_sword") e["HandItems"].append(TAG_Compound()) e["HandItems"][1]["Count"] = TAG_Byte(1) e["HandItems"][1]["Damage"] = TAG_Short(0) e["HandItems"][1]["id"] = TAG_String("minecraft:shield") e["HandItems"][1]["tag"] = TAG_Compound() e["HandItems"][1]["tag"]["BlockEntityTag"] = TAG_Compound() e["HandItems"][1]["tag"]["BlockEntityTag"]["Base"] = TAG_Int(1) e["HandItems"][1]["tag"]["BlockEntityTag"]["Patterns"] = TAG_List() e["HandItems"][1]["tag"]["BlockEntityTag"]["Patterns"].append( TAG_Compound()) e["HandItems"][1]["tag"]["BlockEntityTag"]["Patterns"][0][ "Color"] = TAG_Int(11) e["HandItems"][1]["tag"]["BlockEntityTag"]["Patterns"][0][ "Pattern"] = TAG_String("cr") e["HandItems"][1]["tag"]["BlockEntityTag"]["Patterns"].append( TAG_Compound()) e["HandItems"][1]["tag"]["BlockEntityTag"]["Patterns"][1][ "Color"] = TAG_Int(8) e["HandItems"][1]["tag"]["BlockEntityTag"]["Patterns"][1][ "Pattern"] = TAG_String("mc") e["Pos"] = TAG_List() e["Pos"].append(TAG_Double(x)) e["Pos"].append(TAG_Double(y - 0.7)) e["Pos"].append(TAG_Double(z)) e["Pose"] = TAG_Compound() e["Pose"]["LeftArm"] = TAG_List() e["Pose"]["LeftArm"].append(TAG_Float(0.0)) e["Pose"]["LeftArm"].append(TAG_Float(ty + 90.0)) e["Pose"]["LeftArm"].append(TAG_Float(90.0)) e["Pose"]["RightArm"] = TAG_List() e["Pose"]["RightArm"].append(TAG_Float((-ty / 2.5) - 40.0)) e["Pose"]["RightArm"].append(TAG_Float(ty / 4)) e["Pose"]["RightArm"].append(TAG_Float(15.0)) e["Rotation"] = TAG_List() e["Rotation"].append(TAG_Float(tx)) e["Rotation"].append(TAG_Float(0.0)) chunk = level.getChunk(int(math.floor(x)) / 16, int(math.floor(z)) / 16) #get the chunk that the entitiy is located at chunk.Entities.append(e) #mark the entity to that chunk chunk.dirty = True #tell mcedit that that chunk has been modified and needs to be saved
def perform(level, box, options): wa = WeaponsArmor[options["Weapons & Armor"]] if wa != None: id = wa else: consumable = Consumables[options["Consumables"]] if consumable != None: id = consumable else: tool = Tools[options["Tools"]] if tool != None: id = tool else: id = options["Custom Id"] dmg = options["Damage"] count = options["Count"] name = options["Name"] lore = options["Lore"] effect = Effects[options["Enchantment"]] effectlvl = options["Enchant Lvl"] effect2 = Effects[options["Enchantment 2"]] effect2lvl = options["Enchant 2 Lvl"] effect3 = Effects[options["Enchantment 3"]] effect3lvl = options["Enchant 3 Lvl"] bookeffect = Effects[options["Book Enchantment"]] bookeffectlvl = options["Book Enchant Lvl"] amount = options["Number/Percentage"] operation = Operations[options["Operations"]] if operation == 1 or operation == 2: amount = amount / 100.0 attributeName = options["Attribute"] name = options["Label"] attribute = options["Add Attributes?"] if name == "-": name = "" if lore == "-": lore = "" if name != "": if Colors[options["Name Color"]] != None: name = formatCode + Colors[options["Name Color"]] + name if options["Name Bold"]: name = formatCode + "l" + name if options["Name Italic"]: name = formatCode + "o" + name if lore != "": if Colors[options["Lore Color"]] != None: lore = formatCode + Colors[options["Lore Color"]] + lore if options["Lore Bold"]: lore = formatCode + "l" + lore if options["Lore Italic"]: lore = formatCode + "o" + lore if box.width == 1 and box.height == 1 and box.length == 1 and level.blockAt( box.minx, box.miny, box.minz) == 0: level.setBlockAt(box.minx, box.miny, box.minz, 54) chest = TAG_Compound() chest["Items"] = TAG_List() chest["id"] = TAG_String(u'Chest') chest["x"] = TAG_Int(box.minx) chest["y"] = TAG_Int(box.miny) chest["z"] = TAG_Int(box.minz) chunk = level.getChunk(box.minx / 16, box.minz / 16) chunk.TileEntities.append(chest) chunk.dirty = True for (chunk, slices, point) in level.getChunkSlices(box): for t in chunk.TileEntities: x = t["x"].value y = t["y"].value z = t["z"].value if x >= box.minx and x < box.maxx and y >= box.miny and y < box.maxy and z >= box.minz and z < box.maxz: slots = 0 if t["id"].value == "Chest": slots = 27 elif t["id"].value == "Trap" or t["id"].value == "Dropper": slots = 9 else: continue taken = zeros(slots) for item in t["Items"]: taken[item["Slot"].value] = 1 for slot in range(slots): if taken[slot] == 0: taken[slot] = 1 item = TAG_Compound() item["id"] = TAG_Short(id) item["Damage"] = TAG_Short(dmg) item["Count"] = TAG_Byte(count) item["Slot"] = TAG_Byte(slot) if name != "": if "tag" not in item: item["tag"] = TAG_Compound() if "display" not in item["tag"]: item["tag"]["display"] = TAG_Compound() item["tag"]["display"]["Name"] = TAG_String(name) if lore != "": if "tag" not in item: item["tag"] = TAG_Compound() if "display" not in item["tag"]: item["tag"]["display"] = TAG_Compound() item["tag"]["display"]["Lore"] = TAG_List() item["tag"]["display"]["Lore"].append( TAG_String(lore)) if effect != None: if "tag" not in item: item["tag"] = TAG_Compound() if "ench" not in item["tag"]: item["tag"]["ench"] = TAG_List() ef = TAG_Compound() ef["id"] = TAG_Short(effect) ef["lvl"] = TAG_Short(effectlvl) item["tag"]["ench"].append(ef) if effect2 != None: if "tag" not in item: item["tag"] = TAG_Compound() if "ench" not in item["tag"]: item["tag"]["ench"] = TAG_List() ef = TAG_Compound() ef["id"] = TAG_Short(effect2) ef["lvl"] = TAG_Short(effect2lvl) item["tag"]["ench"].append(ef) if effect3 != None: if "tag" not in item: item["tag"] = TAG_Compound() if "ench" not in item["tag"]: item["tag"]["ench"] = TAG_List() ef = TAG_Compound() ef["id"] = TAG_Short(effect3) ef["lvl"] = TAG_Short(effect3lvl) item["tag"]["ench"].append(ef) if bookeffect != None: if "tag" not in item: item["tag"] = TAG_Compound() if "StoredEnchantments" not in item["tag"]: item["tag"]["StoredEnchantments"] = TAG_List() ef = TAG_Compound() ef["id"] = TAG_Short(bookeffect) ef["lvl"] = TAG_Short(bookeffectlvl) item["tag"]["StoredEnchantments"].append(ef) if attribute: if "tag" not in item: item["tag"] = TAG_Compound() if "AttributeModifiers" not in item["tag"]: item["tag"]["AttributeModifiers"] = TAG_List() at = TAG_Compound() at["Amount"] = TAG_Double(amount) at["Operation"] = TAG_Int(operation) at["AttributeName"] = TAG_String(attributeName) at["Name"] = TAG_String(name) at["UUIDLeast"] = TAG_Long(randint(0, 1000000000)) at["UUIDMost"] = TAG_Long(randint(0, 1000000000)) item["tag"]["AttributeModifiers"].append(at) t["Items"].append(item) chunk.dirty = True break
def perform(level, box, options): #**************# #Define Options# #**************# ItemsSmokeBox = Smokeboxs[options["Particle"]] colorvalue = dict([(trn._(a), b) for a, b in Smokeboxs2.items()])[options["ColorValue"]] #****************# #Define Selection# #****************# for x in xrange(box.minx, box.maxx): for z in xrange(box.minz, box.maxz): for y in xrange(box.miny, box.maxy): #********************************# #Checks If Console Edtion Is True# #********************************# chunk = level.getChunk(x / 16, z / 16) #*******************************# #Define & Create AreaEffectCloud# #*******************************# areaEffectCloud = TAG_Compound() areaEffectCloud["Radius"] = TAG_Float(options["Radius"]) areaEffectCloud["DurationOnUse"] = TAG_Int(0) areaEffectCloud["Invulnerable"] = TAG_Byte( options["Invulnerable"]) areaEffectCloud["PortalCooldown"] = TAG_Int(0) #*********************************************************************# #Checks If Console Edtion Is True And Converts Particle Ids To Console# #*********************************************************************# if options["Console Edtition"] and ItemsSmokeBox == "take": areaEffectCloud["Particle"] = TAG_Int(0) if options[ "Console Edtition"] != True and ItemsSmokeBox == "take": areaEffectCloud["Particle"] = TAG_String("take") if options["Console Edtition"] and ItemsSmokeBox == "note": areaEffectCloud["Particle"] = TAG_Int(2) if options[ "Console Edtition"] != True and ItemsSmokeBox == "note": areaEffectCloud["Particle"] = TAG_String("note") if options["Console Edtition"] and ItemsSmokeBox == "portal": areaEffectCloud["Particle"] = TAG_Int(3) if options[ "Console Edtition"] != True and ItemsSmokeBox == "portal": areaEffectCloud["Particle"] = TAG_String("portal") if options["Console Edtition"] and ItemsSmokeBox == "explode": areaEffectCloud["Particle"] = TAG_Int(5) if options[ "Console Edtition"] != True and ItemsSmokeBox == "explode": areaEffectCloud["Particle"] = TAG_String("explode") if options["Console Edtition"] and ItemsSmokeBox == "flame": areaEffectCloud["Particle"] = TAG_Int(6) if options[ "Console Edtition"] != True and ItemsSmokeBox == "flame": areaEffectCloud["Particle"] = TAG_String("flame") if options["Console Edtition"] and ItemsSmokeBox == "lava": areaEffectCloud["Particle"] = TAG_Int(7) if options[ "Console Edtition"] != True and ItemsSmokeBox == "lava": areaEffectCloud["Particle"] = TAG_String("lava") if options["Console Edtition"] and ItemsSmokeBox == "footstep": areaEffectCloud["Particle"] = TAG_Int(8) if options[ "Console Edtition"] != True and ItemsSmokeBox == "footstep": areaEffectCloud["Particle"] = TAG_String("footstep") if options["Console Edtition"] and ItemsSmokeBox == "droplet": areaEffectCloud["Particle"] = TAG_Int(9) if options[ "Console Edtition"] != True and ItemsSmokeBox == "droplet": areaEffectCloud["Particle"] = TAG_String("droplet") if options[ "Console Edtition"] and ItemsSmokeBox == "largesmoke": areaEffectCloud["Particle"] = TAG_Int(10) if options[ "Console Edtition"] != True and ItemsSmokeBox == "largesmoke": areaEffectCloud["Particle"] = TAG_String("largesmoke") if options["Console Edtition"] and ItemsSmokeBox == "reddust": areaEffectCloud["Particle"] = TAG_Int(11) if options[ "Console Edtition"] != True and ItemsSmokeBox == "reddust": areaEffectCloud["Particle"] = TAG_String("reddust") if options[ "Console Edtition"] and ItemsSmokeBox == "snowballpoof": areaEffectCloud["Particle"] = TAG_Int(12) if options[ "Console Edtition"] != True and ItemsSmokeBox == "snowballpoof": areaEffectCloud["Particle"] = TAG_String("snowballpoof") if options[ "Console Edtition"] and ItemsSmokeBox == "snowshovel": areaEffectCloud["Particle"] = TAG_Int(13) if options[ "Console Edtition"] != True and ItemsSmokeBox == "snowshovel": areaEffectCloud["Particle"] = TAG_String("snowshovel") if options["Console Edtition"] and ItemsSmokeBox == "slime": areaEffectCloud["Particle"] = TAG_Int(14) if options[ "Console Edtition"] != True and ItemsSmokeBox == "slime": areaEffectCloud["Particle"] = TAG_String("slime") if options["Console Edtition"] and ItemsSmokeBox == "heart": areaEffectCloud["Particle"] = TAG_Int(15) if options[ "Console Edtition"] != True and ItemsSmokeBox == "heart": areaEffectCloud["Particle"] = TAG_String("heart") if options[ "Console Edtition"] and ItemsSmokeBox == "depthsuspend": areaEffectCloud["Particle"] = TAG_Int(17) if options[ "Console Edtition"] != True and ItemsSmokeBox == "depthsuspend": areaEffectCloud["Particle"] = TAG_String("depthsuspend") if options["Console Edtition"] and ItemsSmokeBox == "crit": areaEffectCloud["Particle"] = TAG_Int(18) if options[ "Console Edtition"] != True and ItemsSmokeBox == "crit": areaEffectCloud["Particle"] = TAG_String("crit") if options[ "Console Edtition"] and ItemsSmokeBox == "hugeexplosion": areaEffectCloud["Particle"] = TAG_Int(19) if options[ "Console Edtition"] != True and ItemsSmokeBox == "hugeexplosion": areaEffectCloud["Particle"] = TAG_String("hugeexplosion") if options[ "Console Edtition"] and ItemsSmokeBox == "largeexplode": areaEffectCloud["Particle"] = TAG_Int(20) if options[ "Console Edtition"] != True and ItemsSmokeBox == "largeexplode": areaEffectCloud["Particle"] = TAG_String("largeexplode") if options["Console Edtition"] and ItemsSmokeBox == "spell": areaEffectCloud["Particle"] = TAG_Int(22) if options[ "Console Edtition"] != True and ItemsSmokeBox == "spell": areaEffectCloud["Particle"] = TAG_String("spell") if options[ "Console Edtition"] and ItemsSmokeBox == "witchMagic": areaEffectCloud["Particle"] = TAG_Int(23) if options[ "Console Edtition"] != True and ItemsSmokeBox == "witchMagic": areaEffectCloud["Particle"] = TAG_String("witchMagic") if options["Console Edtition"] and ItemsSmokeBox == "mobSpell": areaEffectCloud["Particle"] = TAG_Int(24) if options[ "Console Edtition"] != True and ItemsSmokeBox == "mobSpell": areaEffectCloud["Particle"] = TAG_String("mobSpell") if options[ "Console Edtition"] and ItemsSmokeBox == "mobSpellAmbient": areaEffectCloud["Particle"] = TAG_Int(25) if options[ "Console Edtition"] != True and ItemsSmokeBox == "mobSpellAmbient": areaEffectCloud["Particle"] = TAG_String("mobSpellAmbient") if options["Console Edtition"] and ItemsSmokeBox == "suspended": areaEffectCloud["Particle"] = TAG_Int(27) if options[ "Console Edtition"] != True and ItemsSmokeBox == "suspended": areaEffectCloud["Particle"] = TAG_String("suspended") if options[ "Console Edtition"] and ItemsSmokeBox == "fallingdust": areaEffectCloud["Particle"] = TAG_Int(28) if options[ "Console Edtition"] != True and ItemsSmokeBox == "fallingdust": areaEffectCloud["Particle"] = TAG_String("fallingdust") if options[ "Console Edtition"] and ItemsSmokeBox == "enchantmenttable": areaEffectCloud["Particle"] = TAG_Int(29) if options[ "Console Edtition"] != True and ItemsSmokeBox == "enchantmenttable": areaEffectCloud["Particle"] = TAG_String( "enchantmenttable") if options[ "Console Edtition"] and ItemsSmokeBox == "angryVillager": areaEffectCloud["Particle"] = TAG_Int(31) if options[ "Console Edtition"] != True and ItemsSmokeBox == "angryVillager": areaEffectCloud["Particle"] = TAG_String("angryVillager") if options[ "Console Edtition"] and ItemsSmokeBox == "happyVillager": areaEffectCloud["Particle"] = TAG_Int(32) if options[ "Console Edtition"] != True and ItemsSmokeBox == "happyVillager": areaEffectCloud["Particle"] = TAG_String("happyVillager") if options[ "Console Edtition"] and ItemsSmokeBox == "fireworksSpark": areaEffectCloud["Particle"] = TAG_Int(33) if options[ "Console Edtition"] != True and ItemsSmokeBox == "fireworksSpark": areaEffectCloud["Particle"] = TAG_String("fireworksSpark") if options["Console Edtition"] and ItemsSmokeBox == "splash": areaEffectCloud["Particle"] = TAG_Int(34) if options[ "Console Edtition"] != True and ItemsSmokeBox == "splash": areaEffectCloud["Particle"] = TAG_String("splash") if options["Console Edtition"] and ItemsSmokeBox == "magicCrit": areaEffectCloud["Particle"] = TAG_Int(35) if options[ "Console Edtition"] != True and ItemsSmokeBox == "magicCrit": areaEffectCloud["Particle"] = TAG_String("magicCrit") if options["Console Edtition"] and ItemsSmokeBox == "cloud": areaEffectCloud["Particle"] = TAG_Int(37) if options[ "Console Edtition"] != True and ItemsSmokeBox == "cloud": areaEffectCloud["Particle"] = TAG_String("cloud") if options["Console Edtition"] and ItemsSmokeBox == "barrier": areaEffectCloud["Particle"] = TAG_Int(38) if options[ "Console Edtition"] != True and ItemsSmokeBox == "barrier": areaEffectCloud["Particle"] = TAG_String("barrier") if options["Console Edtition"] and ItemsSmokeBox == "iconcrack": areaEffectCloud["Particle"] = TAG_Int(39) if options[ "Console Edtition"] != True and ItemsSmokeBox == "iconcrack": areaEffectCloud["Particle"] = TAG_String("iconcrack") if options[ "Console Edtition"] and ItemsSmokeBox == "blockcrack": areaEffectCloud["Particle"] = TAG_Int(40) if options[ "Console Edtition"] != True and ItemsSmokeBox == "blockcrack": areaEffectCloud["Particle"] = TAG_String("blockcrack") if options["Console Edtition"] and ItemsSmokeBox == "Invisible": areaEffectCloud["Particle"] = TAG_Int(43) if options[ "Console Edtition"] != True and ItemsSmokeBox == "Invisible": areaEffectCloud["Particle"] = TAG_String("Invisible") if options[ "Console Edtition"] and ItemsSmokeBox == "dragonbreath": areaEffectCloud["Particle"] = TAG_Int(44) if options[ "Console Edtition"] != True and ItemsSmokeBox == "dragonbreath": areaEffectCloud["Particle"] = TAG_String("dragonbreath") if options["Console Edtition"] and ItemsSmokeBox == "endRod": areaEffectCloud["Particle"] = TAG_Int(45) if options[ "Console Edtition"] != True and ItemsSmokeBox == "endRod": areaEffectCloud["Particle"] = TAG_String("endRod") if options[ "Console Edtition"] and ItemsSmokeBox == "damageIndicator": areaEffectCloud["Particle"] = TAG_Int(46) if options[ "Console Edtition"] != True and ItemsSmokeBox == "damageIndicator": areaEffectCloud["Particle"] = TAG_String("damageIndicator") customPotionEffects = TAG_List() customPotionEffect = TAG_Compound() customPotionEffect["ShowParticles"] = TAG_Byte( options["ShowParticles"]) customPotionEffect["Duration"] = TAG_Int( options["Effect Duration"]) customPotionEffect["Id"] = TAG_Int(options["Effect ID"]) customPotionEffect["Amplifier"] = TAG_Int( options["Effect Amplifier"]) customPotionEffects.append(customPotionEffect) areaEffectCloud["Effects"] = customPotionEffects areaEffectCloud["FallDistance"] = TAG_Float(0.0) #**************************************# #1.11+ Support Changes ID To New Format# #**************************************# if options["1.11-1.12+Plus"]: AreaEffectCloud["id"] = TAG_String(u'area_effect_cloud') else: areaEffectCloud["id"] = TAG_String(u'AreaEffectCloud') areaEffectCloud["ParticleParam1"] = TAG_Int( options["ParticleParam1"]) areaEffectCloud["ParticleParam2"] = TAG_Int( options["ParticleParam2"]) areaEffectCloud["Age"] = TAG_Int(options["Age"]) #********************************************# #Custom ColorValue Option Aplies To Particles# #********************************************# if options["Custom ColorValue"]: areaEffectCloud["Color"] = TAG_Int(colorvalue) else: areaEffectCloud["Color"] = TAG_Int(0) motion = TAG_List() motion.append(TAG_Double(0)) motion.append(TAG_Double(0)) motion.append(TAG_Double(0)) areaEffectCloud["Motion"] = motion areaEffectCloud["ReapplicationDelay"] = TAG_Int( options["ReapplicationDelay"]) areaEffectCloud["Potion"] = TAG_String("minecraft:potion") #********************************************# #Changes Durantion To The Max Value When True# #********************************************# if options["Last-Forever/No-Despawn"]: areaEffectCloud["Duration"] = TAG_Int(2147483647) else: areaEffectCloud["Duration"] = TAG_Int(options["Duration"]) areaEffectCloud["Air"] = TAG_Short(300) areaEffectCloud["OnGround"] = TAG_Byte(0) areaEffectCloud["Dimension"] = TAG_Int(0) rotation = TAG_List() rotation.append(TAG_Float(0.0)) rotation.append(TAG_Float(0.0)) areaEffectCloud["Rotation"] = rotation areaEffectCloud["RadiusPerTick"] = TAG_Float( options["RadiusPerTick"]) pos = TAG_List() pos.append(TAG_Double(x + 0.5)) pos.append(TAG_Double(y)) pos.append(TAG_Double(z + 0.5)) areaEffectCloud["Pos"] = pos areaEffectCloud["Fire"] = TAG_Short(0) areaEffectCloud["RadiusOnUse"] = TAG_Float( options["RadiusOnUse"]) areaEffectCloud["WaitTime"] = TAG_Int(options["WaitTime"]) chunk.Entities.append(areaEffectCloud) #********************************************# #Marks The Chunks As Dirty/ReLights Selection# #********************************************# chunk.dirty = True #********************************************************# #Prints Out Particle ID & Coordinates That Were Generated# #********************************************************# print "Created AreaEffectCloud " + str( ItemsSmokeBox) + " At X:" + str(x) + " Y:" + str( y) + " Z:" + str(z) #***************************************# #Prints Out Completed Generation Message# #***************************************# print "Completed Generation"
def createShop(level, x, y, z, emptyTrade, invincible, profession, unlimited): chest = level.tileEntityAt(x, y, z) if chest == None: return priceList = {} priceListB = {} saleList = {} for item in chest["Items"]: slot = item["Slot"].value if slot >= 0 and slot <= 8: priceList[slot] = item elif slot >= 9 and slot <= 17: priceListB[slot - 9] = item elif slot >= 18 and slot <= 26: saleList[slot - 18] = item villager = TAG_Compound() villager["OnGround"] = TAG_Byte(1) villager["Air"] = TAG_Short(300) villager["AttackTime"] = TAG_Short(0) villager["DeathTime"] = TAG_Short(0) villager["Fire"] = TAG_Short(-1) villager["Health"] = TAG_Short(20) villager["HurtTime"] = TAG_Short(0) villager["Age"] = TAG_Int(0) villager["Profession"] = TAG_Int(profession) villager["Riches"] = TAG_Int(0) villager["FallDistance"] = TAG_Float(0) villager["id"] = TAG_String("Villager") villager["Motion"] = TAG_List() villager["Motion"].append(TAG_Double(0)) villager["Motion"].append(TAG_Double(0)) villager["Motion"].append(TAG_Double(0)) villager["Pos"] = TAG_List() villager["Pos"].append(TAG_Double(x + 0.5)) villager["Pos"].append(TAG_Double(y)) villager["Pos"].append(TAG_Double(z + 0.5)) villager["Rotation"] = TAG_List() villager["Rotation"].append(TAG_Float(0)) villager["Rotation"].append(TAG_Float(0)) villager["Offers"] = TAG_Compound() villager["Offers"]["Recipes"] = TAG_List() for i in range(9): if (i in priceList or i in priceListB) and i in saleList: offer = TAG_Compound() if unlimited: offer["uses"] = TAG_Int(-2000000000) else: offer["uses"] = TAG_Int(0) if i in priceList: offer["buy"] = priceList[i] if i in priceListB: if i in priceList: offer["buyB"] = priceListB[i] else: offer["buy"] = priceListB[i] offer["sell"] = saleList[i] villager["Offers"]["Recipes"].append(offer) if emptyTrade: offer = TAG_Compound() offer["buy"] = TAG_Compound() offer["buy"]["Count"] = TAG_Byte(1) offer["buy"]["Damage"] = TAG_Short(0) offer["buy"]["id"] = TAG_Short(36) offer["sell"] = TAG_Compound() offer["sell"]["Count"] = TAG_Byte(1) offer["sell"]["Damage"] = TAG_Short(0) offer["sell"]["id"] = TAG_Short(36) villager["Offers"]["Recipes"].append(offer) if invincible: if "ActiveEffects" not in villager: villager["ActiveEffects"] = TAG_List() resist = TAG_Compound() resist["Amplifier"] = TAG_Byte(4) resist["Id"] = TAG_Byte(11) resist["Duration"] = TAG_Int(2000000000) villager["ActiveEffects"].append(resist) level.setBlockAt(x, y, z, 0) chunk = level.getChunk(x / 16, z / 16) chunk.Entities.append(villager) chunk.TileEntities.remove(chest) chunk.dirty = True
def createShop(level, x, y, z, stopTrade, variant, unlimited, customName, customNameVisible, maxHealth, professionGUI, rewardXP, componentGroups): chest = level.tileEntityAt(x, y, z) if chest == None: return priceList = {} priceListB = {} saleList = {} for item in chest["Items"]: slot = item["Slot"].value if slot >= 0 and slot <= 8: priceList[slot] = item del priceList[slot]["Slot"] priceList[slot]["id"] = TAG_Short(int(priceList[slot]["id"].value)) elif slot >= 9 and slot <= 17: priceListB[slot - 9] = item del priceListB[slot - 9]["Slot"] priceListB[slot - 9]["id"] = TAG_Short( int(priceListB[slot - 9]["id"].value)) elif slot >= 18 and slot <= 26: saleList[slot - 18] = item del saleList[slot - 18]["Slot"] saleList[slot - 18]["id"] = TAG_Short( int(saleList[slot - 18]["id"].value)) villager = TAG_Compound() villager["OnGround"] = TAG_Byte(1) villager["Air"] = TAG_Short(300) villager["Armor"] = TAG_List() for i in range(3): armorData = TAG_Compound() armorData["Count"] = TAG_Byte(0) armorData["Damage"] = TAG_Short(0) armorData["id"] = TAG_Short(0) villager["Armor"].append(armorData) villager["AttackTime"] = TAG_Short(0) villager["BodyRot"] = TAG_Float(-132.68496704101562) villager["ChestItems"] = TAG_List() for i in range(7): chestData = TAG_Compound() chestData["Count"] = TAG_Byte(0) chestData["Damage"] = TAG_Short(0) chestData["id"] = TAG_Short(0) villager["ChestItems"].append(chestData) villager["Chested"] = TAG_Byte(0) villager["Color"] = TAG_Byte(0) villager["DeathTime"] = TAG_Short(0) villager["FallDistance"] = TAG_Float(0.0) villager["Fire"] = TAG_Short(0) villager["HurtTime"] = TAG_Short(0) villager["Invulnerable"] = TAG_Byte(0) villager["Variant"] = TAG_Int(variant) villager["Riches"] = TAG_Int(0) villager["Persistent"] = TAG_Byte(1) villager["id"] = TAG_String("Villager") villager["CustomName"] = TAG_String(customName) villager["Pos"] = TAG_List() villager["Pos"].append(TAG_Float(x + 0.5)) villager["Pos"].append(TAG_Float(y)) villager["Pos"].append(TAG_Float(z + 0.5)) villager["definitions"] = TAG_List() villager["definitions"].append(TAG_String(u'+minecraft:villager')) villager["definitions"].append(TAG_String("+" + professionGUI)) villager["Rotation"] = TAG_List() villager["Rotation"].append(TAG_Float(0)) villager["Rotation"].append(TAG_Float(0)) if customNameVisible: villager["CustomName"] = TAG_String(customName) villager["CustomNameVisible"] = TAG_Byte(1) else: villager["CustomName"] = TAG_String(customName) villager["CustomNameVisible"] = TAG_Byte(0) if maxHealth: attributes = TAG_Compound() attributes["Name"] = TAG_String(u'minecraft:health') attributes["Base"] = TAG_Float(1024.0) attributes["Current"] = TAG_Float(1024.0) attributes["Max"] = TAG_Float(1024.0) villager["Attributes"] = TAG_List() villager["Attributes"].append(attributes) else: attributes = TAG_Compound() attributes["Name"] = TAG_String(u'minecraft:health') attributes["Base"] = TAG_Float(20.0) attributes["Current"] = TAG_Float(20.0) attributes["Max"] = TAG_Float(20.0) villager["Attributes"] = TAG_List() villager["Attributes"].append(attributes) villager["Offers"] = TAG_Compound() villager["Offers"]["Recipes"] = TAG_List() for i in range(9): if (i in priceList or i in priceListB) and i in saleList: offer = TAG_Compound() if unlimited: offer["uses"] = TAG_Int(-2000000000) offer["maxUses"] = TAG_Int(2000000000) else: offer["uses"] = TAG_Int(0) offer["maxUses"] = TAG_Int(1) offer["rewardExp"] = TAG_Byte(rewardXP) if i in priceList: offer["buyA"] = priceList[i] if i in priceListB: if i in priceList: offer["buyB"] = priceListB[i] else: offer["buyA"] = priceListB[i] offer["sell"] = saleList[i] villager["Offers"]["Recipes"].append(offer) if stopTrade: villager["TradeTier"] = TAG_Int(-2000000000) if componentGroups: componentGroups = string.split(componentGroups, ",") for i in componentGroups: villager["definitions"].append(TAG_String("+" + i)) level.setBlockAt(x, y, z, 0) chunk = level.getChunk(x / 16, z / 16) chunk.Entities.append(villager) chunk.TileEntities.remove(chest) chunk.dirty = True
mobSpawner["RequiredPlayerRange"] = TAG_Short(1000) mobSpawner["MaxNearbyEntities"] = TAG_Short(maxEntities) mobSpawner["SpawnRange"] = TAG_Short(spawnRange) mobSpawner["SpawnData"] = entity mobSpawner["EntityId"] = TAG_String(u'MinecartSpawner') mobSpawner["x"] = TAG_Int(x) mobSpawner["y"] = TAG_Int(y) mobSpawner["z"] = TAG_Int(z) return mobSpawner def minecartSpawner((cx, cy, cz), spawn1, spawn2, initialDelay=True): spawnerCart = TAG_Compound() spawnerCart["id"] = TAG_String(u'MinecartSpawner') spawnerCart["Items"] = TAG_List() motion = TAG_List() motion.append(TAG_Double(0.0)) motion.append(TAG_Double(0.0)) motion.append(TAG_Double(0.0)) spawnerCart["Motion"] = motion spawnerCart["OnGround"] = TAG_Byte(0) spawnerCart["Type"] = TAG_Int(0) if initialDelay: # 1 tick delay before first spawn, 1 tick before second spawnerCart["MinSpawnDelay"] = TAG_Short(1) spawnerCart["MaxSpawnDelay"] = TAG_Short(1) spawnerCart["Delay"] = TAG_Short(2) else: # instantaneous first spawn, 2 ticks before second spawnerCart["MinSpawnDelay"] = TAG_Short(2)
def fix(angle): while angle > pi: angle = angle - 2 * pi while angle < -pi: angle = angle + 2 * pi return angle # createSandSpawner() function by @SethBling (http://youtube.com/SethBling) # hacks by @abrightmoore def createSandSpawner(x, y, z, (block, data), frameNum, numFrames, tx, ty, tz, interval, delay, TICKS, life): spawner = TAG_Compound() spawner["id"] = TAG_String("MobSpawner") spawner["Items"] = TAG_List() spawner["x"] = TAG_Int(x) spawner["y"] = TAG_Int(y) spawner["z"] = TAG_Int(z) spawner["Delay"] = TAG_Short(TICKS * frameNum + delay) spawner["MinSpawnDelay"] = TAG_Short(interval + TICKS * numFrames) spawner["MaxSpawnDelay"] = TAG_Short(interval + TICKS * numFrames) spawner["SpawnCount"] = TAG_Short(1) spawner["SpawnData"] = createSandEntity(tx, ty, tz, block, data, life) spawner["MaxNearbyEntities"] = TAG_Short(10000) spawner["RequiredPlayerRange"] = TAG_Short(128) spawner["EntityId"] = TAG_String("FallingSand") return spawner # createSandEntity() function by @SethBling (http://youtube.com/SethBling)
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) (height, width) = surface.get_size() sx, sy, sz = box.size xsize, ysize, zsize = box.size * 128 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 perform(level, box, options): print "Follow Me On Twitter At @RedstonerLabs" for x in xrange(box.minx, box.maxx): for z in xrange(box.minz, box.maxz): for y in xrange(box.miny, box.maxy): invun = options["Invuneable"] float = options["NoGravity"] silent = options["Silent"] ROTX = options["Rotation"] Text2 = options["CustomName"] glowing = options["Glowing"] fire = options["Fire"] off1 = options["Offset X"] off2 = options["Offset Y"] off3 = options["Offset Z"] vis = options["CustomNameVisible"] ItemsSmokeBox = Smokeboxs[options["Boat Type"]] ItemsSmokeBox2 = Smokeboxs2[options["Minecraft Type"]] chunk = level.getChunk(x/16, z/16) Boat = TAG_Compound() if options["(1.11)(1.11.2)(1.11.2+)"]: Boat["id"] = TAG_String(u'boat') else: Boat["id"] = TAG_String(u'Boat') pos = TAG_List() pos.append(TAG_Double(x+off1)) pos.append(TAG_Double(y+off2)) pos.append(TAG_Double(z+off3)) Boat["Pos"] = pos Boat["OnGround"] = TAG_Byte(0) Boat["NoGravity"] = TAG_Byte(float) Boat["Silent"] = TAG_Byte(silent) motion = TAG_List() motion.append(TAG_Double(0.0)) motion.append(TAG_Double(0.0)) motion.append(TAG_Double(0.0)) Boat["Motion"] = motion Boat["Dimension"] = TAG_Int(0) Boat["Air"] = TAG_Short(300) rotation = TAG_List() rotation.append(TAG_Float(ROTX)) rotation.append(TAG_Float(0.0)) Boat["Rotation"] = rotation Boat["FallDistance"] = TAG_Float(0.0) Boat["Invulnerable"] = TAG_Byte(invun) Boat["PortalCooldown"] = TAG_Int(0) Boat["Glowing"] = TAG_Byte(glowing) Boat["CustomNameVisible"] = TAG_Byte(vis) Boat["CustomName"] = TAG_String(Text2) Boat["Fire"] = TAG_Short(fire) if ItemsSmokeBox == "oak" and ItemsSmokeBox2 == "CONSOLE": Boat["Type"] = TAG_Int(0) if ItemsSmokeBox == "birch" and ItemsSmokeBox2 == "CONSOLE": Boat["Type"] = TAG_Int(1) if ItemsSmokeBox == "spruce" and ItemsSmokeBox2 == "CONSOLE": Boat["Type"] = TAG_Int(2) if ItemsSmokeBox == "jungle" and ItemsSmokeBox2 == "CONSOLE": Boat["Type"] = TAG_Int(3) if ItemsSmokeBox == "acaica" and ItemsSmokeBox2 == "CONSOLE": Boat["Type"] = TAG_Int(4) if ItemsSmokeBox == "dark_oak" and ItemsSmokeBox2 == "CONSOLE": Boat["Type"] = TAG_Int(5) if ItemsSmokeBox == "glitched" and ItemsSmokeBox2 == "CONSOLE": Boat["Type"] = TAG_Int(-1) if ItemsSmokeBox2 == "PC": Boat["Type"] = TAG_String(ItemsSmokeBox) chunk.Entities.append(Boat) print "Completed Work"
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 createBlockEntity(chunk, convertTo, block, x, y, z): if convertTo == 'PE': # bed block if block == 26: te = TAG_Compound() te["color"] = TAG_Byte(14) te["id"] = TAG_String(u'Bed') te["x"] = TAG_Int(x) te["y"] = TAG_Int(y) te["z"] = TAG_Int(z) chunk.addTileEntity(te) # sticky piston elif block == 29: te = TAG_Compound() te["AttachedBlocks"] = TAG_List() te["BreakBlocks"] = TAG_List() te["id"] = TAG_String(u'PistonArm') te["isMovable"] = TAG_Byte(1) te["LastProgress"] = TAG_Float() te["NewState"] = TAG_Byte() te["Progress"] = TAG_Float() te["State"] = TAG_Byte() te["Sticky"] = TAG_Byte(1) te["x"] = TAG_Int(x) te["y"] = TAG_Int(y) te["z"] = TAG_Int(z) chunk.addTileEntity(te) # normal piston elif block == 33: te = TAG_Compound() te["AttachedBlocks"] = TAG_List() te["BreakBlocks"] = TAG_List() te["id"] = TAG_String(u'PistonArm') te["isMovable"] = TAG_Byte(1) te["LastProgress"] = TAG_Float() te["NewState"] = TAG_Byte() te["Progress"] = TAG_Float() te["State"] = TAG_Byte() te["Sticky"] = TAG_Byte(0) te["x"] = TAG_Int(x) te["y"] = TAG_Int(y) te["z"] = TAG_Int(z) chunk.addTileEntity(te) # chests elif block in [54, 146]: te = TAG_Compound() te["Items"] = TAG_List() te["id"] = TAG_String(u'Chest') te["x"] = TAG_Int(x) te["y"] = TAG_Int(y) te["z"] = TAG_Int(z) chunk.addTileEntity(te) else: raise Exception( 'block {} is not currently supported for making tile entities'. format(block)) # elif convertTo == 'PC': else: raise Exception( '{} is an unsupported conversion type'.format(convertTo)) return te
def perform(level, box, options): #**************# #Define Options# #**************# ItemsSmokeBox = Smokeboxs[options["Particle"]] colorvalue = dict([(trn._(a), b) for a, b in Smokeboxs2.items()])[options["ColorValue"]] #****************# #Define Selection# #****************# for x in xrange(box.minx, box.maxx): for z in xrange(box.minz, box.maxz): for y in xrange(box.miny, box.maxy): #********************************# #Checks If Console Edtion Is True# #********************************# chunk = level.getChunk(x/16, z/16) #*******************************# #Define & Create AreaEffectCloud# #*******************************# areaEffectCloud = TAG_Compound() areaEffectCloud["Radius"] = TAG_Float(options["Radius"]) areaEffectCloud["DurationOnUse"] = TAG_Int(0) areaEffectCloud["Invulnerable"] = TAG_Byte(options["Invulnerable"]) areaEffectCloud["PortalCooldown"] = TAG_Int(0) #*********************************************************************# #Checks If Console Edtion Is True And Converts Particle Ids To Console# #*********************************************************************# if options["Console Edtition"] and ItemsSmokeBox == "take": areaEffectCloud["Particle"] = TAG_Int(0) if options["Console Edtition"] != True and ItemsSmokeBox == "take": areaEffectCloud["Particle"] = TAG_String("take") if options["Console Edtition"] and ItemsSmokeBox == "note": areaEffectCloud["Particle"] = TAG_Int(2) if options["Console Edtition"] != True and ItemsSmokeBox == "note": areaEffectCloud["Particle"] = TAG_String("note") if options["Console Edtition"] and ItemsSmokeBox == "portal": areaEffectCloud["Particle"] = TAG_Int(3) if options["Console Edtition"] != True and ItemsSmokeBox == "portal": areaEffectCloud["Particle"] = TAG_String("portal") if options["Console Edtition"] and ItemsSmokeBox == "explode": areaEffectCloud["Particle"] = TAG_Int(5) if options["Console Edtition"] != True and ItemsSmokeBox == "explode": areaEffectCloud["Particle"] = TAG_String("explode") if options["Console Edtition"] and ItemsSmokeBox == "flame": areaEffectCloud["Particle"] = TAG_Int(6) if options["Console Edtition"] != True and ItemsSmokeBox == "flame": areaEffectCloud["Particle"] = TAG_String("flame") if options["Console Edtition"] and ItemsSmokeBox == "lava": areaEffectCloud["Particle"] = TAG_Int(7) if options["Console Edtition"] != True and ItemsSmokeBox == "lava": areaEffectCloud["Particle"] = TAG_String("lava") if options["Console Edtition"] and ItemsSmokeBox == "footstep": areaEffectCloud["Particle"] = TAG_Int(8) if options["Console Edtition"] != True and ItemsSmokeBox == "footstep": areaEffectCloud["Particle"] = TAG_String("footstep") if options["Console Edtition"] and ItemsSmokeBox == "droplet": areaEffectCloud["Particle"] = TAG_Int(9) if options["Console Edtition"] != True and ItemsSmokeBox == "droplet": areaEffectCloud["Particle"] = TAG_String("droplet") if options["Console Edtition"] and ItemsSmokeBox == "largesmoke": areaEffectCloud["Particle"] = TAG_Int(10) if options["Console Edtition"] != True and ItemsSmokeBox == "largesmoke": areaEffectCloud["Particle"] = TAG_String("largesmoke") if options["Console Edtition"] and ItemsSmokeBox == "reddust": areaEffectCloud["Particle"] = TAG_Int(11) if options["Console Edtition"] != True and ItemsSmokeBox == "reddust": areaEffectCloud["Particle"] = TAG_String("reddust") if options["Console Edtition"] and ItemsSmokeBox == "snowballpoof": areaEffectCloud["Particle"] = TAG_Int(12) if options["Console Edtition"] != True and ItemsSmokeBox == "snowballpoof": areaEffectCloud["Particle"] = TAG_String("snowballpoof") if options["Console Edtition"] and ItemsSmokeBox == "snowshovel": areaEffectCloud["Particle"] = TAG_Int(13) if options["Console Edtition"] != True and ItemsSmokeBox == "snowshovel": areaEffectCloud["Particle"] = TAG_String("snowshovel") if options["Console Edtition"] and ItemsSmokeBox == "slime": areaEffectCloud["Particle"] = TAG_Int(14) if options["Console Edtition"] != True and ItemsSmokeBox == "slime": areaEffectCloud["Particle"] = TAG_String("slime") if options["Console Edtition"] and ItemsSmokeBox == "heart": areaEffectCloud["Particle"] = TAG_Int(15) if options["Console Edtition"] != True and ItemsSmokeBox == "heart": areaEffectCloud["Particle"] = TAG_String("heart") if options["Console Edtition"] and ItemsSmokeBox == "depthsuspend": areaEffectCloud["Particle"] = TAG_Int(17) if options["Console Edtition"] != True and ItemsSmokeBox == "depthsuspend": areaEffectCloud["Particle"] = TAG_String("depthsuspend") if options["Console Edtition"] and ItemsSmokeBox == "crit": areaEffectCloud["Particle"] = TAG_Int(18) if options["Console Edtition"] != True and ItemsSmokeBox == "crit": areaEffectCloud["Particle"] = TAG_String("crit") if options["Console Edtition"] and ItemsSmokeBox == "hugeexplosion": areaEffectCloud["Particle"] = TAG_Int(19) if options["Console Edtition"] != True and ItemsSmokeBox == "hugeexplosion": areaEffectCloud["Particle"] = TAG_String("hugeexplosion") if options["Console Edtition"] and ItemsSmokeBox == "largeexplode": areaEffectCloud["Particle"] = TAG_Int(20) if options["Console Edtition"] != True and ItemsSmokeBox == "largeexplode": areaEffectCloud["Particle"] = TAG_String("largeexplode") if options["Console Edtition"] and ItemsSmokeBox == "spell": areaEffectCloud["Particle"] = TAG_Int(22) if options["Console Edtition"] != True and ItemsSmokeBox == "spell": areaEffectCloud["Particle"] = TAG_String("spell") if options["Console Edtition"] and ItemsSmokeBox == "witchMagic": areaEffectCloud["Particle"] = TAG_Int(23) if options["Console Edtition"] != True and ItemsSmokeBox == "witchMagic": areaEffectCloud["Particle"] = TAG_String("witchMagic") if options["Console Edtition"] and ItemsSmokeBox == "mobSpell": areaEffectCloud["Particle"] = TAG_Int(24) if options["Console Edtition"] != True and ItemsSmokeBox == "mobSpell": areaEffectCloud["Particle"] = TAG_String("mobSpell") if options["Console Edtition"] and ItemsSmokeBox == "mobSpellAmbient": areaEffectCloud["Particle"] = TAG_Int(25) if options["Console Edtition"] != True and ItemsSmokeBox == "mobSpellAmbient": areaEffectCloud["Particle"] = TAG_String("mobSpellAmbient") if options["Console Edtition"] and ItemsSmokeBox == "suspended": areaEffectCloud["Particle"] = TAG_Int(27) if options["Console Edtition"] != True and ItemsSmokeBox == "suspended": areaEffectCloud["Particle"] = TAG_String("suspended") if options["Console Edtition"] and ItemsSmokeBox == "fallingdust": areaEffectCloud["Particle"] = TAG_Int(28) if options["Console Edtition"] != True and ItemsSmokeBox == "fallingdust": areaEffectCloud["Particle"] = TAG_String("fallingdust") if options["Console Edtition"] and ItemsSmokeBox == "enchantmenttable": areaEffectCloud["Particle"] = TAG_Int(29) if options["Console Edtition"] != True and ItemsSmokeBox == "enchantmenttable": areaEffectCloud["Particle"] = TAG_String("enchantmenttable") if options["Console Edtition"] and ItemsSmokeBox == "angryVillager": areaEffectCloud["Particle"] = TAG_Int(31) if options["Console Edtition"] != True and ItemsSmokeBox == "angryVillager": areaEffectCloud["Particle"] = TAG_String("angryVillager") if options["Console Edtition"] and ItemsSmokeBox == "happyVillager": areaEffectCloud["Particle"] = TAG_Int(32) if options["Console Edtition"] != True and ItemsSmokeBox == "happyVillager": areaEffectCloud["Particle"] = TAG_String("happyVillager") if options["Console Edtition"] and ItemsSmokeBox == "fireworksSpark": areaEffectCloud["Particle"] = TAG_Int(33) if options["Console Edtition"] != True and ItemsSmokeBox == "fireworksSpark": areaEffectCloud["Particle"] = TAG_String("fireworksSpark") if options["Console Edtition"] and ItemsSmokeBox == "splash": areaEffectCloud["Particle"] = TAG_Int(34) if options["Console Edtition"] != True and ItemsSmokeBox == "splash": areaEffectCloud["Particle"] = TAG_String("splash") if options["Console Edtition"] and ItemsSmokeBox == "magicCrit": areaEffectCloud["Particle"] = TAG_Int(35) if options["Console Edtition"] != True and ItemsSmokeBox == "magicCrit": areaEffectCloud["Particle"] = TAG_String("magicCrit") if options["Console Edtition"] and ItemsSmokeBox == "cloud": areaEffectCloud["Particle"] = TAG_Int(37) if options["Console Edtition"] != True and ItemsSmokeBox == "cloud": areaEffectCloud["Particle"] = TAG_String("cloud") if options["Console Edtition"] and ItemsSmokeBox == "barrier": areaEffectCloud["Particle"] = TAG_Int(38) if options["Console Edtition"] != True and ItemsSmokeBox == "barrier": areaEffectCloud["Particle"] = TAG_String("barrier") if options["Console Edtition"] and ItemsSmokeBox == "iconcrack": areaEffectCloud["Particle"] = TAG_Int(39) if options["Console Edtition"] != True and ItemsSmokeBox == "iconcrack": areaEffectCloud["Particle"] = TAG_String("iconcrack") if options["Console Edtition"] and ItemsSmokeBox == "blockcrack": areaEffectCloud["Particle"] = TAG_Int(40) if options["Console Edtition"] != True and ItemsSmokeBox == "blockcrack": areaEffectCloud["Particle"] = TAG_String("blockcrack") if options["Console Edtition"] and ItemsSmokeBox == "Invisible": areaEffectCloud["Particle"] = TAG_Int(43) if options["Console Edtition"] != True and ItemsSmokeBox == "Invisible": areaEffectCloud["Particle"] = TAG_String("Invisible") if options["Console Edtition"] and ItemsSmokeBox == "dragonbreath": areaEffectCloud["Particle"] = TAG_Int(44) if options["Console Edtition"] != True and ItemsSmokeBox == "dragonbreath": areaEffectCloud["Particle"] = TAG_String("dragonbreath") if options["Console Edtition"] and ItemsSmokeBox == "endRod": areaEffectCloud["Particle"] = TAG_Int(45) if options["Console Edtition"] != True and ItemsSmokeBox == "endRod": areaEffectCloud["Particle"] = TAG_String("endRod") if options["Console Edtition"] and ItemsSmokeBox == "damageIndicator": areaEffectCloud["Particle"] = TAG_Int(46) if options["Console Edtition"] != True and ItemsSmokeBox == "damageIndicator": areaEffectCloud["Particle"] = TAG_String("damageIndicator") customPotionEffects = TAG_List() customPotionEffect = TAG_Compound() customPotionEffect["ShowParticles"] = TAG_Byte(options["ShowParticles"]) customPotionEffect["Duration"] = TAG_Int(options["Effect Duration"]) customPotionEffect["Id"] = TAG_Int(options["Effect ID"]) customPotionEffect["Amplifier"] = TAG_Int(options["Effect Amplifier"]) customPotionEffects.append(customPotionEffect) areaEffectCloud["Effects"] = customPotionEffects areaEffectCloud["FallDistance"] = TAG_Float(0.0) #**************************************# #1.11+ Support Changes ID To New Format# #**************************************# if options["1.11-1.12+Plus"]: AreaEffectCloud["id"] = TAG_String(u'area_effect_cloud') else: areaEffectCloud["id"] = TAG_String(u'AreaEffectCloud') areaEffectCloud["ParticleParam1"] = TAG_Int(options["ParticleParam1"]) areaEffectCloud["ParticleParam2"] = TAG_Int(options["ParticleParam2"]) areaEffectCloud["Age"] = TAG_Int(options["Age"]) #********************************************# #Custom ColorValue Option Aplies To Particles# #********************************************# if options["Custom ColorValue"]: areaEffectCloud["Color"] = TAG_Int(colorvalue) else: areaEffectCloud["Color"] = TAG_Int(0) motion = TAG_List() motion.append(TAG_Double(0)) motion.append(TAG_Double(0)) motion.append(TAG_Double(0)) areaEffectCloud["Motion"] = motion areaEffectCloud["ReapplicationDelay"] = TAG_Int(options["ReapplicationDelay"]) areaEffectCloud["Potion"] = TAG_String("minecraft:potion") #********************************************# #Changes Durantion To The Max Value When True# #********************************************# if options["Last-Forever/No-Despawn"]: areaEffectCloud["Duration"] = TAG_Int(2147483647) else: areaEffectCloud["Duration"] = TAG_Int(options["Duration"]) areaEffectCloud["Air"] = TAG_Short(300) areaEffectCloud["OnGround"] = TAG_Byte(0) areaEffectCloud["Dimension"] = TAG_Int(0) rotation = TAG_List() rotation.append(TAG_Float(0.0)) rotation.append(TAG_Float(0.0)) areaEffectCloud["Rotation"] = rotation areaEffectCloud["RadiusPerTick"] = TAG_Float(options["RadiusPerTick"]) pos = TAG_List() pos.append(TAG_Double(x+0.5)) pos.append(TAG_Double(y)) pos.append(TAG_Double(z+0.5)) areaEffectCloud["Pos"] = pos areaEffectCloud["Fire"] = TAG_Short(0) areaEffectCloud["RadiusOnUse"] = TAG_Float(options["RadiusOnUse"]) areaEffectCloud["WaitTime"] = TAG_Int(options["WaitTime"]) chunk.Entities.append(areaEffectCloud) #********************************************# #Marks The Chunks As Dirty/ReLights Selection# #********************************************# chunk.dirty = True #********************************************************# #Prints Out Particle ID & Coordinates That Were Generated# #********************************************************# print "Created AreaEffectCloud " + str(ItemsSmokeBox) + " At X:" + str(x) + " Y:" + str(y) + " Z:" + str(z) #***************************************# #Prints Out Completed Generation Message# #***************************************# print "Completed Generation"
# This will find the closest Target and set it as the only target return ret def dist2((x1, y1, z1), (x2, y2, z2)): dx = x2 - x1 dy = y2 - y1 dz = z2 - z1 return dx * dx + dy * dy + dz * dz def createSpawner((x, y, z), delay, loopTicks, range): spawner = TAG_Compound() spawner["id"] = TAG_String("MobSpawner") spawner["Items"] = TAG_List() spawner["x"] = TAG_Int(x) spawner["y"] = TAG_Int(y) spawner["z"] = TAG_Int(z) spawner["Delay"] = TAG_Short(delay) spawner["MinSpawnDelay"] = TAG_Short(loopTicks) spawner["MaxSpawnDelay"] = TAG_Short(loopTicks) spawner["SpawnCount"] = TAG_Short(1) spawner["MaxNearbyEntities"] = TAG_Short(10000) spawner["RequiredPlayerRange"] = TAG_Short(range) # Creates a spawner with certain aspects return spawner def createPotion((x, y, z), (vx, vy, vz), effect, duration, amp, potionId):