Advertisement
MagmaLP

Autocrafting_v2

May 6th, 2023 (edited)
670
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.08 KB | None | 0 0
  1. Turtle = "turtle_20"
  2. OutChest = peripheral.wrap("minecraft:ironchest_iron_2")
  3. IronIngotChest = peripheral.wrap("projecte:condenser_mk2_27")
  4. CopperIngotChest = peripheral.wrap("projecte:condenser_mk2_28")
  5. RedstoneChest = peripheral.wrap("projecte:condenser_mk2_29")
  6. TinIngotChest = peripheral.wrap("projecte:condenser_mk2_30")
  7. GlassChest = peripheral.wrap("projecte:condenser_mk2_31")
  8. RubberChest = peripheral.wrap("minecraft:ender chest_5")
  9. RefinedIronChest = peripheral.wrap("minecraft:ender chest_6")
  10. CharcoalDustChest = peripheral.wrap("minecraft:ender chest_7")  
  11. OverflowChest = peripheral.wrap("minecraft:ironchest_diamond_0")
  12.  
  13. function DetectIfTurtleEmpty()
  14.     restart = nein
  15.     for a = 1,16 do
  16.         b = turtle.getItemCount(a)
  17.         if b >= 1 then
  18.             restart = ja
  19.             turtle.select(a)
  20.             turtle.dropDown()
  21.         end
  22.     end
  23.     if restart == ja then
  24.         os.reboot()
  25.     end
  26. end
  27.  
  28. function DetectIfOutChestEmpty()
  29.     for a = 1,54 do
  30.         OutChest.pushItems(OverflowChest, a, 64)
  31.     end
  32. end
  33.  
  34. function Iron_Furnace()
  35.     DetectIfTurtleEmpty()
  36.     IronIngotChest.pushItems(Turtle, 80, 60, 01)
  37.     IronIngotChest.pushItems(Turtle, 80, 60, 02)
  38.     IronIngotChest.pushItems(Turtle, 80, 60, 03)
  39.     IronIngotChest.pushItems(Turtle, 80, 60, 05)
  40.     IronIngotChest.pushItems(Turtle, 80, 60, 07)
  41.     IronIngotChest.pushItems(Turtle, 80, 60, 09)
  42.     IronIngotChest.pushItems(Turtle, 80, 60, 10)
  43.     IronIngotChest.pushItems(Turtle, 80, 60, 11)
  44.     turtle.select(1)
  45.     turtle.craft()
  46.     OutChest.pullItems(Turtle, 01, 60, 18)
  47.     print("Iron_Furnace")
  48. end
  49.  
  50. function Copper_Cable()
  51.     DetectIfTurtleEmpty()
  52.     if Cable == 1 then
  53.         c = 24
  54.         d = 60
  55.     elseif Cable == 2 then
  56.         c = 24
  57.         d = 60
  58.     elseif Cable == 3 then
  59.         c = 25
  60.         d = 10
  61.     end
  62.     RubberChest.pushItems(Turtle, 01, d, 01)
  63.     RubberChest.pushItems(Turtle, 01, d, 02)
  64.     RubberChest.pushItems(Turtle, 01, d, 03)
  65.     CopperIngotChest.pushItems(Turtle, 80, d, 05)
  66.     CopperIngotChest.pushItems(Turtle, 80, d, 06)
  67.     CopperIngotChest.pushItems(Turtle, 80, d, 07)
  68.     RubberChest.pushItems(Turtle, 01, d, 09)
  69.     RubberChest.pushItems(Turtle, 01, d, 10)
  70.     RubberChest.pushItems(Turtle, 01, d, 11)
  71.     turtle.select(1)
  72.     turtle.craft()
  73.     if Cable == 1 or Cable == 2 then
  74.         for a = 1,5 do
  75.             b = a + 18
  76.             OutChest.pullItems(Turtle, a, 60, b)
  77.         end
  78.         for a = 1,6 do
  79.             OutChest.pullItems(Turtle, a, 60, c)
  80.         end
  81.     elseif Cable == 3 then
  82.         OutChest.pullItems(Turtle, 01, 60, c)
  83.     end
  84.     print("Copper_Cable_1")
  85. end
  86.  
  87. function Electronic_Circuit()
  88.     if Circuit == 1 then
  89.         c = 26
  90.     elseif Circuit == 2 then
  91.         c = 27
  92.     end
  93.     DetectIfTurtleEmpty()
  94.     OutChest.pushItems(Turtle, 19, 60, 01)
  95.     OutChest.pushItems(Turtle, 20, 60, 02)
  96.     OutChest.pushItems(Turtle, 21, 60, 03)
  97.     RedstoneChest.pushItems(Turtle, 80, 60, 05)
  98.     RefinedIronChest.pushItems(Turtle, 01, 60, 06)
  99.     RedstoneChest.pushItems(Turtle, 80, 60, 07)
  100.     OutChest.pushItems(Turtle, 22, 60, 09)
  101.     OutChest.pushItems(Turtle, 23, 60, 10)
  102.     OutChest.pushItems(Turtle, 24, 60, 11)
  103.     turtle.select(1)
  104.     turtle.craft()
  105.     OutChest.pullItems(Turtle, 01, 60, c)
  106.     print("Electronic_Circuit")
  107. end
  108.  
  109. function Re_Battery()
  110.     DetectIfTurtleEmpty()
  111.     OutChest.pushItems(Turtle, 25, 60, 02)
  112.     TinIngotChest.pushItems(Turtle, 80, 60, 05)
  113.     RedstoneChest.pushItems(Turtle, 80, 60, 06)
  114.     TinIngotChest.pushItems(Turtle, 80, 60, 07)
  115.     TinIngotChest.pushItems(Turtle, 80, 60, 09)
  116.     RedstoneChest.pushItems(Turtle, 80, 60, 10)
  117.     TinIngotChest.pushItems(Turtle, 80, 60, 11)
  118.     turtle.select(1)
  119.     turtle.craft()
  120.     OutChest.pullItems(Turtle, 01, 16, 10)
  121.     OutChest.pullItems(Turtle, 02, 16, 11)
  122.     OutChest.pullItems(Turtle, 03, 16, 12)
  123.     OutChest.pullItems(Turtle, 04, 12, 13)
  124.     print("Re_Battery")
  125. end
  126.  
  127. function Generator()
  128.     DetectIfTurtleEmpty()  
  129.     RefinedIronChest.pushItems(Turtle, 01, 60, 05)
  130.     RefinedIronChest.pushItems(Turtle, 01, 60, 06)
  131.     RefinedIronChest.pushItems(Turtle, 01, 60, 07)
  132.     OutChest.pushItems(Turtle, 18, 60, 10)
  133.     turtle.select(16)
  134.     for a = 10,13 do
  135.         OutChest.pushItems(Turtle, a, 16, 02)
  136.         turtle.craft()
  137.         OutChest.pullItems(Turtle, 16, 16, 14)
  138.     end
  139.     print("Generator")
  140. end
  141.  
  142. function Solar_Panel()
  143.     DetectIfTurtleEmpty()
  144.     CharcoalDustChest.pushItems(Turtle, 01, 60, 01)
  145.     GlassChest.pushItems(Turtle, 80, 60, 02)
  146.     CharcoalDustChest.pushItems(Turtle, 01, 60, 03)
  147.     GlassChest.pushItems(Turtle, 80, 60, 05)
  148.     CharcoalDustChest.pushItems(Turtle, 01, 60, 06)
  149.     GlassChest.pushItems(Turtle, 80, 60, 07)
  150.     OutChest.pushItems(Turtle, 26, 60, 09)
  151.     OutChest.pushItems(Turtle, 14, 60, 10)
  152.     OutChest.pushItems(Turtle, 27, 60, 11)
  153.     turtle.select(1)
  154.     turtle.craft()
  155.     turtle.dropUp()
  156.     print("Solar_Panel")
  157. end
  158.  
  159. Iron_Furnace()
  160. Cable = 1
  161. Copper_Cable()    
  162. Circuit = 1
  163. Electronic_Circuit()
  164. Cable = 2
  165. Copper_Cable()
  166. Circuit = 2
  167. Electronic_Circuit()
  168. Cable = 3
  169. Copper_Cable()
  170. Re_Battery()
  171. Generator()        
  172. Solar_Panel()
  173.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement