Advertisement
jBlume

Automate Botania Pure Daisy block placement

Jul 16th, 2023 (edited)
1,231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.12 KB | None | 0 0
  1. --place turtle at bottom left side of the expected layout
  2. --place logs or stone in slot 1
  3. --place result in slot 16
  4. -- Main program will automatically places blocks in a 3x3 square and leave out the middle then returns to start position and will mine up the new block once transformed
  5.  
  6. function placeBlocks()
  7.  for p=1,2 do
  8.   turtle.forward()
  9.   turtle.placeDown()
  10.  end
  11. end
  12.  
  13. function destroyBlocks()
  14.  for p=1,2 do
  15.   turtle.forward()
  16.   turtle.digDown()
  17.  end
  18. end
  19.  
  20. function square(x)
  21.  turtle.select(x)
  22.  turtle.up()
  23.  turtle.forward()
  24.  for s=1,4 do
  25.   if x==1 then
  26.    placeBlocks()
  27.    else
  28.     destroyBlocks()  
  29.    end
  30.    turtle.turnRight()
  31.   end
  32.  turtle.back()
  33.  turtle.down()
  34. end
  35.  
  36. --Main Program
  37. while true do
  38.  if turtle.getFuelLevel() <12 then
  39.   print "I need fuel. Refuel then restart program."
  40.   turtle.reboot()
  41.   elseif turtle.getItemCount(1)<7 then
  42.    print "I need more placement material in Slot 1."
  43.    else
  44.     if turtle.detect()==false and turtle.getItemCount(1)>7 then
  45.     square(1)
  46.     else
  47.      turtle.select(16)
  48.      if turtle.compare() then
  49.      square(16)
  50.     end
  51.    end
  52.   end
  53.  end
  54.  
  55.  
  56.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement