HappySunChild

NetherOceanRefuel

Jun 25th, 2022 (edited)
201
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.80 KB | None
  1. local args = { ... }
  2.  
  3. local maxFuel = tonumber(args[1]) or 5000
  4.  
  5. local hasbucket = false
  6. local hasmultiplebuckets = false
  7.  
  8. for i = 1, 16 do
  9.     local data = turtle.getItemDetail(i)
  10.     if data and data.name == "minecraft:bucket" then
  11.         hasbucket = true
  12.         if data.count > 1 then
  13.             hasmultiplebuckets = true
  14.         end
  15.         break
  16.     end
  17. end
  18.  
  19. if hasbucket then
  20.     repeat
  21.         local hasBlock, data = turtle.inspectDown()
  22.  
  23.         if hasBlock and data.name == "minecraft:lava" then
  24.             break
  25.         end
  26.  
  27.         turtle.digDown()
  28.         turtle.down()
  29.     until hasBlock and data.name == "minecraft:lava"
  30.  
  31.     while turtle.getFuelLevel() < maxFuel do
  32.         local _, data = turtle.inspectDown()
  33.  
  34.         if data and data.name == "minecraft:lava" and data.state.level == 0 then
  35.             local y = 0
  36.             repeat
  37.                 local _, data = turtle.inspectDown()
  38.                 turtle.placeDown()
  39.                 turtle.refuel()
  40.                 turtle.down()
  41.                 y = y - 1
  42.             until data and data.name ~= "minecraft:lava" or data == nil
  43.  
  44.             y = y + 1
  45.  
  46.             repeat
  47.                 turtle.digUp()
  48.                 turtle.up()
  49.                 y = y + 1
  50.             until y == 0
  51.         elseif data and data.name ~= "minecraft:lava" then
  52.             turtle.back()
  53.             turtle.turnRight()
  54.         end
  55.  
  56.         if turtle.detect() then
  57.             turtle.turnRight()
  58.             if turtle.detect() then
  59.                 turtle.turnLeft()
  60.                 turtle.turnLeft()
  61.             end
  62.             if turtle.detect() then
  63.                 turtle.turnLeft()
  64.             end
  65.         end
  66.  
  67.         turtle.forward()
  68.     end
  69.  
  70.     print(os.getComputerLabel() .. " has more fuel than " .. maxFuel)
  71. end
  72.  
RAW Paste Data Copied