Muzze77

Beesorter_LegionTekkit

May 27th, 2025 (edited)
680
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 14.29 KB | None | 0 0
  1. shell.run("clear")
  2. debug = false
  3. while true do
  4. machines = peripheral.getNames()
  5. slotmin = 2
  6. slotmax = 50*8
  7. default = ""
  8. common = ""
  9. industrial = ""
  10. imperial = ""
  11. emerald = ""
  12. unsorted= ""
  13. for v, k in pairs(machines) do
  14.  
  15.     machine = peripheral.wrap(k)
  16.     if string.find(k,"tile_machine") ~= nil then
  17.     if machine.getItemMeta(1) ~= nil then  
  18.     if machine.getItemMeta(1).displayName == "Default" then
  19.         print("Default = " .. k)
  20.         default = machine
  21.         default_api = k
  22.     end    
  23.     if machine.getItemMeta(1).displayName == "Common" then
  24.         print("Common = " .. k )
  25.         common = machine
  26.         common_api = k
  27.     end
  28.     if machine.getItemMeta(1).displayName == "Industrial" then
  29.         print("Industrial = " .. k)
  30.         industrial = machine
  31.         industrial_api = k
  32.     end
  33.     if machine.getItemMeta(1).displayName == "Imperial" then
  34.         print("Imperial = " .. k)
  35.         imperial = machine
  36.         imperial_api = k
  37.     end
  38.     if machine.getItemMeta(1).displayName == "Emerald" then
  39.         print("Emerald = " .. k)
  40.         emerald = machine
  41.         emerald_api = k
  42.     end    
  43.         if machine.getItemMeta(1).displayName == "Unsorted" then
  44.         print("Unsorted = " .. k)
  45.         unsorted = machine
  46.         unsorted_api = k
  47.     end    
  48.    
  49.    
  50.     end
  51.     end
  52. end
  53.  
  54.  
  55.  
  56.  
  57. if default ~= "" and common ~= "" and industrial ~= "" and imperial ~= "" and emerald ~= "" and unsorted ~= "" then
  58.     print("All Storages are setup")
  59.     print("Go through the Inventorys:")
  60.     for v, k in pairs(machines) do
  61.         if string.find(k, "tile_machine") ~= nil then
  62.             print("Machine " .. k .. " will be checked")
  63.             machine = peripheral.wrap(k)
  64.             for slot = 1, slotmax,1  do
  65.             if machine.getItemMeta(slot) ~= nil then
  66.                  print(k .. " slot " .. slot .. ": " .. machine.getItemMeta(slot).displayName)
  67.                   item = machine.getItemMeta(slot)
  68.  
  69.                     if string.find(item.displayName,"Forest") ~= nil then
  70.                       for sortitem = 2,slotmax,1 do
  71.                         if common.getItemMeta(sortitem) == nil then
  72.                            print("Freeslot in Common: " .. sortitem)
  73.                             machine.pushItems(common_api,slot,item.amount,slotitem)
  74.                             break
  75.                         end      
  76.                     end
  77.                     end
  78.    
  79.                     if string.find(item.displayName,"Meadows") ~= nil then
  80.                     for sortitem = 2,slotmax,1 do
  81.                         if common.getItemMeta(sortitem) == nil then
  82.                            print("Freeslot in Common: " .. sortitem)
  83.                             machine.pushItems(common_api,slot,item.amount,slotitem)
  84.                             break
  85.                         end      
  86.                     end
  87.                     end
  88.                   if string.find(item.displayName,"Rocky") ~= nil then
  89.                     if string.find(item.displayName,"Comb") == nil then
  90.                         for sortitem = 2,slotmax,1 do
  91.                             if common.getItemMeta(sortitem) == nil then
  92.                                print("Freeslot in Common: " .. sortitem)
  93.                                 machine.pushItems(common_api,slot,item.amount,slotitem)
  94.                                 break
  95.                             end      
  96.                         end
  97.                     end
  98.                     end
  99.                     if string.find(item.displayName,"Common") ~= nil then
  100.                     for sortitem = 2,slotmax,1 do
  101.                         if common.getItemMeta(sortitem) == nil then
  102.                            print("Freeslot in Common: " .. sortitem)
  103.                             machine.pushItems(common_api,slot,item.amount,slotitem)
  104.                             break
  105.                         end      
  106.                     end
  107.                     end
  108.                     if string.find(item.displayName,"Cultivated") ~= nil then
  109.                     for sortitem = 2,slotmax,1 do
  110.                         if common.getItemMeta(sortitem) == nil then
  111.                            print("Freeslot in Common: " .. sortitem)
  112.                             machine.pushItems(common_api,slot,item.amount,slotitem)
  113.                             break
  114.                         end      
  115.                     end
  116.                     end
  117.                     if string.find(item.displayName,"Diligent") ~= nil then
  118.                     for sortitem = 2,slotmax,1 do
  119.                         if industrial.getItemMeta(sortitem) == nil then
  120.                            print("Freeslot in industrial: " .. sortitem)
  121.                             machine.pushItems(industrial_api,slot,item.amount,slotitem)
  122.                             break
  123.                         end      
  124.                     end
  125.                     end
  126.                     if string.find(item.displayName,"Unweary") ~= nil then
  127.                     for sortitem = 2,slotmax,1 do
  128.                         if industrial.getItemMeta(sortitem) == nil then
  129.                            print("Freeslot in Industrial: " .. sortitem)
  130.                             machine.pushItems(industrial_api,slot,item.amount,slotitem)
  131.                             break
  132.                         end      
  133.                     end
  134.                     end
  135.                     if string.find(item.displayName,"Noble") ~= nil then
  136.                     for sortitem = 2,slotmax,1 do
  137.                         if imperial.getItemMeta(sortitem) == nil then
  138.                            print("Freeslot in Imperial: " .. sortitem)
  139.                             machine.pushItems(imperial_api,slot,item.amount,slotitem)
  140.                             break
  141.                         end      
  142.                     end
  143.                     end
  144.                     if string.find(item.displayName,"Imperial") ~= nil then
  145.                     for sortitem = 2,slotmax,1 do
  146.                         if imperial.getItemMeta(sortitem) == nil then
  147.                            print("Freeslot in imperial: " .. sortitem)
  148.                             machine.pushItems(imperial_api,slot,item.amount,slotitem)
  149.                             break
  150.                         end      
  151.                     end
  152.                     end
  153.                     if string.find(item.displayName,"Majestic") ~= nil then
  154.                     for sortitem = 2,slotmax,1 do
  155.                         if imperial.getItemMeta(sortitem) == nil then
  156.                            print("Freeslot in Imperial: " .. sortitem)
  157.                             machine.pushItems(imperial_api,slot,item.amount,slotitem)
  158.                             break
  159.                         end      
  160.                     end
  161.                     end
  162.                     if string.find(item.displayName,"Industrious") ~= nil then
  163.                     for sortitem = 2,slotmax,1 do
  164.                         if industrial.getItemMeta(sortitem) == nil then
  165.                            print("Freeslot in Industrial: " .. sortitem)
  166.                             machine.pushItems(industrial_api,slot,item.amount,slotitem)
  167.                             break
  168.                         end      
  169.                     end
  170.                     end
  171.                     if string.find(item.displayName," Comb") ~= nil then
  172.                     for sortitem = 2,slotmax,1 do
  173.                         if default.getItemMeta(sortitem) == nil then
  174.                            print("Freeslot in default: " .. sortitem)
  175.                             machine.pushItems(default_api,slot,item.amount,slotitem)
  176.                             break
  177.                         end      
  178.                     end
  179.                     end
  180.                     if string.find(item.displayName,"Pollen") ~= nil then
  181.                     for sortitem = 2,slotmax,1 do
  182.                         if default.getItemMeta(sortitem) == nil then
  183.                            print("Freeslot in default: " .. sortitem)
  184.                             machine.pushItems(default_api,slot,item.amount,slotitem)
  185.                             break
  186.                         end      
  187.                     end
  188.                     end
  189.                     if string.find(item.displayName,"Royal") ~= nil then
  190.                     for sortitem = 2,slotmax,1 do
  191.                         if default.getItemMeta(sortitem) == nil then
  192.                            print("Freeslot in default: " .. sortitem)
  193.                             machine.pushItems(default_api,slot,item.amount,slotitem)
  194.                             break
  195.                         end      
  196.                     end
  197.                     end
  198.                     if string.find(item.displayName,"Tolerant") ~= nil then
  199.                     for sortitem = 2,slotmax,1 do
  200.                         if emerald.getItemMeta(sortitem) == nil then
  201.                            print("Freeslot in Emerald: " .. sortitem)
  202.                             machine.pushItems(emerald_api,slot,item.amount,slotitem)
  203.                             break
  204.                         end      
  205.                     end
  206.                     end
  207.                     if string.find(item.displayName,"Resilent") ~= nil then
  208.                     for sortitem = 2,slotmax,1 do
  209.                         if emerald.getItemMeta(sortitem) == nil then
  210.                            print("Freeslot in Emerald: " .. sortitem)
  211.                             machine.pushItems(emerald_api,slot,item.amount,slotitem)
  212.                             break
  213.                         end      
  214.                     end
  215.                     end
  216.                 if string.find(item.displayName,"Emerald") ~= nil then
  217.                     for sortitem = 2,slotmax,1 do
  218.                         if emerald.getItemMeta(sortitem) == nil then
  219.                            print("Freeslot in Emerald: " .. sortitem)
  220.                             machine.pushItems(emerald_api,slot,item.amount,slotitem)
  221.                             break
  222.                         end      
  223.                     end
  224.                     end
  225.                             if string.find(item.displayName,"Lapis") ~= nil then
  226.                     for sortitem = 2,slotmax,1 do
  227.                         if emerald.getItemMeta(sortitem) == nil then
  228.                            print("Freeslot in Emerald: " .. sortitem)
  229.                             machine.pushItems(emerald_api,slot,item.amount,slotitem)
  230.                             break
  231.                         end      
  232.                     end
  233.                     end
  234.         if string.find(item.displayName,"Ruby") ~= nil then
  235.                     for sortitem = 2,slotmax,1 do
  236.                         if emerald.getItemMeta(sortitem) == nil then
  237.                            print("Freeslot in Emerald: " .. sortitem)
  238.                             machine.pushItems(emerald_api,slot,item.amount,slotitem)
  239.                             break
  240.                         end      
  241.                     end
  242.                     end
  243.                 if string.find(item.displayName,"Tolerant") ~= nil then
  244.                     for sortitem = 2,slotmax,1 do
  245.                         if emerald.getItemMeta(sortitem) == nil then
  246.                            print("Freeslot in Emerald: " .. sortitem)
  247.                             machine.pushItems(emerald_api,slot,item.amount,slotitem)
  248.                             break
  249.                         end      
  250.                     end
  251.                     end
  252.                     if string.find(item.displayName,"Marshy") ~= nil then
  253.                     for sortitem = 2,slotmax,1 do
  254.                         if common.getItemMeta(sortitem) == nil then
  255.                            print("Freeslot in Common: " .. sortitem)
  256.                             machine.pushItems(common_api,slot,item.amount,slotitem)
  257.                             break
  258.                         end      
  259.                     end
  260.                     end
  261.                     if string.find(item.displayName,"Tropical") ~= nil then
  262.                     for sortitem = 2,slotmax,1 do
  263.                         if common.getItemMeta(sortitem) == nil then
  264.                            print("Freeslot in Common: " .. sortitem)
  265.                             machine.pushItems(common_api,slot,item.amount,slotitem)
  266.                             break
  267.                         end      
  268.                     end
  269.                     end
  270.                     if string.find(item.displayName,"Wintry") ~= nil then
  271.                     for sortitem = 2,slotmax,1 do
  272.                         if common.getItemMeta(sortitem) == nil then
  273.                            print("Freeslot in Common: " .. sortitem)
  274.                             machine.pushItems(common_api,slot,item.amount,slotitem)
  275.                             break
  276.                         end      
  277.                     end
  278.                     end
  279.                     if string.find(item.displayName,"Water") ~= nil then
  280.                     for sortitem = 2,slotmax,1 do
  281.                         if common.getItemMeta(sortitem) == nil then
  282.                            print("Freeslot in Common: " .. sortitem)
  283.                             machine.pushItems(common_api,slot,item.amount,slotitem)
  284.                             break
  285.                         end      
  286.                     end
  287.                     end
  288.  
  289.                     if string.find(item.displayName,"Marbled") ~= nil then
  290.                     for sortitem = 2,slotmax,1 do
  291.                         if common.getItemMeta(sortitem) == nil then
  292.                            print("Freeslot in Common: " .. sortitem)
  293.                             machine.pushItems(common_api,slot,item.amount,slotitem)
  294.                             break
  295.                         end      
  296.                     end
  297.                     end
  298.                     if string.find(item.displayName,"Embittered") ~= nil then
  299.                     for sortitem = 2,slotmax,1 do
  300.                         if common.getItemMeta(sortitem) == nil then
  301.                            print("Freeslot in Common: " .. sortitem)
  302.                             machine.pushItems(common_api,slot,item.amount,slotitem)
  303.                             break
  304.                         end      
  305.                     end
  306.                     end
  307.                     if item.displayName ~= nil and item.displayName ~= "Default" and item.displayName ~= "Common" and item.displayName ~= "Industrial" and item.displayName ~= "Imperial" and item.displayName ~= "Emerald" and item.displayName ~= "Unsorted" then
  308.                     for sortitem = 2,slotmax,1 do
  309.                         if unsorted.getItemMeta(sortitem) == nil then
  310.                            print("Freeslot in Unsorted: " .. sortitem)
  311.                             machine.pushItems(unsorted_api,slot,item.amount,slotitem)
  312.                             break
  313.                         end      
  314.                     end
  315.                     end
  316.  
  317.  
  318.  
  319.  
  320.             else
  321.                 if debug then
  322.                     print("Nothing in " .. k .. " slot: " .. slot)
  323.                 end
  324.             end
  325.        
  326.             end
  327.         end
  328.        
  329.    
  330.     end  
  331.     print("Done")
  332.    else
  333.     print("Missing Machines")
  334.  
  335.     end
  336.  
  337. sleep(1)
  338.  
  339. end
  340.  
Advertisement
Add Comment
Please, Sign In to add comment