Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function suck()
- local s, i = turtle.inspect()
- if s then
- if i.name == "minecraft:chest" or i.name == "ironchest:BlockIronChest" then
- for i = 1, 9 do turtle.suck() end
- return
- end
- end
- print("No chest infront of turtle")
- end
- function check64()
- local wheatNum = 0
- for i = 1, 16 do
- turtle.select(i)
- wheatNum = wheatNum + turtle.getItemCount()
- end
- print(wheatNum)
- if wheatNum == 576 then
- print(wheatNum .. " >= 576")
- return true
- else print(wheatNum .. " < 576") return false end
- end
- function craftFail()
- print("Craft failed")
- for i = 1, 16 do
- turtle.select(i)
- if turtle.getItemDetail() then print("Item exists") if turtle.getItemDetail().name == "minecraft:wheat" then print("Item is wheat")
- turtle.drop() end
- end
- end
- end
- function sort()
- turtle.select(4)
- turtle.transferTo(10, 64)
- turtle.select(8)
- turtle.transferTo(11, 64)
- end
- function craftSucc()
- for i = 1, 2 do turtle.turnRight() end
- turtle.drop()
- for i = 1, 2 do turtle.turnRight() end
- end
- function craftHay()
- sort()
- if check64 then
- sort()
- print("Enough wheat for hay bales")
- turtle.craft(64)
- craftSucc()
- else
- print("Not enough wheat")
- craftFail()
- end
- end
- while true do
- craftHay()
- sleep(300)
- end
Advertisement
Add Comment
Please, Sign In to add comment