Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Makes a cake taking parts from
- -- multible chests
- local supply = true
- function grab(a)
- turtle.select(a)
- turtle.suck(1)
- end
- function move()
- turtle.turnLeft()
- for i=1, 3 do
- turtle.forward()
- end
- turtle.turnRight()
- end
- function check(a,b,c)
- local data = turtle.getItemDetail(a)
- if data.name == (b) then
- local supply = false
- else
- print("Waiting on more " .. (c))
- end
- end
- while true do
- -- grab sugar
- print("Getting sugar...")
- while supply do
- grab(5)
- grab(7)
- check(7,"minecraft:sugar","sugar")
- end
- move()
- -- grab milk
- print("Getting milk...")
- if turtle.suck() then
- for i=1, 3 do
- grab(i)
- end
- else
- error("More milk needed")
- end
- move()
- -- grab egg
- print("Getting egg...")
- if turtle.suck() then
- grab(6)
- else
- error("More eggs needed")
- end
- move()
- -- grab wheat
- print("Getting wheat...")
- for i=9, 11 do
- grab(i)
- end
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.forward()
- --make cake and put in chest
- print("Making cake...")
- turtle.craft()
- turtle.drop()
- -- remove empty buckets
- for i=1, 3 do
- turtle.select(i)
- if turtle.getItemCount(i) > 0 then
- turtle.drop()
- end
- end
- -- retuen to start
- print("Starting over...")
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- for i=1, 9 do
- turtle.forward()
- end
- turtle.turnLeft()
- for i=1, 3 do
- turtle.select(i)
- turtle.drop()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement