Advertisement
osmarks

Autocompactron

Jul 14th, 2019
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.79 KB | None | 0 0
  1. local function select_item(item, mincount)
  2.     local mincount = mincount or 1
  3.     for i = 1, 16 do
  4.         local it = turtle.getItemDetail(i)
  5.         if it and it.count and it.name and it.count >= mincount and it.name == item then
  6.             turtle.select(i)
  7.             return true
  8.         end
  9.     end
  10.     return false
  11. end
  12.  
  13. local function run_cycle()
  14.     turtle.up()
  15.     select_item "minecraft:iron_block"
  16.     turtle.place()
  17.     turtle.up()
  18.     select_item("minecraft:redstone", 2)
  19.     turtle.place()
  20.     turtle.down()
  21.     turtle.down()
  22.     turtle.dropUp(1)
  23.     sleep(5)
  24. end
  25.  
  26. while true do
  27.     if turtle.getFuelLevel() > 4 then
  28.         if select_item "minecraft:iron_block" and select_item("minecraft:redstone", 2) then
  29.             print "Running."
  30.             run_cycle()
  31.         else
  32.             print "Insufficient items."
  33.         end
  34.     else
  35.         print "Insufficient fuel."
  36.     end
  37.     sleep(2)
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement