Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Starting!")
- branchLength = 5
- spacing = 3
- trash = { "minecraft:dirt", "minecraft:sand", "minecraft:cobblestone", "minecraft:stone", "minecraft:gravel",
- "chisel:basalt2", "chisel:marble2", "chisel:limestone2", "biomesoplenty:gem", "minecraft:yellow_flower",
- "biomesoplenty:mushroom", "minecraft:flint", "minecraft:mossy_cobblestone", "thaumcraft:nugget", "xlfoodmod:salt",
- "botania:mushroom", "thaumcraft:crystal_essence", "biomesoplenty:flower_1", "thermalfoundation:material", "extrautils2:ingredients" }
- donotStore = { "minecraft:torch" }
- function table.contains(table, element)
- for _, value in pairs(table) do
- if value == element then
- return true
- end
- end
- return false
- end
- function slotsLeft()
- slotsempty = 0
- for i = 1, 16, 1 do
- local data = turtle.getItemDetail(i)
- if not data then
- slotsempty = slotsempty + 1
- end
- end
- return slotsempty
- end
- function findItem(item)
- for i = 1, 16, 1 do
- local data = turtle.getItemDetail(i)
- if data then
- if data.name == item then
- return i
- end
- end
- end
- return nil
- end
- torchInterval = 5
- currentTorch = 0
- function tryTorch()
- if currentTorch == torchInterval then
- print("TORCH-PLACE")
- torch = findItem("minecraft:torch")
- if torch ~= nil then
- turtle.select(torch)
- turtle.digDown()
- turtle.placeDown()
- end
- end
- print("TORCHINT:", currentTorch)
- currentTorch = (currentTorch + 1) % torchInterval + 1
- end
- while true do
- print("TORCHINT:", currentTorch)
- print("FUEL LEVEL--------", turtle.getFuelLevel())
- for i = 1, 16, 1 do
- local data = turtle.getItemDetail(i)
- if data then
- turtle.select(i)
- turtle.refuel()
- if table.contains(trash, data.name) then
- print("dropping:", data.name)
- turtle.select(i)
- turtle.drop()
- end
- end
- end
- chestIndex = findItem("enderstorage:ender_storage")
- if chestIndex ~= nil then
- turtle.select(chestIndex)
- while not turtle.placeUp() do
- turtle.digUp()
- end
- for i = 1, 16, 1 do
- local data = turtle.getItemDetail(i)
- if data then
- if not table.contains(donotStore, data.name) then
- turtle.select(i)
- turtle.dropUp()
- end
- end
- end
- turtle.digUp()
- end
- while slotsLeft() < 2 do
- print(slotsLeft())
- print("TURTLE NEEDS EMPTYING!!!")
- sleep(1)
- end
- for i = 1, spacing + 1, 1 do
- while not turtle.forward() do
- turtle.dig()
- end
- while turtle.detectUp() do
- turtle.digUp()
- end
- while turtle.detectDown() do
- turtle.digDown()
- end
- tryTorch()
- end
- turtle.turnLeft()
- for i = 1, branchLength, 1 do
- print(tostring(i), "/", tostring(branchLength + 1), "Left")
- while not turtle.forward() do
- turtle.dig()
- end
- while turtle.detectUp() do
- turtle.digUp()
- end
- while turtle.detectDown() do
- turtle.digDown()
- end
- end
- turtle.turnLeft()
- turtle.turnLeft()
- for i = 1, branchLength, 1 do
- print(tostring(i), "/", tostring(branchLength * 2 + 1), "Left")
- while not turtle.forward() do
- turtle.dig()
- end
- while turtle.detectUp() do
- turtle.digUp()
- end
- while turtle.detectDown() do
- turtle.digDown()
- end
- tryTorch()
- end
- for i = 1, branchLength, 1 do
- print(tostring(i), "/", tostring(branchLength * 2 + 1), "Left")
- while not turtle.forward() do
- turtle.dig()
- end
- while turtle.detectUp() do
- turtle.digUp()
- end
- while turtle.detectDown() do
- turtle.digDown()
- end
- end
- turtle.turnLeft()
- turtle.turnLeft()
- for i = 1, branchLength, 1 do
- print(tostring(i), "/", tostring(branchLength + 1), "Left")
- while not turtle.forward() do
- turtle.dig()
- end
- while turtle.detectUp() do
- turtle.digUp()
- end
- while turtle.detectDown() do
- turtle.digDown()
- end
- tryTorch()
- end
- turtle.turnRight()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement