ecco7777

CC Direwolf auto blood alchemie

Jun 14th, 2017
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. inv=peripheral.wrap("bottom")
  2. recipes={}
  3. recipes["AWWayofTime:simpleCatalyst0"]={'minecraft:gunpowder0','minecraft:redstone0','minecraft:redstone0','minecraft:glowstone_dust0','minecraft:sugar0'}
  4. recipes["AWWayofTime:bloodMagicBasicAlchemyItems3"]={'AWWayofTime:simpleCatalyst0','AWWayofTime:simpleCatalyst0','minecraft:nether_wart0','minecraft:dye15'}
  5. recipes["AWWayofTime:bloodMagicBasicAlchemyItems4"]={'AWWayofTime:bloodMagicBasicAlchemyItems5','AWWayofTime:bloodMagicBasicAlchemyItems4','minecraft:gold_nugget0'}
  6. recipes["AWWayofTime:bloodMagicBasicAlchemyItems5"]={'minecraft:bone0','minecraft:bone0','minecraft:bone0','minecraft:bone0','minecraft:gunpowder0'}
  7. recipes["AWWayofTime:bloodMagicBaseItems15"]={'AWWayofTime:imbuedSlate0','AWWayofTime:imbuedSlate0','AWWayofTime:bloodMagicBasicAlchemyItems4'}
  8. recipes["AWWayofTime:magicales0"]={'minecraft:redstone0','minecraft:gunpowder0','minecraft:glowstone_dust0','minecraft:glowstone_dust0','AWWayofTime:simpleCatalyst0'}
  9. termXMax,termYMax=term.getSize()
  10. inv.condenseItems()
  11.  
  12. function getPossibleBrews()
  13. brews={}
  14. for i=1,16 do
  15. turtle.select(i)
  16. if turtle.getItemDetail()~=nil then
  17. if recipes[turtle.getItemDetail().name..turtle.getItemDetail().damage]~=nil then
  18. recipe=recipes[turtle.getItemDetail().name..turtle.getItemDetail().damage]
  19. brewPossible=true
  20. for i2=1,#recipe do
  21. if itemByIdDmg[recipe[i2]]==nil then
  22. brewPossible=false
  23. end
  24. end
  25. if brewPossible then
  26. print("debug5")
  27. turtle.suck()
  28. turtle.drop()
  29. end
  30. end
  31. end
  32. end
  33. end
  34.  
  35. function scanItems()
  36. slots=inv.getInventorySize()
  37. itemInSlot={}
  38. itemByName={}
  39. itemByNum={}
  40. itemById={}
  41. itemByIdDmg={}
  42. itemByAmount={}
  43. itemListed={}
  44. i2=1
  45. for i=1,slots do
  46. term.clear()
  47. term.setCursorPos(1,1)
  48. term.write("Scan Slot"..tostring(i).." of "..tostring(slots))
  49. itemInSlot[i]=inv.getStackInSlot(i)
  50. sleep(0)
  51. if itemInSlot[i]~=nil then
  52. itemInSlot[i]["slot"]=i
  53. itemByName[itemInSlot[i]["name"]]=itemInSlot[i]
  54.  
  55. if itemById[itemInSlot[i]["id"]]==nil then
  56. itemByAmount[itemInSlot[i]["id"]]=itemInSlot[i]
  57. itemByNum[i2]=itemByAmount[itemInSlot[i]["id"]]
  58. i2=i2+1
  59. else
  60. itemByAmount[itemInSlot[i]["id"]]["qty"]=itemByAmount[itemInSlot[i]["id"]]["qty"]+itemInSlot[i]["qty"]
  61. end
  62. itemById[itemInSlot[i]["id"]]=itemInSlot[i]
  63. itemByIdDmg[itemInSlot[i]["id"]..itemInSlot[i]["dmg"]]=itemInSlot[i]
  64. end
  65. end
  66. i=i2
  67. for i2=1,i-1 do
  68. itemByNum[i2]=itemByAmount[itemByNum[i2]["id"]]
  69. end
  70. end
  71.  
  72. function getItem(id,qty,slot)
  73. inv.pushIntoSlot("up",id,qty,slot)
  74. end
  75.  
  76. function itemAvarible(id,qty)
  77. itemAvarible=false
  78. if itemByAmount[id]~=nil then
  79. if itemByAmount[id]["qty"]>=qty then
  80. itemAvarible=true
  81. end
  82. end
  83. return itemAvarible
  84. end
  85.  
  86.  
  87.  
  88. while true do
  89. scanItems()
  90. getPossibleBrews()
  91. sleep(5)
  92. end
Add Comment
Please, Sign In to add comment