Advertisement
GNOOR1S

WOOT - Mob Selected

Jul 6th, 2022
839
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.13 KB | None | 0 0
  1. os.loadAPI("button")
  2. local monitor = peripheral.wrap("top")
  3. -- Created by Gunnar Jessee / LostboyDev
  4.  
  5. local mobs = { wither = "wither", skeletons = "skeletons", witherSkeletons = "WS",
  6.             witch = "witch", chicken = "chicken" }
  7.  
  8. local selectedMob = mobs.witherSkeletons
  9. local width, height = monitor.getSize()
  10.  
  11. function fillButtons()
  12.     button.setTable(mobs.wither, wither, 2, 10, 2, 4)
  13.     button.setTable(mobs.skeletons, skeletons, 2, 10, 6, 8)
  14.     button.setTable(mobs.witherSkeletons, witherSkeletons, 2, 10, 10, 12)
  15.     button.setTable(mobs.chicken, chicken, 2, 10, 14, 16)
  16.     button.setTable(mobs.witch, witch, 12, 20, 2, 4)
  17.  
  18. end
  19.  
  20. function wither()
  21.     local name = mobs.wither
  22.     button.flash(name)
  23.     rednet.broadcast(name, "woot")
  24. end
  25.  
  26. function witherSkeletons()
  27.     local name = mobs.witherSkeletons
  28.     button.flash(name)
  29.     rednet.broadcast(name, "woot")
  30. end
  31.  
  32. function skeletons()
  33.     local name = mobs.skeletons
  34.     button.flash(name)
  35.     rednet.broadcast(name, "woot")
  36. end
  37.  
  38. function witch()
  39.     local name = mobs.witch
  40.     button.flash(name)
  41.     rednet.broadcast(name, "woot")
  42. end
  43.  
  44. function chicken()
  45.     local name = mobs.chicken
  46.     button.flash(name)
  47.     rednet.broadcast(name, "woot")
  48. end
  49.  
  50. rednet.open("left")
  51. function sendPacket(name)
  52.     rednet.broadcast(name, "woot")
  53. end
  54.  
  55. function checkClick()
  56.     event, side, x, y = os.pullEvent("monitor_touch")
  57.     button.checkxy(x, y)
  58. end
  59.  
  60. local backgroundColor = colors.white
  61. function changeBackgroundColor()
  62.     if backgroundColor == colors.white then
  63.         backgroundColor = colors.white
  64.     else
  65.         backgroundColor = colors.white
  66.     end
  67. end
  68.  
  69. function checkeredPattern()
  70.     for x = 1, width do
  71.         for y = 1, height do
  72.             changeBackgroundColor()
  73.             monitor.setBackgroundColor(backgroundColor)
  74.             monitor.setCursorPos(x, y)
  75.             monitor.write(" ")
  76.             monitor.setTextColor(colors.black)
  77.         end
  78.     end
  79. end
  80.  
  81.  
  82. monitor.clear()
  83. monitor.setCursorPos(1, 1)
  84. checkeredPattern()
  85. button.heading("COMAS")
  86. fillButtons()
  87. button.screen()
  88.  
  89. while true do
  90.     checkClick()
  91. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement