Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Feel free to modify and use this filter however you wish. If you do,
- # please give credit to SethBling.
- # http://youtube.com/SethBling
- from pymclevel import TAG_Compound
- from pymclevel import TAG_Int
- from pymclevel import TAG_Short
- from pymclevel import TAG_Byte
- from pymclevel import TAG_String
- from pymclevel import TAG_Float
- from pymclevel import TAG_Double
- from pymclevel import TAG_List
- inputs = (
- ("Mob", (
- "Skeleton",
- "Zombie",
- "PigZombie",
- "Wither Skeleton",
- "Spider",
- "Guardian",
- "Creeper",
- )),
- ("Baby", False),
- ("Villager", False),
- ("Hostile (Pigmen only)", True),
- ("Held Drop %", 5),
- ("Foot Drop %", 5),
- ("Legs Drop %", 5),
- ("Chest Drop %", 5),
- ("Head Drop %", 5),
- )
- displayName = "Create Geared Mobs"
- def perform(level, box, options):
- held = float(options["Held Drop %"] / 100.0)
- foot = float(options["Foot Drop %"] / 100.0)
- legs = float(options["Legs Drop %"] / 100.0)
- body = float(options["Chest Drop %"] / 100.0)
- head = float(options["Head Drop %"] / 100.0)
- for x in range(box.minx, box.maxx):
- for y in range(box.miny, box.maxy):
- for z in range(box.minz, box.maxz):
- if level.blockAt(x, y, z) == 54:
- createMobs(level, x, y, z, options["Mob"], options["Villager"], options["Baby"],options["Hostile (Pigmen only)"], held, foot, legs, body, head)
- def createMobs(level, x, y, z, mobType, villager, baby, hostile, held, foot, legs, body, head):
- chest = level.tileEntityAt(x, y, z)
- if chest == None:
- return
- slots = {}
- for item in chest["Items"]:
- slot = item["Slot"].value
- slots[slot] = item
- mob = TAG_Compound()
- mob["OnGround"] = TAG_Byte(1)
- mob["Air"] = TAG_Short(300)
- mob["AttackTime"] = TAG_Short(0)
- 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(0))
- mob["Motion"].append(TAG_Double(0))
- mob["Motion"].append(TAG_Double(0))
- 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(0))
- mob["Rotation"].append(TAG_Float(0))
- if mobType == "Wither Skeleton":
- mob["id"] = TAG_String("Skeleton")
- mob["SkeletonType"] = TAG_Byte(1)
- else:
- mob["id"] = TAG_String(mobType)
- if mobType in ("Zombie", "PigZombie"):
- mob["ConversionTime"] = TAG_Int(-1)
- if mobType == "PigZombie":
- mob["Anger"] = TAG_Short(1)
- if villager:
- mob["IsVillager"] = TAG_Byte(1)
- if baby:
- mob["IsBaby"] = TAG_Byte(1)
- eq = TAG_List()
- for slot in range(5):
- if slot not in slots:
- eq.append(TAG_Compound())
- else:
- eq.append(slots[slot])
- mob["Equipment"] = eq
- chance = TAG_List()
- chance.append(TAG_Float(held))
- chance.append(TAG_Float(foot))
- chance.append(TAG_Float(legs))
- chance.append(TAG_Float(body))
- chance.append(TAG_Float(head))
- mob["DropChances"] = chance
- level.setBlockAt(x, y, z, 0)
- chunk = level.getChunk(x / 16, z / 16)
- chunk.Entities.append(mob)
- chunk.TileEntities.remove(chest)
- chunk.dirty = True
Add Comment
Please, Sign In to add comment