Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function CheckSlots(slotNum, minVal)
- if turtle.getItemCount(slotNum)<minVal then
- return false
- else
- return true
- end
- end
- function Input()
- write("Width?")
- breite=tonumber(read())
- write("Length?")
- laenge=tonumber(read())
- end
- function CheckFuel()
- if turtle.getFuelLevel() < 40 and turtle.getItemCount(1) < 1 then
- print "Please but some coal in slot 1"
- end
- end
- function Refuel()
- if turtle.getFuelLevel() < 80 then
- turtle.refuel()
- end
- end
- function DetectAndReplace()
- isThere, data=turtle.inspectDown()
- if isThere then
- if data.metadata==7 then
- if data.name=="minecraft:wheat" then
- turtle.select(2)
- turtle.digDown()
- if CheckSlots(2,1) then
- turtle.placeDown()
- else
- write("Please put wheatseeds in slot 2")
- while CheckSlots(2,1)==false do
- end
- end
- end
- end
- if data.metadata==7 then
- if data.name=="minecraft:carrots" then
- turtle.select(3)
- turtle.digDown()
- if CheckSlots(3,1) then
- turtle.placeDown()
- else
- write("Please put carrots in slot 3")
- while CheckSlots(3,1)==false do
- end
- end
- end
- end
- if data.metadata==7 then
- if data.name=="minecraft:potatoes" then
- turtle.select(4)
- turtle.digDown()
- if CheckSlots(4,1) then
- turtle.placeDown()
- else
- write("Please put potatoes in slot 2")
- while CheckSlots(4,1)==false do
- end
- end
- end
- end
- return true
- else
- return false
- end
- end
- function Forward()
- CheckFuel()
- Refuel()
- while turtle.forward()==false do
- turtle.forward()
- end
- end
- function Drop()
- for i=5,16,1 do
- turtle.select(i)
- turtle.dropDown()
- end
- end
- function main()
- Input()
- Forward()
- while true do
- for i=1,breite-1,1 do
- for j=1,laenge-1,1 do
- DetectAndReplace()
- Forward()
- end
- if i%2==1 and l~=breite then
- turtle.turnRight()
- Forward()
- turtle.turnRight()
- elseif l~=breite then
- turtle.turnLeft()
- Forward()
- turtle.turnLeft()
- end
- end
- if(breite%2==0) then
- turtle.turnRight()
- for i=1,breite,1 do
- Forward()
- end
- turtle.turnLeft()
- Forward()
- turtle.turnLeft()
- turtle.turnLeft()
- else
- turtle.turnLeft()
- for i=1,breite,1 do
- Forward()
- end
- turtle.turnLeft()
- for i=1,laenge+1,1 do
- Forward()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- end
- Drop()
- os.sleep(300)
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement