hhhzzzsss

ironblocks.lua

Aug 23rd, 2023 (edited)
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.87 KB | None | 0 0
  1. local craftSlots = {1, 2, 3, 5, 6, 7, 9, 10, 11}
  2. local nonCraftSlots = {4, 8, 12, 13, 14, 15, 16}
  3.  
  4. while true do
  5.     failed = false
  6.     for _, i in ipairs(craftSlots) do
  7.         if turtle.getItemCount(i) < 64 then
  8.             turtle.select(i)
  9.             turtle.suckDown(64-turtle.getItemCount())
  10.         end
  11.         if turtle.getItemCount(i) == 0 then
  12.             failed = true
  13.         end
  14.     end
  15.     for _, i in ipairs(nonCraftSlots) do
  16.         if turtle.getItemCount(i) > 0 then
  17.             turtle.dropDown()
  18.         end
  19.     end
  20.     if not failed then
  21.         turtle.craft()
  22.         for i=1, 16 do
  23.             detail = turtle.getItemDetail(i)
  24.             if detail and detail.name == "minecraft:iron_block" then
  25.                 turtle.select(i)
  26.                 turtle.drop()
  27.             end
  28.         end
  29.     elseif failed then
  30.         sleep(5)
  31.     end
  32. end
Advertisement
Add Comment
Please, Sign In to add comment