Advertisement
zPandro

stoneBricksCrafter

Jun 23rd, 2021 (edited)
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.94 KB | None | 0 0
  1. local SLOT_COUNT = 16
  2. local CRAFT_SLOTS = {1, 2, 5, 6}
  3.  
  4. function getItemIndex(itemName)
  5.     for slot = 1, SLOT_COUNT, 1 do
  6.         local item = turtle.getItemDetail(slot)
  7.         if(item ~= nil) then
  8.             if(item["name"] == itemName) then
  9.                 return slot
  10.             end
  11.         end
  12.     end
  13.     return 17
  14. end
  15.  
  16. function lookForSb()
  17.     if (getItemIndex("minecraft:stone_bricks") < 16 ) then
  18.         return true
  19.     else
  20.         return false
  21.     end
  22. end
  23.  
  24. while true do
  25.     turtle.select(1)
  26.     for slot = 1, 4, 1 do
  27.         turtle.select(CRAFT_SLOTS[slot])
  28.         turtle.suckUp()
  29.     end
  30.     turtle.craft(64)
  31.  
  32.     -- Looks for stone bricks in the turtle inv
  33.     -- and drops them into a storage in front of it
  34.     while lookForSb() do
  35.         sbSlot = getItemIndex("minecraft:stone_bricks")
  36.         if (sbSlot < 16) then
  37.             turtle.select(sbSlot)
  38.             turtle.drop()
  39.         end
  40.     end
  41. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement