Advertisement
Inksaver

Toolkit Template

Mar 19th, 2022
874
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.14 KB | None | 0 0
  1. local T
  2.  
  3. local function checkFuelNeeded(quantity)
  4.     local fuelNeeded = quantity - turtle.getFuelLevel() -- eg 600
  5.     if fuelNeeded > 0 then
  6.         T:checkInventoryForItem({"minecraft:lava_bucket", "coal", "planks"}, {1, math.ceil(fuelNeeded / 60), math.ceil(fuelNeeded / 15)}) -- 0 if not present  
  7.         T:refuel(quantity, true)
  8.     end
  9. end
  10.  
  11. local function getSupplies()
  12.     T:clear()
  13.     -- add items you need here
  14.     -- example of a specific item, quantity = 1, required = true
  15.     T:checkInventoryForItem({"minecraft:chest"}, {1}, true)
  16.     -- example of a non-specific item, quantity = 16, required = false
  17.     T:checkInventoryForItem({"stairs"}, {16}, false)
  18.     -- example of alternative items quantity = 64, required = true
  19.     T:checkInventoryForItem({"minecraft:cobblestone", "minecraft:dirt"}, {64, 64}, true)
  20. end
  21.  
  22. local function newProcess()
  23.     checkFuelNeeded(250) -- put approx amount your process will need here
  24.     getSupplies()        -- get the items you need here
  25.     -- now do the job!
  26.    
  27. end
  28.  
  29. function main()
  30.     T = require("lib.clsTurtle"):new(true) -- true enables logfile to log.txt
  31.     newProcess() -- the name of your epic process, eg createCobbleGenerator()
  32. end
  33.  
  34. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement