Advertisement
FERROUSSAGE

robot

Nov 10th, 2018
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.97 KB | None | 0 0
  1. local c = require("component")
  2. local r = require("robot")
  3.  
  4. local inv = c.inventory_controller
  5.  
  6. local whiteList = {
  7.    
  8.     'exnihilo:dust',
  9.     'minecraft:dirt',
  10.     'minecraft:soul_sand',
  11.     'minecraft:gravel',
  12.     'minecraft:sand',
  13.     'exnihilo:exnihilo.gravel_nether',
  14.     'exnihilo:exnihilo.gravel_ender',
  15.     'minecraft:stone',
  16.     'TConstruct:slime.gel',
  17.     'ExtraItilities:cabblestone_compressed',
  18.     'excompressum:compressed_dust'
  19. }
  20.  
  21. function check(ItemId)
  22.     for _, v in pairs(whiteList) do
  23.         if v == itemId then
  24.             return true
  25.         end
  26.     end
  27.     return false
  28. end
  29.  
  30. function findItm()
  31.     for i=1,r.inventorySize() do
  32.         slot = inv.getStackInInternalSlot(i)
  33.         if slot and check(inv.getStackInInternalSlot(i).name) then
  34.             r.select(i)
  35.             inv.equip()
  36.             return
  37.         end
  38.     end
  39. end
  40.  
  41. function main()
  42.     while true do
  43.         _,tools = r.durability()
  44.         if tools == 'no tool equipped' then
  45.             findItm()
  46.         end
  47.         for i=1,10 do
  48.             r.use(3)
  49.             os.sleep()
  50.         end
  51.     end
  52. end
  53.  
  54. while true do
  55.     Main()
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement