lava-refueler.lua
49 lines · 1006 B
Copy & run
wget https://perlytiara.github.io/turtles.tips/raw/programs/BigGamingGamers/lava-refueler.lua
| 1 | local SLOT_COUNT = 16 |
| 2 | |
| 3 | function getItemIndex(itemName) |
| 4 | for slot = 1, SLOT_COUNT, 1 do |
| 5 | local item = turtle.getItemDetail(slot) |
| 6 | if(item ~= nil) then |
| 7 | if(item["name"] == itemName) then |
| 8 | return slot |
| 9 | end |
| 10 | end |
| 11 | end |
| 12 | end |
| 13 | |
| 14 | |
| 15 | function verifyLava(bucketIndex) |
| 16 | if(bucketIndex == nil) then |
| 17 | turtle.dropUp() |
| 18 | return |
| 19 | end |
| 20 | end |
| 21 | |
| 22 | function checkFuel() |
| 23 | |
| 24 | turtle.select(getItemIndex("enderstorage:ender_storage")) |
| 25 | turtle.digUp() |
| 26 | turtle.placeUp() |
| 27 | --Chest is deployed |
| 28 | |
| 29 | turtle.suckUp() |
| 30 | |
| 31 | while(turtle.getFuelLevel() < 1000) do |
| 32 | |
| 33 | bucketIndex = getItemIndex("minecraft:lava_bucket") |
| 34 | if(bucketIndex == nil) then |
| 35 | turtle.suckUp() |
| 36 | turtle.dropUp() |
| 37 | else |
| 38 | turtle.select(bucketIndex) |
| 39 | turtle.refuel() |
| 40 | turtle.dropUp() |
| 41 | turtle.digUp() |
| 42 | break |
| 43 | end |
| 44 | end |
| 45 | end |
| 46 | |
| 47 | checkFuel() |
| 48 | |
| 49 | -- pastebin get 3nMw1mEr test |