Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- chests = {
- "quark:oak_chest",
- "charm:oak_chest",
- }
- fuel = {
- "minecraft:coal_block",
- "actuallyadditions:block_misc",
- "quark:charcoal_block",
- }
- droppedItems = {
- "minecraft:stick",
- "minecraft:apple"
- }
- function dropTrash()
- for slotNum = 1, 16, 1 do
- local item = turtle.getItemDetail(slotNum)
- if(item ~= nil) then
- for FilterIndex = 1, #droppedItems, 1 do
- if(item.name == droppedItems[FilterIndex]) then
- print("Droppign - " .. item.name)
- turtle.select(slotNum)
- turtle.dropDown()
- end
- end
- end
- end
- end
- function getFuelIndex()
- for slotNum = 1, 16, 1 do
- local Item = turtle.getItemDetail(slotNum)
- if(Item ~=nil) then
- for fuelIndex =1, #fuel, 1 do
- if(Item.name == fuel[fuelIndex]) then
- return slotNum
- end
- end
- end
- end
- end
- function refuel()
- if(turtle.getFuelLevel() < 400) then
- local Index = getFuelIndex()
- if(Index ~= nil) then
- turtle.select(Index)
- turtle.refuel(2)
- end
- end
- end
- function checkGrowth()
- grown = turtle.detect()
- if grown ~= true then
- isGrown = false
- elseif grown == true then
- isGrown = true
- end
- end
- function getSaplingIndex()
- for slotNum = 1, 16,1 do
- local item = turtle.getItemDetail(slotNum)
- if(item ~= nil) then
- if (item.name == "byg:fir_sapling") then
- return slotNum
- end
- end
- end
- end
- function turtleRefill()
- isBlock, data = turtle.inspectDown()
- if (data.name == "upgrade_aquatic:driftwood_chest") then
- fuelSlot = getFuelIndex()
- if fuelSlot ~= nil then
- turtle.select(fuelSlot)
- local coalBlocks = turtle.getItemCount()
- if coalBlocks <= 30 then
- turtle.suckDown(20)
- end
- elseif fuelSlot == nil then
- turtle.suckDown(30)
- end
- refuel()
- end
- turtle.forward()
- isBlock, data = turtle.inspectDown()
- if (data.name == "charm:oak_chest") then
- sapSlot = getSaplingIndex()
- if sapSlot ~= nil then
- turtle.select(sapSlot)
- local saplings = turtle.getItemCount()
- if saplings <= 30 then
- turtle.suckDown(20)
- end
- elseif sapSlot == nil then
- turtle.suckDown(30)
- end
- elseif (data.name ~= "upgrade_aqatic:driftwood_chest") then
- print("error finding chest")
- end
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- end
- function plantTree()
- local index = getSaplingIndex()
- if (index ~= nil) then
- turtle.select(index)
- turtle.placeDown()
- elseif (index == nil) then
- print("Need saplings")
- end
- end
- function cutTree()
- turtle.dig()
- turtle.forward()
- local isBlock,isSap = turtle.inspectDown()
- if isSap.name ~= "byg:fir_sapling" then
- turtle.digDown()
- local treeLeft = turtle.detectUp()
- local hight = 0
- while treeLeft == true do
- turtle.digUp()
- turtle.up()
- hight = hight + 1
- treeLeft = turtle.detectUp()
- end
- for i = 1, hight, 1 do
- turtle.down()
- end
- plantTree()
- end
- end
- function depositWood()
- for slotNum = 1, 16 ,1 do
- local item = turtle.getItemDetail(slotNum)
- if(item ~= nil) then
- if(item.name == "byg:fir_log") then
- local itemCount = turtle.getItemCount(slotNum)
- turtle.select(slotNum)
- turtle.dropDown(itemCount)
- end
- end
- end
- end
- function goBackToStart()
- turtle.forward()
- turtle.turnRight()
- atStart = false
- while atStart == false do
- local isBlock, data= turtle.inspectDown()
- if (data.name == "byg:fir_fence" ) then
- turtle.forward()
- elseif (data.name == "snowrealmagic:fence") then
- turtle.forward()
- elseif (data.name == "byg:fir_fence_gate") then
- turtle.turnRight()
- turtle.forward()
- elseif (data.name == "upgrade_aquatic:driftwood_chest") then
- atStart = true
- elseif (isBlock ~= true) then
- turtle.forward()
- end
- end
- end
- function cutRow()
- checkGrowth()
- maxwait = 1
- while grown ~= true do
- sleep(30)
- checkGrowth()
- maxwait = maxwait + 1
- if maxwait >= 6 then
- grown = true
- end
- end
- cutTree()
- cutTree()
- cutTree()
- cutTree()
- end
- function nextRowRight()
- turtle.forward()
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- end
- function nextRowLeft()
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- turtle.turnLeft()
- end
- function cutTrees()
- cutRow()
- nextRowRight()
- cutRow()
- nextRowLeft()
- cutRow()
- turtle.forward()
- dropTrash()
- turtle.forward()
- turtle.forward()
- depositWood()
- turtle.turnRight()
- turtle.forward()
- goBackToStart()
- turtleRefill()
- end
- while true do
- cutTrees()
- end
Add Comment
Please, Sign In to add comment