Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function putSaplingInRightPlaceIfNeeded()
- turtle.select(1)
- local dataPlaceOne = turtle.getItemDetail()
- if dataPlaceOne then
- if dataPlaceOne.name ~= 'minecraft:sapling' then
- getEmptySlot()
- turtle.select(1)
- turtle.transferTo(emptySlot)
- for h=2,16 do
- turtle.select(h)
- local dataPlaceX = turtle.getItemDetail()
- if dataPlaceX then
- if dataPlaceX.name == 'minecraft:sapling' then
- turtle.transferTo(1)
- h = 15
- end
- end
- end
- end
- end
- end
- function getEmptySlot()
- emptySlot = 0
- for g=2,16 do
- turtle.select(g)
- local dataPresent = turtle.getItemDetail()
- if dataPresent then
- else
- emptySlot = g
- g = 15
- end
- end
- end
- function xGetCoalIfNeeded()
- if turtle.getFuelLevel() <= 1000 then
- turtle.select(16)
- turtle.suckDown(20)
- turtle.select(16)
- turtle.refuel()
- end
- turtle.select(1)
- end
- function xDigIfNeeded()
- local success, data = turtle.inspect()
- if success then
- if data.name == 'minecraft:log' then
- turtle.dig()
- turtle.suck()
- putSaplingInRightPlaceIfNeeded()
- turtle.select(1)
- turtle.place()
- end
- else
- putSaplingInRightPlaceIfNeeded()
- turtle.select(1)
- turtle.place()
- end
- end
- function xSuck()
- local success, data = turtle.inspect()
- if success then
- if data.name ~= 'minecraft:chest' then
- turtle.suck()
- end
- else
- turtle.suck()
- end
- end
- function xCheckAround()
- putSaplingInRightPlaceIfNeeded()
- xDigIfNeeded()
- xSuck()
- turtle.turnLeft()
- xDigIfNeeded()
- xSuck()
- turtle.turnRight()
- turtle.turnRight()
- xDigIfNeeded()
- xSuck()
- turtle.turnLeft()
- xSuck()
- end
- function checkIfNeedToSleep()
- local dataSleep = turtle.getItemDetail(3)
- if dataSleep then
- os.sleep(180)
- xDropToChest()
- checkIfNeedToSleep()
- end
- end
- function xDropToChest()
- turtle.turnRight()
- turtle.turnRight()
- for n=2,16 do
- turtle.select(n)
- local dataToDropDown = turtle.getItemDetail()
- if dataToDropDown then
- if dataToDropDown.name == 'minecraft:log' then
- turtle.drop()
- end
- end
- end
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.select(1)
- checkIfNeedToSleep()
- end
- function xGetSaplingIfNeeded()
- if turtle.getItemCount(1) < 63 then
- turtle.select(1)
- turtle.turnRight()
- turtle.suck()
- turtle.turnLeft()
- end
- end
- function xDropSaplingIfNeeded()
- for q=2,16 do
- turtle.select(q)
- toThrowSapling = turtle.getItemDetail()
- if toThrowSapling then
- if toThrowSapling.name == 'minecraft:sapling' then
- turtle.dropUp()
- end
- end
- end
- turtle.select(1)
- end
- function replaceIfBuggedAndForward()
- local successw, dataw = turtle.inspect()
- if successw then
- if dataw.name == 'minecraft:sapling' then
- turtle.turnRight()
- turtle.forward()
- elseif dataw.name == 'minecraft:chest' then
- turtle.turnRight()
- replaceIfBuggedAndForward()
- elseif dataw.name == 'chisel:marble2' then
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- else
- turtle.forward()
- end
- else
- turtle.forward()
- end
- end
- function xForward()
- local successs, dataa = turtle.inspectDown()
- if successs then
- if dataa.name == 'minecraft:netherrack' then
- turtle.turnRight()
- turtle.turnRight()
- end
- if dataa.name == 'extrautils2:minichest' then
- if debut == 0 then
- turtle.turnRight()
- turtle.turnRight()
- end
- xThrow()
- xDropSaplingIfNeeded()
- xDropToChest()
- xGetSaplingIfNeeded()
- xGetCoalIfNeeded()
- end
- replaceIfBuggedAndForward()
- xSuck()
- else
- replaceIfBuggedAndForward()
- xSuck()
- end
- debut = 0
- end
- function xThrow()
- for s=2,16 do
- turtle.select(s)
- toThrow = turtle.getItemDetail()
- if toThrow then
- if (toThrow.name ~= 'minecraft:log' and toThrow.name ~= 'minecraft:sapling') then
- turtle.dropUp()
- end
- if toThrow.name == 'minecraft:sapling' then
- turtle.turnRight()
- turtle.drop()
- turtle.turnLeft()
- end
- end
- end
- turtle.select(1)
- end
- xGetCoalIfNeeded()
- xGetSaplingIfNeeded()
- debut = 1
- while true do
- xCheckAround()
- xForward()
- end
Advertisement
Add Comment
Please, Sign In to add comment