Advertisement
kunyuu

Powah Automation

Dec 9th, 2022 (edited)
886
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.03 KB | None | 0 0
  1. function getItem(itemName)
  2.     local inChest = peripheral.wrap("left")
  3.     local size = inChest.size()
  4.  
  5.     for i=1, size do
  6.         local contents = inChest.getItemDetail(i)
  7.        
  8.         if (contents ~= nil) then    
  9.             if (contents.name == itemName) then
  10.                 inChest.pushItems("top", i, 1)
  11.                 break
  12.             end
  13.         end
  14.     end
  15.  
  16. end
  17.  
  18.  
  19.  
  20. local orb = peripheral.wrap("top")
  21. local inChest = peripheral.wrap("left")
  22. local outChest = peripheral.wrap("right")
  23. local size = inChest.size()
  24.  
  25. while true do
  26.     local finishSlot = orb.getItemDetail(1)
  27.     local orbSlot1 = orb.getItemDetail(2)
  28.     local orbSlot2 = orb.getItemDetail(3)
  29.     local orbSlot3 = orb.getItemDetail(4)
  30.     local orbSlot4 = orb.getItemDetail(5)
  31.     local orbSlot5 = orb.getItemDetail(6)
  32.     local orbSlot6 = orb.getItemDetail(7)
  33.    
  34.     if (orbSlot1 == nil and finishSlot == nil) then
  35.         for i=1, size do
  36.             local contents = inChest.getItemDetail(i)
  37.             if (contents ~= nil) then
  38.                 if (contents.name == "minecraft:diamond" or contents.name == "minecraft:emerald" or contents.name == "minecraft:blaze_rod" or contents.name == "minecraft:iron_ingot"
  39.                 or contents.name == "minecraft:nether_star" or contents.name == "minecraft:blue_ice" or contents.name == "minecraft:ender_eye" or contents.name == "powah:uraninite_raw") then
  40.                     inChest.pushItems("top", i, 1)
  41.                     break
  42.                 end
  43.             end
  44.         end
  45.     elseif (orbSlot1 ~= nil and orbSlot1.name == "minecraft:iron_ingot") then
  46.         --Iron ingots for energized steel
  47.         local goldSlot = orb.getItemDetail(3)
  48.        
  49.         if (goldSlot == nil) then
  50.             getItem("minecraft:gold_ingot")
  51.         end
  52.     elseif (orbSlot1 ~= nil and orbSlot1.name == "minecraft:nether_star") then
  53.         if orbSlot2 == nil then
  54.             getItem("minecraft:redstone_block")
  55.         elseif orbSlot3 == nil then
  56.             getItem("minecraft:redstone_block")
  57.         elseif orbSlot4 == nil then
  58.             getItem("powah:blazing_crystal_block")
  59.         end
  60.     elseif (orbSlot1 ~= nil and orbSlot1.name == "minecraft:blue_ice") then
  61.         if orbSlot2 == nil then
  62.             getItem("minecraft:blue_ice")
  63.         end
  64.     elseif (orbSlot1 ~= nil and orbSlot1.name == "minecraft:ender_eye") then
  65.         if orbSlot2 == nil then
  66.             getItem("powah:dielectric_casing")
  67.         elseif orbSlot3 == nil then
  68.             getItem("powah:capacitor_basic_tiny")
  69.         end
  70.     elseif (finishSlot ~= nil) then
  71.         if (finishSlot.name == "powah:steel_energized" or finishSlot.name == "powah:crystal_spirited"
  72.          or finishSlot.name == "powah:crystal_niotic" or finishSlot.name == "powah:crystal_blazing" or finishSlot.name == "powah:crystal_nitro" or finishSlot.name == "powah:dry_ice"
  73.          or finishSlot.name == "powah:ender_core" or finishSlot.name == "powah:uraninite") then
  74.             orb.pushItems("right", 1)
  75.         end
  76.     end
  77. end
  78.            
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement