Guest User

Untitled

a guest
Jul 19th, 2014
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.20 KB | None | 0 0
  1. # Feel free to modify and use this filter however you wish. If you do,
  2. # please give credit to SethBling.
  3. # http://youtube.com/SethBling
  4.  
  5. from pymclevel import TAG_Compound
  6. from pymclevel import TAG_Int
  7. from pymclevel import TAG_Short
  8. from pymclevel import TAG_Byte
  9. from pymclevel import TAG_String
  10. from pymclevel import TAG_Float
  11. from pymclevel import TAG_Double
  12. from pymclevel import TAG_List
  13.  
  14.  
  15. inputs = (
  16. ("Mob", (
  17. "Skeleton",
  18. "Zombie",
  19. "PigZombie",
  20. "Wither Skeleton",
  21. "Spider",
  22. "Guardian",
  23. "Creeper",
  24. )),
  25. ("Baby", False),
  26. ("Villager", False),
  27. ("Hostile (Pigmen only)", True),
  28. ("Held Drop %", 5),
  29. ("Foot Drop %", 5),
  30. ("Legs Drop %", 5),
  31. ("Chest Drop %", 5),
  32. ("Head Drop %", 5),
  33. )
  34.  
  35. displayName = "Create Geared Mobs"
  36.  
  37.  
  38. def perform(level, box, options):
  39. held = float(options["Held Drop %"] / 100.0)
  40. foot = float(options["Foot Drop %"] / 100.0)
  41. legs = float(options["Legs Drop %"] / 100.0)
  42. body = float(options["Chest Drop %"] / 100.0)
  43. head = float(options["Head Drop %"] / 100.0)
  44.  
  45. for x in range(box.minx, box.maxx):
  46. for y in range(box.miny, box.maxy):
  47. for z in range(box.minz, box.maxz):
  48. if level.blockAt(x, y, z) == 54:
  49. createMobs(level, x, y, z, options["Mob"], options["Villager"], options["Baby"],options["Hostile (Pigmen only)"], held, foot, legs, body, head)
  50.  
  51. def createMobs(level, x, y, z, mobType, villager, baby, hostile, held, foot, legs, body, head):
  52. chest = level.tileEntityAt(x, y, z)
  53. if chest == None:
  54. return
  55.  
  56. slots = {}
  57.  
  58. for item in chest["Items"]:
  59. slot = item["Slot"].value
  60. slots[slot] = item
  61.  
  62. mob = TAG_Compound()
  63. mob["OnGround"] = TAG_Byte(1)
  64. mob["Air"] = TAG_Short(300)
  65. mob["AttackTime"] = TAG_Short(0)
  66. mob["DeathTime"] = TAG_Short(0)
  67. mob["Fire"] = TAG_Short(-1)
  68. mob["Health"] = TAG_Short(20)
  69. mob["HurtTime"] = TAG_Short(0)
  70. mob["Age"] = TAG_Int(0)
  71. mob["FallDistance"] = TAG_Float(0)
  72. mob["Motion"] = TAG_List()
  73. mob["Motion"].append(TAG_Double(0))
  74. mob["Motion"].append(TAG_Double(0))
  75. mob["Motion"].append(TAG_Double(0))
  76. mob["Pos"] = TAG_List()
  77. mob["Pos"].append(TAG_Double(x + 0.5))
  78. mob["Pos"].append(TAG_Double(y))
  79. mob["Pos"].append(TAG_Double(z + 0.5))
  80. mob["Rotation"] = TAG_List()
  81. mob["Rotation"].append(TAG_Float(0))
  82. mob["Rotation"].append(TAG_Float(0))
  83. if mobType == "Wither Skeleton":
  84. mob["id"] = TAG_String("Skeleton")
  85. mob["SkeletonType"] = TAG_Byte(1)
  86. else:
  87. mob["id"] = TAG_String(mobType)
  88.  
  89. if mobType in ("Zombie", "PigZombie"):
  90. mob["ConversionTime"] = TAG_Int(-1)
  91. if mobType == "PigZombie":
  92. mob["Anger"] = TAG_Short(1)
  93. if villager:
  94. mob["IsVillager"] = TAG_Byte(1)
  95. if baby:
  96. mob["IsBaby"] = TAG_Byte(1)
  97.  
  98. eq = TAG_List()
  99. for slot in range(5):
  100. if slot not in slots:
  101. eq.append(TAG_Compound())
  102. else:
  103. eq.append(slots[slot])
  104.  
  105. mob["Equipment"] = eq
  106.  
  107. chance = TAG_List()
  108. chance.append(TAG_Float(held))
  109. chance.append(TAG_Float(foot))
  110. chance.append(TAG_Float(legs))
  111. chance.append(TAG_Float(body))
  112. chance.append(TAG_Float(head))
  113.  
  114. mob["DropChances"] = chance
  115.  
  116. level.setBlockAt(x, y, z, 0)
  117.  
  118. chunk = level.getChunk(x / 16, z / 16)
  119. chunk.Entities.append(mob)
  120. chunk.TileEntities.remove(chest)
  121. chunk.dirty = True
Add Comment
Please, Sign In to add comment