Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local FUEL_THRESHOLD = turtle.getFuelLimit() - 100 --15000
- local BUCKET = "minecraft:bucket"
- local LAVA = "minecraft:lava"
- ---@param name string
- ---@return boolean exists
- ---@return number slot
- local function hasItem(name)
- for slot = 1, 16 do
- local info = turtle.getItemDetail(slot)
- if info and info.name == name then
- return true, slot
- end
- end
- return false, 1
- end
- assert(hasItem(BUCKET), "Missing bucket!")
- local function drillRefuel()
- local y = 0
- while true do
- local exists, info = turtle.inspectDown()
- if not exists or info.name ~= LAVA or info.state.level ~= 0 then
- break
- end
- turtle.placeDown()
- turtle.refuel(1)
- turtle.down()
- y = y + 1
- end
- for _ = 1, y do
- turtle.digUp()
- turtle.up()
- end
- end
- local i = 0
- while true do
- drillRefuel()
- if turtle.getFuelLevel() >= FUEL_THRESHOLD then
- break
- end
- repeat
- turtle.dig()
- until turtle.forward()
- i = i + 1
- end
- for _ = 1, i do
- turtle.back()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement