Advertisement
BigGamingGamers

Client Bomb

Dec 11th, 2020 (edited)
2,698
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. local SLOT_COUNT = 16
  2.  
  3. local modem = peripheral.wrap("left")
  4. modem.open(100)
  5.  
  6. function checkFuel()
  7. turtle.select(1)
  8.  
  9. if(turtle.getFuelLevel() < 50) then
  10. print("Attempting Refuel...")
  11. for slot = 1, SLOT_COUNT, 1 do
  12. turtle.select(slot)
  13. if(turtle.refuel(1)) then
  14. return true
  15. end
  16. end
  17.  
  18. return false
  19. else
  20. return true
  21. end
  22. end
  23.  
  24. function getItemIndex(itemName)
  25. for slot = 1, SLOT_COUNT, 1 do
  26. local item = turtle.getItemDetail(slot)
  27. if(item ~= nil) then
  28. if(item["name"] == itemName) then
  29. return slot
  30. end
  31. end
  32. end
  33. end
  34.  
  35.  
  36. print("Waiting for signal")
  37. event, side, senderChannel, replyChannel, msg, distance = os.pullEvent("modem_message")
  38.  
  39. while(true) do
  40. checkFuel()
  41. getItemIndex("minecraft:tnt")
  42.  
  43. for i = 1, 2, 1 do
  44. turtle.forward()
  45. end
  46.  
  47. turtle.placeDown()
  48. redstone.setOutput("bottom", true)
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement