Advertisement
Vodka51200

RechargeFuelFast

Jun 20th, 2025
780
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | Gaming | 0 0
  1. function rechargeTurtle()
  2.   local carburants = {
  3.     ["minecraft:coal"] = true,
  4.     ["minecraft:charcoal"] = true,
  5.     ["thermalfoundation:material"] = true -- exemple: coal coke (à adapter selon damage)
  6.   }
  7.  
  8.   local fuelAvant = turtle.getFuelLevel()
  9.   local carburantTrouve = false
  10.  
  11.   for slot = 1, 16 do
  12.     turtle.select(slot)
  13.     local item = turtle.getItemDetail()
  14.  
  15.     if item then
  16.       -- Vérifie si l'item est un carburant utilisable
  17.       if turtle.refuel(0) then
  18.         turtle.refuel()
  19.         print("Rechargement avec : " .. item.name)
  20.         carburantTrouve = true
  21.       end
  22.     end
  23.   end
  24.  
  25.   local fuelApres = turtle.getFuelLevel()
  26.   turtle.select(1) -- revenir au slot 1
  27.  
  28.   if carburantTrouve then
  29.     print("Carburant avant : " .. fuelAvant)
  30.     print("Carburant après : " .. fuelApres)
  31.     print("Quantité rechargée : " .. (fuelApres - fuelAvant))
  32.   else
  33.     print("Aucun carburant valide trouvé dans l'inventaire.")
  34.   end
  35. end
  36.  
  37. -- Exécution
  38. rechargeTurtle()
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement