Advertisement
Guest User

farm.lua

a guest
Mar 23rd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.93 KB | None | 0 0
  1. local config = {
  2.     harvest = {
  3.         name = "minecraft:cactus",
  4.        instructions = {
  5.             turltle.digDown,turtle.down,turtle.digDown,turtle.up,turtle.up,turtle.forward
  6.             }    
  7.         }
  8.        
  9.     rightTurn = {
  10.         name = "minecraft:stonebrick",
  11.         instructions = {
  12.             turtle.
  13.         }
  14.     }
  15. }
  16.  
  17. local function exec(tbl)
  18.     for _,v in pairs(tbl.instructions) do
  19.         v()
  20.     end
  21. end
  22.  
  23. while true do
  24. local bool, block = turtle.inspectDown()
  25.  
  26.     if bool == true then
  27.         if block == config.harvest.name then
  28.             exec(config.harvest)
  29.         elseif block == config.left.name then
  30.             exec(config.left)
  31.         elseif block == config.right.name then
  32.             exec(config.right)
  33.         elseif block == config.chest then
  34.             exec(config.chest)
  35.         elseif bool == false then
  36.             turtle.forward()
  37.         end
  38.     end
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement