Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local farmItem, farmBlock, maxMeta = ...
- maxMeta = tonumber(maxMeta) or 7
- if farmItem == "help" then
- print("Usage: <filename> <seedName> <blockName> [maxGrowth(default:7)]")
- end
- farmItem = type(farmItem) == "string" and farmItem
- or error("Bad argument #1: Expected a string")
- farmBlock = type(farmBlock) == "string" and farmBlock
- or error("Bad argument #2: Expected a string")
- local function find()
- for i = 1, 16 do
- if turtle.getItemCount(i) > 0
- and (turtle.getItemDetail(i)).name == farmItem then
- turtle.select(i)
- return
- end
- end
- error("Cannot place anything")
- end
- local oldplc = turtle.place
- function turtle.place()
- find()
- return oldplc()
- end
- local olddig = turtle.dig
- function turtle.dig()
- local isBlock, block = turtle.inspect()
- if isBlock then
- if block.name == farmBlock and block.metadata >= maxMeta then
- return olddig()
- end
- return false
- end
- return true
- end
- while true do
- print("START LOOP")
- for i = 1, 4 do
- print("CHECKING " .. tostring(i))
- if turtle.dig() then
- print("IT IS SO, WE PLACE.")
- turtle.place()
- end
- print("RIGHT WE GO")
- turtle.turnRight()
- end
- print("WE HAVE DONE THIS LOOP, LET US WAIT SOME TIME.")
- os.sleep(10)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement