Advertisement
Guest User

melonfarm.lua

a guest
Jul 23rd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.57 KB | None | 0 0
  1. local scanner = device["plethora:scanner"]
  2. local Event = require("opus.event")
  3.  
  4. local function checkForMelon()
  5.   local scanResults = scanner.scan()
  6.   for _,block in next, scanResults do
  7.     if block.name == "minecraft:melon_block" then
  8.       return true,{
  9.         x = block.x,
  10.         y = block.y,
  11.         z = block.z
  12.       }
  13.     end
  14.   end
  15. end
  16. local function digFirstMelonFound()
  17.   local found, coords = checkForMelon()
  18.   if found then
  19.     turtle.digDownAt(coords)
  20.   else
  21.     print("idle")
  22.   end
  23. end
  24.  
  25. Event.onInterval(5,digFirstMelonFound)
  26. Event.pullEvents()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement