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,15 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,15 do
- turtle.select(g)
- local dataPresent = turtle.getItemDetail()
- if dataPresent then
- else
- emptySlot = g
- g = 15
- end
- end
- end
- function xFuel()
- turtle.select(16)
- turtle.refuel()
- turtle.select(1)
- end
- function xGetCoalIfNeeded()
- if turtle.getFuelLevel() <= 1000 then
- turtle.select(16)
- turtle.turnLeft()
- turtle.suck(13)
- turtle.turnRight()
- xFuel()
- 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()
- turtle.select(1)
- turtle.place()
- end
- else
- 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()
- end
- function xDropToChest()
- for n=2,15 do
- turtle.select(n)
- local dataToDropDown = turtle.getItemDetail()
- if dataToDropDown then
- if dataToDropDown.name == 'minecraft:log' then
- turtle.dropDown()
- end
- end
- end
- turtle.select(1)
- end
- function xGetSaplingIfNeeded()
- if turtle.getItemCount(1) < 63 then
- turtle.select(1)
- turtle.turnRight()
- turtle.suck()
- turtle.turnLeft()
- end
- end
- function xForward()
- local successs, dataa = turtle.inspectDown()
- if successs then
- if dataa.name == 'minecraft:netherrack' then
- turtle.turnRight()
- end
- if dataa.name == 'minecraft:log' then
- turtle.turnLeft()
- end
- if dataa.name == 'minecraft:chest' then
- xThrow()
- xGetSaplingIfNeeded()
- xGetCoalIfNeeded()
- xDropToChest()
- if debut == 0 then
- os.sleep(180)
- end
- end
- turtle.forward()
- xSuck()
- else
- turtle.forward()
- xSuck()
- end
- debut = 0
- end
- function xThrow()
- for s=2,15 do
- turtle.select(s)
- toThrow = turtle.getItemDetail()
- if toThrow then
- if toThrow.name == 'minecraft:apple' then
- turtle.dropUp()
- end
- if toThrow.name == 'minecraft:torch' 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
Add Comment
Please, Sign In to add comment