Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --made by Lenscas
- local dig=peripheral.wrap("left")
- local chestName="EnderStorage:enderChest"
- function editColors(become)
- local colors={send={colors.orange,colors.orange,colors.orange},fuel={colors.gray,colors.gray,colors.gray}}
- peripheral.call("top","setColours",colors[become][1],colors[become][2],colors[become][3])
- end
- function refuel()
- print(turtle.getFuelLevel())
- editColors("fuel")
- if turtle.getFuelLevel()<200 then
- turtle.select(15)
- turtle.suckUp()
- turtle.refuel()
- if turtle.getItemCount() >0 then
- turtle.dropUp()
- end
- end
- print(turtle.getFuelLevel())
- turtle.select(16)
- end
- function sendItems()
- peripheral.call("top","condenseItems")
- local items = peripheral.call("top","getAllStacks",false)
- editColors("send")
- while #items> 0 do
- sleep(#items)
- peripheral.call("top","condenseItems")
- items = peripheral.call("top","getAllStacks",false)
- end
- for slot=1,16 do
- turtle.select(slot)
- turtle.dropUp()
- end
- end
- function startup()
- local sucess, itemData=nil
- turtle.select(16)
- if turtle.getItemCount()>0 then
- itemData=turtle.getItemDetail()
- if itemData['name']==chestName then
- dig.digUp()
- turtle.placeUp()
- end
- end
- sucess ,itemData=turtle.inspectUp()
- if sucess then
- if itemData['name']==chestName then
- sendItems()
- refuel()
- turtle.select(16)
- dig.digUp()
- turtle.select(1)
- else
- return false
- end
- else
- return false
- end
- return true
- end
- function mine()
- while turtle.detectUp() do
- turtle.select(1)
- dig.digUp()
- sleep(0.5)
- end
- while turtle.detect() do
- turtle.select(1)
- dig.dig()
- sleep(0.5)
- end
- turtle.select(1)
- dig.digDown()
- end
- function forward()
- local sucess=false
- local counter=0
- while not turtle.forward() do
- mine()
- turtle.attack()
- counter=counter+1
- if counter>2 then
- turtle.select(16)
- turtle.placeUp()
- refuel()
- dig.digUp()
- elseif counter>4 then
- stop()
- end
- end
- end
- function stop()
- local success=false
- while not success do
- turtle.sleep(200)
- success = startup()
- end
- end
- if not startup() then
- stop()
- end
- while true do
- for times=1,15 do
- mine()
- forward()
- end
- mine()
- turtle.select(16)
- turtle.placeUp()
- sendItems()
- refuel()
- dig.digUp()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement