Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Left = "Blue Shimmering Mushroom" Storage
- -- Right = "Cyan Shimmering Mushroom" Storage
- -- Back = "Wheat Seeds" Storage
- blueShroom = "botania:blue_mushroom"
- cyanShroom = "botania:cyan_mushroom"
- seeds = "minecraft:wheat_seeds"
- function pickLeft()
- turtle.turnLeft()
- turtle.suck(2)
- while(not hasItem(blueShroom, 2)) do
- os.sleep(120)
- if(hasItem(blueShroom, 1)) then
- turtle.suck(1)
- else
- turtle.suck(2)
- end
- end
- turtle.turnRight()
- end
- function pickRight()
- turtle.turnRight()
- turtle.suck(2)
- while(not hasItem(cyanShroom, 2)) do
- os.sleep(120)
- if(hasItem(cyanShroom, 1)) then
- turtle.suck(1)
- else
- turtle.suck(2)
- end
- end
- turtle.turnLeft()
- end
- function pickBack()
- turtle.turnRight()
- turtle.turnRight()
- turtle.suck(1)
- while(not hasItem(seeds, 1)) do
- os.sleep(120)
- turtle.suck(1)
- end
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function hasItem(itemID, itemCount)
- for i = 1, 16 do
- turtle.select(i)
- if turtle.getItemCount(turtle.getSelectedSlot()) ~= 0 then
- detailTable = turtle.getItemDetail(turtle.getSelectedSlot())
- currentID = detailTable.name
- currentCount = detailTable.count
- if currentID == itemID and currentCount == itemCount then
- print("found item : ", currentID)
- return true
- end
- end
- end
- return false
- end
- function selectSpecItem(itemName)
- for i = 1, 16 do
- turtle.select(i)
- if turtle.getItemCount(turtle.getSelectedSlot()) ~= 0 then
- detailTable = turtle.getItemDetail(turtle.getSelectedSlot())
- currentName = detailTable.name
- if currentName == itemName then
- return true
- end
- end
- end
- end
- --INIT
- while(turtle.detect()) do
- turtle.turnRight()
- end
- --Drop remaining cyan shrooms
- turtle.turnRight()
- selectSpecItem(cyanShroom)
- turtle.drop()
- --Drop remaining seeds
- turtle.turnRight()
- selectSpecItem(seeds)
- turtle.drop()
- --Drop remaining blue shrooms
- turtle.turnRight()
- selectSpecItem(blueShroom)
- turtle.drop()
- while(turtle.detect()) do
- turtle.turnRight()
- end
- --MAIN LOOP
- while(true) do
- pickLeft()
- pickRight()
- pickBack()
- selectSpecItem(blueShroom)
- turtle.drop(2)
- selectSpecItem(cyanShroom)
- turtle.drop(2)
- selectSpecItem(seeds)
- turtle.drop(1)
- os.sleep(5)
- end
Add Comment
Please, Sign In to add comment