Advertisement
Guest User

Untitled

a guest
May 9th, 2020
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.87 KB | None | 0 0
  1. local inventory = require("component").inventory_controller
  2. local side = require("sides").front
  3.  
  4. local fuel_names = { ["minecraft:coal"] = true, ["minecraft:planks"] = true, ["minecraft:log"] = true, ["minecraft:blaze_rod"] = true, ["minecraft:lava_bucket"] = true}
  5.  
  6. local function getCoal(stack_info)
  7.     if computer.energy() <=200 then
  8.         robot.select(5) ; robot.drop() ; robot.select(16) ; robot.drop()
  9.         robot.select(14) ; robot.place() ; robot.select(15)
  10.         return fuel_names[stack_info]
  11.     end
  12.    
  13.     for slot=1,27 do
  14.         local item = inventory.getStackInSlot(side, slot)
  15.         if item and fuel_names[item.name] then
  16.             print(stack_info.name, "found in slot", slot)
  17.             inventory.suckFromSlot(sides.front, slot)
  18.             break
  19.         end
  20.     end
  21.     robot.select(16) ; inventory.dropIntoSlot(side, 1) ; robot.select(5) ; robot.swing() ; robot.transferTo(14)
  22. end
  23.  
  24. getCoal("minecraft:planks")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement