Barnet

Minecraft Turtle: AutoRefuel

Apr 24th, 2016 (edited)
77
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -----------Written by Barnet-----------
  2. function CheckSlot()
  3.   Slot = turtle.getItemDetail()
  4.   if Slot.name == "" then
  5.     return true
  6.   else
  7.     return false
  8.   end
  9. end
  10.  
  11. x = 1
  12. while x<17 do
  13.   turtle.select(x)
  14.   x=x+1
  15.   if x == 17 then
  16.     turtle.select(1)
  17.   end
  18.   Item = turtle.getItemDetail()
  19.   if pcall(CheckSlot) == true then
  20.     if Item.name == "minecraft:coal" then
  21.       while turtle.getFuelLimit() - turtle.getFuelLevel() > 80 and pcall(CheckSlot) == true do
  22.         turtle.refuel(1)
  23.         print(turtle.getFuelLevel())
  24.       end
  25.     end
  26.     if Item.name == "minecraft:planks" then
  27.          while turtle.getFuelLimit() - turtle.getFuelLevel() > 15 and pcall(CheckSlot) == true do
  28.            turtle.refuel(1)
  29.            print(turtle.getFuelLevel())
  30.          end
  31.     end
  32.     if Item.name == "minecraft:coal_block" then
  33.       while turtle.getFuelLimit() - turtle.getFuelLevel() > 800 and pcall(CheckSlot) == true do
  34.         turtle.refuel(1)
  35.         print(turtle.getFuelLevel())
  36.       end
  37.     end
  38.     if Item.name == "Railcraft:fuel.coke" then
  39.       while turtle.getFuelLimit() - turtle.getFuelLevel() > 160 and pcall(CheckSlot) == true do
  40.         turtle.refuel(1)
  41.         print(turtle.getFuelLevel())
  42.       end
  43.     end
  44.     if Item.name == "Railcraft:fuel.coke" or Item.name == "ImmersiveEngineering:material" then
  45.       while turtle.getFuelLimit() - turtle.getFuelLevel() > 160 and pcall(CheckSlot) == true do
  46.         turtle.refuel(1)
  47.         print(turtle.getFuelLevel())
  48.       end
  49.     end
  50.     if Item.name == "Railcraft:cube" then
  51.       while turtle.getFuelLimit() - turtle.getFuelLevel() > 1600 and pcall(CheckSlot) == true do
  52.         turtle.refuel(1)
  53.         print(turtle.getFuelLevel())
  54.       end
  55.     end
  56.   end
  57. end
RAW Paste Data