Advertisement
thatparadox

Wither Spawner

Jul 12th, 2014
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.25 KB | None | 0 0
  1. sense = peripheral.wrap("top")
  2. mobType = 0
  3.  
  4. mobs = sense.getMobIds() -- find mobs
  5.  
  6. while true do
  7. wither = false
  8. for k, mobId in pairs(mobs) do --read information stored in mobs
  9.   mob = sense.getMobData(mobId)
  10.   mobType = mob.type
  11.   print("mob: "..mobType) --print mob type
  12.   print("at X: "..mob.position.x) --print mob coordinates
  13.   print("at Y: "..mob.position.y)
  14.   print("at Z: "..mob.position.z)  
  15.   if mobType == "Wither" and mob.position.x < 4 and mob.position.z < 4 then
  16.     wither = true
  17.     print("Wither Spawned")
  18.     while wither do
  19.       rs.setOutput("left",true)
  20.       os.sleep(0.1)
  21.       rs.setOutput("left",false)
  22.       mobs = sense.getMobIds()
  23.       witherPersists = false
  24.       for k, mobId in pairs(mobs) do
  25.         mob = sense.getMobData(mobId)
  26.         if mob.type == "Wither" then
  27.           witherPersists = true
  28.         end
  29.       end
  30.       if witherPersists == false then
  31.         wither = false
  32.         rs.setOutput("front", true)
  33.         os.sleep(0.5)
  34.         rs.setOutput("front", false)
  35.       end
  36.     end
  37.   end
  38. end
  39. if wither == false then
  40.   rs.setOutput("back", true)
  41.   os.sleep(3)
  42.   rs.setOutput("back", false)
  43.   rs.setOutput("right", true)
  44.   os.sleep(1.3)
  45.   rs.setOutput("right", false)
  46. end
  47. os.sleep(0.1)
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement