Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- farmtrees004
- os.loadAPI('hare')
- os.loadAPI('farmmoves')
- local blockExists, item
- local logCount = 0
- -- check if treechopper exists
- if not fs.exists('treechopper') then
- error('Install treechopper.')
- end
- while true do
- -- check inventory for saplings
- if not hare.selectItem('minecraft:sapling') then
- error('Out of saplings.')
- end
- -- plant plot 1
- print('Planting...')
- turtle.place() -- plant sapling
- farmmoves.moveOn()
- if not hare.selectItem('minecraft:sapling') then
- error('Out of saplings.')
- end
- -- plant plot 2
- print('Planting...')
- turtle.place() -- plant sapling
- farmmoves.moveOn()
- if not hare.selectItem('minecraft:sapling') then
- error('Out of saplings.')
- end
- -- plant plot 3
- print('Planting...')
- turtle.place() -- plant sapling
- farmmoves.returnHome()
- -- loop until a tree has grown
- while true do
- blockExists, item = turtle.inspect()
- if blockExists and item['name'] == 'minecraft:sapling' then
- -- move to plot 2
- farmmoves.moveOn()
- if blockExists and item['name'] == 'minecraft:sapling' then
- -- move to plot 3
- farmmoves.moveOn()
- if blockExists and item['name'] == 'minecraft:sapling' then
- -- return home
- farmmoves.returnHome()
- else
- -- plot 3 has a tree
- hare.selectEmptySlot()
- shell.run('treechopper') -- run treechopper
- -- move to and face chest
- turtle.back()
- turtle.turnLeft()
- turtle.turnLeft()
- -- put logs into chest
- while hare.selectItem('minecraft:log') do
- logCount = turtle.getItemCount()
- print('Total logs: ' .. logCount)
- turtle.drop()
- end
- -- face planting spot
- turtle.turnLeft()
- turtle.turnLeft()
- break
- end
- else
- -- plot 2 has a tree
- hare.selectEmptySlot()
- shell.run('treechopper') -- run treechopper
- -- move to and face chest
- turtle.back()
- turtle.turnLeft()
- turtle.turnLeft()
- -- put logs into chest
- while hare.selectItem('minecraft:log') do
- logCount = turtle.getItemCount()
- print('Total logs: ' .. logCount)
- turtle.drop()
- end
- -- face planting spot
- turtle.turnLeft()
- turtle.turnLeft()
- break
- end
- else
- -- plot 1 has a tree
- hare.selectEmptySlot()
- shell.run('treechopper') -- run treechopper
- -- move to and face chest
- turtle.back()
- turtle.turnLeft()
- turtle.turnLeft()
- -- put logs into chest
- while hare.selectItem('minecraft:log') do
- logCount = turtle.getItemCount()
- print('Total logs: ' .. logCount)
- turtle.drop()
- end
- -- face planting spot
- turtle.turnLeft()
- turtle.turnLeft()
- break
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement