Advertisement
Ceandros

Delete and Find Specific Entities

Aug 1st, 2013
1,279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.03 KB | None | 0 0
  1. # Feel free to modify and use this filter however you wish. If you don please give credit to Ceandros
  2. # http://Sethbling.com
  3. # http://youtube.com/Ceandros
  4.  
  5. from pymclevel import TAG_List
  6. from pymclevel import TAG_Byte
  7. from pymclevel import TAG_Int
  8. from pymclevel import TAG_Compound
  9.  
  10. displayName = "Delete Specific Entities"
  11.  
  12. inputs = (
  13.     ("Action:",("Delete in selection", "Delete in void", "Delete above world", "List coordinates")),
  14.     ("Cattle and Environmental:", False),
  15.     ("Villagers and Golems:", False),
  16.     ("Tamable Mobs:", False),
  17.     ("Monsters and Bosses:", False),
  18.     ("Minecarts and Boats:", False),
  19.     ("Falling Blocks:", False),
  20.     ("Explosives:", False),
  21.     ("Items and orbs:", False),
  22.     ("Projectiles and Fireworks:", False),
  23.     ("Immobile:", False),
  24. )
  25.  
  26. def perform(level, box, options):
  27.     Cattle = options["Cattle and Environmental:"]
  28.     Village = options["Villagers and Golems:"]
  29.     Tamable = options["Tamable Mobs:"]
  30.     Monster = options["Monsters and Bosses:"]
  31.     Transport = options["Minecarts and Boats:"]
  32.     Sand = options["Falling Blocks:"]
  33.     Explo = options["Explosives:"]
  34.     Items = options["Items and orbs:"]
  35.     Project = options["Projectiles and Fireworks:"]
  36.     Paintings = options["Immobile:"]
  37.    
  38.     entitiesToRemove = []
  39.  
  40.     for (chunk, slices, point) in level.getChunkSlices(box):
  41.         chunk.dirty = True
  42.         for e in chunk.Entities:
  43.             x = e["Pos"][0].value
  44.             y = e["Pos"][1].value
  45.             z = e["Pos"][2].value
  46.            
  47.             if x >= (box.minx - 0.5) and x < (box.maxx + 0.5) and z >= (box.minz - 0.5) and z < (box.maxz + 0.5) and ((y >= (box.miny - 0.5) and y < (box.maxy + 0.5)) or y < 0 or y > 256):
  48.                 if options["Action:"] is not "List coordinates":
  49.                     if y < 0:
  50.                         if options["Action:"] is "Delete in void":
  51.                             continue
  52.                     elif y > 256:
  53.                         if options["Action:"] is "Delete above world":
  54.                             continue
  55.                     else:
  56.                         if options["Action:"] is "Delete in selection":
  57.                             continue
  58.                
  59.                
  60.                 i = e["id"].value
  61.                
  62.                 if Cattle:
  63.                     if i == "Bat" or i == "Chicken" or i == "Cow" or i == "MushroomCow" or i == "Pig" or i == "Sheep" or i == "Squid":
  64.                         entitiesToRemove.append((chunk, e))
  65.                         continue
  66.                 if Village:
  67.                     if i == "Villager" or i == "VillagerGolem" or i == "Snowman":
  68.                         entitiesToRemove.append((chunk, e))
  69.                         continue
  70.                 if Tamable:
  71.                     if i == "Wolf" or i == "Ozelot" or i == "eHorse":
  72.                         entitiesToRemove.append((chunk, e))
  73.                         continue
  74.                 if Monster:
  75.                     if i == "Blaze" or i == "CaveSpider" or i == "Creeper" or i == "Ghast" or i == "LavaSlime" or i == "Silverfish" or i == "Skeleton" or i == "Slime" or i == "Spider" or i == "Witch" or i == "Zombie" or i == "EnderDragon" or i == "WitherBoss":
  76.                         entitiesToRemove.append((chunk, e))
  77.                         continue
  78.                 if Transport:
  79.                     if i == "MinecartRideable" or i == "MinecartFurnace" or i == "MinecartChest" or i == "MinecartHopper" or i == "MinecartSpawner" or i == "Boat":
  80.                         entitiesToRemove.append((chunk, e))
  81.                         continue
  82.                 if Sand:
  83.                     if i == "FallingSand":
  84.                         entitiesToRemove.append((chunk, e))
  85.                         continue
  86.                 if Explo:
  87.                     if i == "PrimedTnt" or i == "EnderCrystal" or i == "FireworksRockete"  or i == "MinecartTNT":
  88.                         entitiesToRemove.append((chunk, e))
  89.                         continue
  90.                 if Items:
  91.                     if i == "Item" or i == "XPOrb":
  92.                         entitiesToRemove.append((chunk, e))
  93.                         continue
  94.                 if Project:
  95.                     if i == "Arrow" or i == "Snowball" or i == "Fireball" or i == "SmallFireball" or i == "ThrownEnderpearl" or i == "EyeOfEnderSignal" or i == "ThrownPotion" or i == "ThrownExpBottle" or i == "WitherSkull" or i == "FireworksRockete":
  96.                         entitiesToRemove.append((chunk, e))
  97.                         continue
  98.                 if Paintings:
  99.                     if i == "LeashKnot" or i == "Painting" or i == "ItemFrame":
  100.                         entitiesToRemove.append((chunk, e))
  101.                         continue
  102.                        
  103.     if options["Action:"] is "List coordinates":
  104.         for (chunk, e) in entitiesToRemove:
  105.             chunk.Entities.remove(e)
  106.     else:
  107.         for (chunk, e) in entitiesToRemove:
  108.             print "%s, x=%s, y=%s, z=%s." % (e["id"].value, e["Pos"][0].value, e["Pos"][1].value, e["Pos"][2].value)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement