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 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 Coal_names = {}
- Coal_names[1] = "minecraft:coal"
- Coal_names[2] = "minecraft:planks"
- Coal_names[3] = "minecraft:log"
- Coal_names[4] = "minecraft:blaze_rod"
- Coal_names[5] = "minecraft:lava_bucket"
- local empty_bucket = {}
- empty_bucket[1] = "minecraft:bucket"
- empty_bucket[2] = "minecraft:lava_bucket"
- local function getCoal(stack_info)
- if stack_info == nil then
- return false
- end
- for index, known_coal_name in ipairs(Coal_names) do
- if stack_info.name == known_coal_name then
- return true
- end
- end
- return false
- end
- if computer.energy() <=200 then
- robot.select(5) ; robot.drop() ; robot.select(16) ; robot.drop()
- robot.select(14) ; robot.place() ; robot.select(15)
- for slot=1,27 do
- local stack_info = inventory.getStackInSlot(side, slot)
- --- inspect the stack_info when it is not nil
- if getCoal(stack_info) 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
- local function isFuelRemaining(stack_info)
- if stack_info == nil then
- return false
- end
- for index, known_rail_name in ipairs(Coal_names) do
- if stack_info.name == known_coal_name then
- return true
- end
- end
- return false
- end
- local stack_info = inventory.getStackInInternalSlot(5)
- --- inspect the stack_info when it is not nil
- if isFuelRemaining(stack_info) then
- g.insert()
- end
- local function isBucket(stack_info)
- if stack_info == nil then
- return false
- end
- for index, bucket_name in ipairs(empty_bucket) do
- if stack_info.name == bucket_name then
- return true
- end
- end
- return false
- end
- robot.select(5) ; robot.drop() ; g.remove()
- local stack_info = inventory.getStackInInternalSlot(5)
- if isBucket(stack_info) then
- left() ; robot.select(8) ; robot.place() ; robot.select(5) ; inventory.dropIntoSlot(side, 1) ; robot.select(8) ; robot.swing() ; right()
- end
- isFuelRemaining(stack_info)
- getCoal(stack_info)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement