Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Have wireless turtle display previous harvest amount on an external monitor?
- --Also have it display ALL amount harvested
- cropName = ""
- seedName = ""
- --[[if (#arg == 1) then
- if arg[1] == "crop" or arg[1] == "help" then
- --print hardcoded supported crops
- print("Supported crops:")
- print("Wheat")
- print("Potato")
- print("Carrot")
- else
- print("Please try again using the 'crop' or 'help' arguments")
- end
- cropName = tostring(arg[1])
- --Optimize at a later date
- if(cropName == "wheat") then
- cropName = "minecraft:wheat"
- elseif(cropName == "potato")then
- cropName = "minecraft:potato"
- seedName = "minecraft:potato"
- elseif (cropName == "carrot") then
- cropName = "minecraft:carrot"
- seedName = "minecraft:carrot"
- else
- cropName = "minecraft:wheat"
- seedName = "mineacraft:wheat_seeds"
- print("Sorry! That's not a supported crop!")
- end
- else
- print("Type 'crops' or 'help' to get started!")
- end]]
- function getSeedIndex(seedName)
- for slot = 1, 16, 1 do
- local item = turtle.getItemDetail(slot)
- if(item ~= nil) then
- if(item["name"] == seedName) then
- return slot
- end
- end
- end
- end
- function getCropIndex(cropName)
- for slot = 1, 16, 1 do
- local item = turtle.getItemDetail(slot)
- if(item ~= nil) then
- if(item["name"] == cropName) then
- return slot
- end
- end
- end
- end
- --ONLY CALL WHEN TURTLE IS AT FULL STOP AND WAITING TO GO
- function startSequence()
- turtle.select(1)
- turtle.suckUp(2)
- turtle.refuel()
- turtle.refuel()
- --drop only crops
- for i = 1, 16 do
- turtle.select(i)
- local item = turtle.getItemDetail(slot)
- if(item ~= nil) then
- if(item["name"] == cropName) then
- turtle.dropDown()
- end
- end
- end
- end
- --For the future: Have specific conditionals for "seedless" crops
- function plantHarvest()
- isBlock, data = turtle.inspect()
- if(isBlock)
- then
- if(data['state']['age'] == 7) then
- seedIndex = getSeedIndex("minecraft:wheat_seeds")
- turtle.select(seedIndex)
- turtle.dig()
- turtle.place()
- turtle.suck()
- end
- else
- seedIndex = getSeedIndex("minecraft:wheat_seeds")
- turtle.suck()
- turtle.select(seedIndex)
- turtle.place()
- end
- end
- leftCounter = 0
- function countLeftTurns()
- if turtle.forward() == false then
- turtle.turnLeft()
- leftCounter = leftCounter + 1
- end
- end
- a=1
- while(a~=0) do
- startSequence()
- turtle.turnLeft()
- plantHarvest()
- turtle.turnRight()
- countLeftTurns()
- print(leftCounter)
- if(leftCounter / 4 == 1) then
- leftCounter = 0
- sleep(600)
- for p = 1, 16, 1 do
- turtle.select(p)
- turtle.dropDown()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement