Advertisement
tsargothruneclaw

AutoAnvil Enchanted Books Combiner (Minecraft)

Mar 17th, 2018
660
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.78 KB | None | 0 0
  1. local autoAnvil=peripheral.wrap("powered_tile_3")
  2. local filingCabinet=peripheral.wrap("bottom")
  3.  
  4. while true do
  5.     local breakloop=0
  6.    
  7.     for cnt = 1, filingCabinet.getInventorySize()-1, 1 do
  8.         local item=filingCabinet.getStackInSlot(cnt)
  9.         print(item["enchanted_book"][1]["fullName"])
  10.         if (item["enchanted_book"][1]["fullName"] == "Punch II") then
  11.             print("Max Enchantment level. Storing book\n")
  12.             filingCabinet.pushItem("down",cnt,item["qty"])
  13.             breakloop=1
  14.             break
  15.         end
  16.         if (item["enchanted_book"][1]["fullName"] == "Luck of the Sea III") then
  17.             print("Max Enchantment level. Storing book\n")
  18.             filingCabinet.pushItem("down",cnt,item["qty"])
  19.             breakloop=1
  20.             break
  21.         end
  22.         if (item["enchanted_book"][1]["fullName"] == "Haste III") then
  23.             print("Max Enchantment level. Storing book\n")
  24.             filingCabinet.pushItem("down",cnt,item["qty"])
  25.             breakloop=1
  26.             break
  27.         end
  28.         if (item["enchanted_book"][1]["fullName"] == "Unstable III") then
  29.             print("Max Enchantment level. Storing book\n")
  30.             filingCabinet.pushItem("down",cnt,item["qty"])
  31.             breakloop=1
  32.             break
  33.         end
  34.         if (item["enchanted_book"][1]["fullName"] == "Flaming Spikes III") then
  35.             print("Max Enchantment level. Storing book\n")
  36.             filingCabinet.pushItem("down",cnt,item["qty"])
  37.             breakloop=1
  38.             break
  39.         end
  40.         if (item["enchanted_book"][1]["fullName"] == "Knockback II") then
  41.             print("Max Enchantment level. Storing book\n")
  42.             filingCabinet.pushItem("down",cnt,item["qty"])
  43.             breakloop=1
  44.             break
  45.         end
  46.         if (item["enchanted_book"][1]["fullName"] == "Retaliatory Kick IV") then
  47.             print("Max Enchantment level. Storing book\n")
  48.             filingCabinet.pushItem("down",cnt,item["qty"])
  49.             breakloop=1
  50.             break
  51.         end
  52.         if (item["enchanted_book"][1]["fullName"] == "enchantment.magicresist V") then
  53.             print("Max Enchantment level. Storing book\n")
  54.             filingCabinet.pushItem("down",cnt,item["qty"])
  55.             breakloop=1
  56.             break
  57.         end
  58.         if (item["enchanted_book"][1]["fullName"] == "Respiration III") then
  59.             print("Max Enchantment level. Storing book\n")
  60.             filingCabinet.pushItem("down",cnt,item["qty"])
  61.             breakloop=1
  62.             break
  63.         end
  64.         if (item["enchanted_book"][1]["fullName"] == "Thorns III") then
  65.             print("Max Enchantment level. Storing book\n")
  66.             filingCabinet.pushItem("down",cnt,item["qty"])
  67.             breakloop=1
  68.             break
  69.         end
  70.         if (item["enchanted_book"][1]["fullName"] == "Power V") then
  71.             print("Max Enchantment level. Storing book\n")
  72.             filingCabinet.pushItem("down",cnt,item["qty"])
  73.             breakloop=1
  74.             break
  75.         end
  76.         if (item["enchanted_book"][1]["fullName"] == "Blast Protection IV") then
  77.             print("Max Enchantment level. Storing book\n")
  78.             filingCabinet.pushItem("down",cnt,item["qty"])
  79.             breakloop=1
  80.             break
  81.         end
  82.         if (item["enchanted_book"][1]["fullName"] == "Protection IV") then
  83.             print("Max Enchantment level. Storing book\n")
  84.             filingCabinet.pushItem("down",cnt,item["qty"])
  85.             breakloop=1
  86.             break
  87.         end
  88.         if (item["enchanted_book"][1]["fullName"] == "Magic Protection IV") then
  89.             print("Max Enchantment level. Storing book\n")
  90.             filingCabinet.pushItem("down",cnt,item["qty"])
  91.             breakloop=1
  92.             break
  93.         end
  94.         if (item["enchanted_book"][1]["fullName"] == "Soulbound I" or item["enchanted_book"][1]["fullName"] == "enchantment.soulbound I") then
  95.             print("Max Enchantment level. Storing book\n")
  96.             filingCabinet.pushItem("down",cnt,item["qty"])
  97.             breakloop=1
  98.             break
  99.         end
  100.         if (item["enchanted_book"][1]["fullName"] == "Unbreaking III") then
  101.             print("Max Enchantment level. Storing book\n")
  102.             filingCabinet.pushItem("down",cnt,item["qty"])
  103.             breakloop=1
  104.             break
  105.         end
  106.         if (item["enchanted_book"][1]["fullName"] == "Flame I") then
  107.             print("Max Enchantment level. Storing book\n")
  108.             filingCabinet.pushItem("down",cnt,item["qty"])
  109.             breakloop=1
  110.             break
  111.         end
  112.         if (item["enchanted_book"][1]["fullName"] == "Auto-Smelt I") then
  113.             print("Max Enchantment level. Storing book\n")
  114.             filingCabinet.pushItem("down",cnt,item["qty"])
  115.             breakloop=1
  116.             break
  117.         end
  118.         if (item["enchanted_book"][1]["fullName"] == "Feather Falling IV") then
  119.             print("Max Enchantment level. Storing book\n")
  120.             filingCabinet.pushItem("down",cnt,item["qty"])
  121.             breakloop=1
  122.             break
  123.         end
  124.         if (item["enchanted_book"][1]["fullName"] == "Lure III") then
  125.             print("Max Enchantment level. Storing book\n")
  126.             filingCabinet.pushItem("down",cnt,item["qty"])
  127.             breakloop=1
  128.             break
  129.         end
  130.         if (item["enchanted_book"][1]["fullName"] == "Sharpness V") then
  131.             print("Max Enchantment level. Storing book\n")
  132.             filingCabinet.pushItem("down",cnt,item["qty"])
  133.             breakloop=1
  134.             break
  135.         end
  136.         if (item["enchanted_book"][1]["fullName"] == "Projectile Protection IV") then
  137.             print("Max Enchantment level. Storing book\n")
  138.             filingCabinet.pushItem("down",cnt,item["qty"])
  139.             breakloop=1
  140.             break
  141.         end
  142.         if (item["enchanted_book"][1]["fullName"] == "Fire Protection IV") then
  143.             print("Max Enchantment level. Storing book\n")
  144.             filingCabinet.pushItem("down",cnt,item["qty"])
  145.             breakloop=1
  146.             break
  147.         end
  148.         if (item["enchanted_book"][1]["fullName"] == "Aqua Affinity I") then
  149.             print("Max Enchantment level. Storing book\n")
  150.             filingCabinet.pushItem("down",cnt,item["qty"])
  151.             breakloop=1
  152.             break
  153.         end
  154.         if (item["enchanted_book"][1]["fullName"] == "Withering I" or item["enchanted_book"][1]["fullName"] == "Withering  I") then
  155.             print("Max Enchantment level. Storing book\n")
  156.             filingCabinet.pushItem("down",cnt,item["qty"])
  157.             breakloop=1
  158.             break
  159.         end
  160.         if (item["enchanted_book"][1]["fullName"] == "Poisonous Barbs I") then
  161.             print("Max Enchantment level. Storing book\n")
  162.             filingCabinet.pushItem("down",cnt,item["qty"])
  163.             breakloop=1
  164.             break
  165.         end
  166.         if (item["enchanted_book"][1]["fullName"] == "Infinity I") then
  167.             print("Max Enchantment level. Storing book\n")
  168.             filingCabinet.pushItem("down",cnt,item["qty"])
  169.             breakloop=1
  170.             break
  171.         end
  172.         if (item["enchanted_book"][1]["fullName"] == "XP Boost III") then
  173.             print("Max Enchantment level. Storing book\n")
  174.             filingCabinet.pushItem("down",cnt,item["qty"])
  175.             breakloop=1
  176.             break
  177.         end
  178.         if (item["enchanted_book"][1]["fullName"] == "Last Stand II") then
  179.             print("Max Enchantment level. Storing book\n")
  180.             filingCabinet.pushItem("down",cnt,item["qty"])
  181.             breakloop=1
  182.             break
  183.         end
  184.         if (item["qty"] >1 ) then
  185.             print("Sending item to auto-anvil to combine.")
  186.             filingCabinet.pushItemIntoSlot("west",cnt,1,1)
  187.             filingCabinet.pushItemIntoSlot("west",cnt,1,2)
  188.             while( autoAnvil.getStackInSlot(1) ~= nil and autoAnvil.getStackInSlot(2) ~=nil ) do
  189.                 sleep(0)
  190.             end
  191.             autoAnvil.pushItem("east",3)
  192.             print("Success. Restarting process.\n\n")
  193.             breakloop=1
  194.         end
  195.         if (item['qty']<2 and breakloop==1) then sleep(3) end
  196.         if (breakloop==1) then break end
  197.     end
  198. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement