Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- left = function()
- return turtle.turnLeft()
- end
- right = function()
- return turtle.turnRight()
- end
- up = function()
- return turtle.up()
- end
- down = function()
- return turtle.down()
- end
- back = function()
- return turtle.back()
- end
- go = function()
- return turtle.forward()
- end
- fuel = function()
- return turtle.getFuelLevel()
- end
- selectId = function(id)
- return turtle.select(id)
- end
- countId = function(id)
- return turtle.getItemCount(id)
- end
- moveId = function(id, nb)
- return turtle.transferTo(id, nb)
- end
- -- --------------------------------------
- sNameWood = ""
- sNameSappling = ""
- -- --------------------------------------
- function testFuel()
- if(fuel() < 50)then
- local stickSlot = isThereSticks()
- if(stickSlot)then
- selectId(stickSlot)
- turtle.refuel(countId(stickSlot))
- testFuel()
- else
- selectId(1)
- turtle.refuel(1)
- end
- end
- end
- function isThereSticks()
- local continue = true
- local slot = 1
- while continue do
- if(countId(slot) > 0)then
- if(getName(slot) == "minecraft:stick") then
- return slot
- end
- end
- slot = slot + 1
- if(slot > 16)then
- continue = false
- end
- end
- return false
- end
- function init()
- if(countId(1)==0) then
- print('Besoin du block a couper en slot 1')
- return false
- end
- if(turtle.detectDown()==false)then
- print('Besoin d\'coffre en desous de ma possition')
- return false
- end
- if(countId(16)==0) then
- print('Besoin de slapping en slot 16 (Le dernier)')
- return false
- end
- sNameWood = getName(1)
- sNameSappling = getName(16)
- return true
- end
- function getName(s)
- local tab = turtle.getItemDetail(s)
- return tab.name
- end
- function coupeArbre()
- selectId(1)
- turtle.dig()
- go()
- while turtle.compareUp() do
- turtle.digUp()
- up()
- end
- while turtle.detectDown() == false do
- down()
- end
- back()
- selectId(16)
- turtle.place()
- testFuel()
- optiInv()
- end
- function optiInv()
- local continue = true
- local slot = 1
- while continue do
- if(slot == 1)then
- if (countId(slot)>10) then
- selectId(slot)
- turtle.dropDown(countId(slot) - 10)
- end
- elseif(slot == 16)then
- if (countId(slot)>10) then
- selectId(slot)
- turtle.dropDown(countId(slot) - 10)
- end
- else
- if (countId(slot)>0) then
- selectId(slot)
- if(getName(slot) == sNameSappling)then
- turtle.transferTo(16, countId(slot))
- else
- turtle.dropDown(countId(slot))
- end
- end
- end
- slot = slot + 1
- if(slot > 16)then
- continue = false
- end
- end
- end
- stop=false
- if(init()==false) then
- stop=true
- end
- while(stop==false)do
- selectId(1)
- if(turtle.compare()==true)then
- coupeArbre()
- else
- turtle.suck()
- turtle.suckUp()
- end
- sleep(5)
- end
- print('end')
Add Comment
Please, Sign In to add comment