Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local slotCount = 16
- local width = 10
- local length = 10
- local height = 3
- local trash = {
- "minecraft:cobblestone", "minecraft:dirt", "minecraft:andesite",
- "minecraft:diorite", "minecraft:clay", "minecraft:sand",
- "minecraft:sandstone", "minecraft:limestone"
- }
- function purgeTrash()
- for slot = 1, slotCount, 1 do
- local item = turtle.getItemDetail(slot)
- if (item ~= nil) then
- for key, value in pairs(trash) do
- if (value == item.name) then end
- end
- end
- end
- end
- function forEach(table, func)
- for k, v in pairs(table) do func(v) end
- return true
- end
- function checkFuel()
- print('Checkng fuel...')
- if (turtle.getFuelLevel() < 20000) then
- print('fuel level sub-optimal')
- for slot = 1, slotCount, 1 do
- local item = turtle.getItemDetail(slot)
- if (item ~= nil) then
- if (item.name == "minecraft:coal") then
- print('Attemping to refuel...')
- turtle.select(slot)
- local result = turtle.refuel()
- print('Turtle refueled...')
- return true
- end
- end
- end
- print('Did not find coal in inventory.. powering down D:')
- return false
- end
- end
- function main()
- for level = 1, height, 1 do
- for row = 1, width, 1 do
- for col = 1, length, 1 do checkFuel() end
- purgeTrash()
- end
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement