aregrubb

fluix maker

Jan 1st, 2024 (edited)
2,679
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.34 KB | None | 0 0
  1. function refuel() -- standard script for refuel
  2.         if turtle.getFuelLevel() ~= "unlimited" and turtle.getFuelLevel() < 1 then
  3.                     repeat
  4.                             turtle.select(1)
  5.                             if turtle.getItemCount( turtle.getSelectedSlot() ) == 0 then
  6.                                 redstone.setAnalogOutput("top",15)
  7.                                 print("Out of fuel! Put fuel in first slot.")
  8.                                 print("Press any key to continue")
  9.                                 os.pullEvent("key")
  10.                                 redstone.setAnalogOutput("top",0)
  11.                             else
  12.                             end
  13.                     until turtle.getItemCount( turtle.getSelectedSlot() ) > 0
  14.                     print("refueling")
  15.                     turtle.refuel()        
  16.         end
  17. end
  18.  
  19. while true do -- start the endless journey
  20.     refuel()
  21.    
  22.     turtle.select(2) -- select inventory slot number 2
  23.     local slot2raw = turtle.getItemDetail() -- store the item details for item in slot 2
  24.     turtle.select(3)
  25.     local slot3raw = turtle.getItemDetail()
  26.     turtle.select(4)
  27.     local slot4raw = turtle.getItemDetail()
  28.    
  29.     if  slot2raw and slot3raw and slot4raw then
  30.         local slot2 = tostring(slot2raw.name)
  31.         local slot3 = tostring(slot3raw.name)
  32.         local slot4 = tostring(slot4raw.name)
  33.     -- script for recognizing right inventory for fluix crystal
  34.         if slot2 == "ae2:charged_certus_quartz_crystal" or slot2 == "minecraft:redstone" or slot2 == "minecraft:quartz"
  35.         and slot3 == "ae2:charged_certus_quartz_crystal" or slot3 == "minecraft:redstone" or slot3 == "minecraft:quartz"
  36.         and slot4 == "ae2:charged_certus_quartz_crystal" or slot4 == "minecraft:redstone" or slot4 == "minecraft:quartz"
  37.         then
  38.         -- make fluix crystal
  39.             turtle.forward()
  40.             for a = 2,4,1 do
  41.                 turtle.select(a)
  42.                 turtle.dropDown()
  43.             end
  44.             os.sleep(10)
  45.             turtle.select(3)
  46.             itemcunt3 = turtle.getItemCount()
  47.             turtle.select(2)
  48.             itemcunt2 = turtle.getItemCount()
  49.             while itemcunt2 + itemcunt3 < 128 do
  50.                 print(itemcunt3)
  51.                 turtle.suckDown()
  52.                 turtle.select(3)
  53.                 itemcunt3 = turtle.getItemCount()
  54.                 turtle.select(2)
  55.                 itemcunt2 = turtle.getItemCount()
  56.             end
  57.             turtle.back()
  58.             turtle.turnLeft() turtle.turnLeft()
  59.             for a = 2,4,1 do
  60.                 turtle.select(a)
  61.                 turtle.drop()
  62.             end
  63.             turtle.turnLeft() turtle.turnLeft()
  64.         end
  65.     end
  66.     os.sleep(0.2)
  67. end
  68.  
  69.  
Advertisement
Add Comment
Please, Sign In to add comment