Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local robot = require("robot")
- local computer = require("computer")
- local sides = require("sides")
- local component = require("component")
- local ser = require("serialization")
- local inventory = component.inventory_controller
- local g = component.generator
- local stack_info = 0
- local left = robot.turnLeft
- local right = robot.turnRight
- local TURN = robot.turnAround
- local d = robot.detect
- local dUp = robot.detectUp
- local dDown = robot.detectDown
- local side = sides.front
- local fuel_names = { ["minecraft:coal"] = true, ["minecraft:planks"] = true, ["minecraft:log"] = true, ["minecraft:blaze_rod"] = true, ["minecraft:lava_bucket"] = true}
- local empty_bucket = { ["minecraft:bucket"] = true, ["minecraft:lava_bucket"] = true}
- local function getCoal(stack_info)
- if computer.energy() <=200 then
- robot.select(5) ; robot.drop() ; robot.select(16) ; robot.drop()
- robot.select(14) ; robot.place() ; robot.select(15)
- if stack_info == nil then
- return false
- end
- for index, known_fuel_name in ipairs(Coal_names) do
- if stack_info.name == known_fuel_name then
- return true
- end
- end
- return false
- end
- for slot=1,27 do
- local stack_info = inventory.getStackInSlot(side, slot)
- if fuel_names[stack_info.name] then
- print(stack_info.name, "found in slot", slot)
- inventory.suckFromSlot(sides.front, slot)
- break
- end
- end
- robot.select(16) ; inventory.dropIntoSlot(side, 1) ; robot.select(5) ; robot.swing() ; robot.transferTo(14)
- end
- getCoal(stack_info)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement