Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local instructions = [[
- WOOD PHASE
- fill inv with logs
- go up, up, left
- dump portion of wood into right hopper
- go left, fwd, right
- dump portion of wood into left hopper
- go down, down, right, fwd
- dump remaining wood into output
- COAL PHASE
- go left
- fill inv with coal
- check own fuel level
- go left up
- refill right furnace
- go left, fwd, right
- refill left furnace
- go left, fwd, left
- put portion of fuel into collector chest
- go left, fwd, fwd, right
- put portion of fuel into harvester chest
- go left, down
- dump remaining coal into ouptut
- ]]
- local right_hopper_portion = 28
- local left_hopper_portion = 28
- local collector_portion = 16
- local harvester_portion = 16
- local check_fuel
- check_fuel = function()
- print("Checking fuel level...")
- if turtle.getFuelLevel() < 100 then
- print("Fuel low, refueling...")
- turtle.refuel(10)
- end
- return print("Fuel level: ", turtle.getFuelLevel())
- end
- local tally_items
- tally_items = function()
- local slot_count = turtle.getItemCount()
- if slot_count == nil then
- slot_count = 0
- end
- for i = 1, 16 do
- turtle.select(i)
- local tally = tally + slot_count
- end
- return tally
- end
- local fill_inv
- fill_inv = function(direction)
- for i = 1, 16 do
- turtle.select(i)
- if direction == "up" then
- turtle.suckUp()
- elseif direction == "forward" then
- turtle.suck()
- elseif direction == "down" then
- turtle.suckDown()
- end
- end
- end
- local portion_dump
- portion_dump = function(amount)
- local amount_to_dump = amount
- for i = 1, 16 do
- turtle.select(i)
- if amount_to_dump < 1 then
- break
- end
- local slot_count = turtle.getItemCount()
- if slot_count == nil then
- slot_count = 0
- end
- if slot_count > 0 then
- for i = 1, slot_count do
- turtle.drop(1)
- amount_to_dump = amount_to_dump - 1
- if amount_to_dump < 1 then
- break
- end
- end
- end
- end
- end
- local fill_furnace
- fill_furnace = function()
- for i = 1, 16 do
- turtle.select(i)
- if turtle.getItemDetail == "minecraft:coal" then
- turtle.drop()
- end
- end
- end
- local wood_phase
- wood_phase = function()
- fill_inv("down")
- local tally = tally_items()
- turtle.up()
- turtle.up()
- turtle.turnLeft()
- portion_dump((tally() * (28 / 64)))
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- portion_dump((tally() * (28 / 64)))
- turtle.down()
- turtle.down()
- turtle.turnRight()
- turtle.forward()
- return portion_dump((tally() * (64 / 64)))
- end
- local coal_phase
- coal_phase = function()
- turtle.turnLeft()
- fill_inv("forward")
- check_fuel()
- turtle.turnLeft()
- turtle.up()
- fill_furnace()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- fill_furnace()
- local tally = tally_items()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- portion_dump((tally() * (16 / 64)))
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- portion_dump((tally() * (16 / 64)))
- turtle.turnLeft()
- turtle.down()
- return portion_dump((tally() * (64 / 64)))
- end
- while true do
- wood_phase()
- coal_phase()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement