SHARE
TWEET

compress

a guest Aug 23rd, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. tArgs = {...}
  2.  
  3. --Roles:
  4.   --crafter: Compresses cobblestone/other
  5.   --manager: Holds on to different tiers of compressed cobble/other
  6.  
  7. function craft(count)
  8.    craftingSlots = {2,3,5,6,7,9,10,11}
  9.    amount = count / 9
  10.    for i = 1,8 do
  11.      turtle.transferTo(craftingSlots[i], amount)
  12.    end
  13.    turtle.craft()
  14. end
  15.  
  16. if tArgs[1] == 'crafter' then
  17.   storedDown = 0
  18.   while true do
  19.     sleep(0.1)
  20.     if redstone.getInput('top') == false then
  21.       redstone.setOutput('top', false)
  22.       turtle.suck()
  23.       while turtle.getItemCount(1) < 9 do
  24.         if not (storedDown == 0) then
  25.           turtle.suckDown()
  26.           storedDown = 0
  27.         else
  28.           sleep(0.001)
  29.           turtle.suck()
  30.         end
  31.       end
  32.       count = turtle.getItemCount(1)
  33.       rest = count % 9
  34.       turtle.dropDown(rest)
  35.       storedDown = storedDown + rest
  36.       craft(count - rest)
  37.       redstone.setOutput('top', true)
  38.       while turtle.getItemCount(1) > 0 do sleep(0.001) end
  39.     elseif redstone.getInput('top') == true then
  40.       while turtle.getItemCount(1) == 0 do sleep(0.001) end
  41.       redstone.setOutput('top', false)
  42.       craft(turtle.getItemCount(1))
  43.       redstone.setOutput('top', true)
  44.       while turtle.getItemCount(1) > 0 do sleep(0.001) end
  45.     end
  46.   end
  47. elseif tArgs[1] == 'manager' then
  48.   while true do
  49.     while redstone.getInput('bottom') == false do sleep(0.001) end
  50.     turtle.select(1)
  51.     turtle.suckDown()
  52.     for i = 1,7 do
  53.       count = turtle.getItemCount(i)
  54.       if count >= 10 then
  55.         redstone.setOutput('bottom', true)
  56.         turtle.select(i)
  57.         turtle.dropDown(count - (count % 9))
  58.         sleep(0.1)
  59.         while redstone.getInput('bottom') == false do sleep(0.001) end
  60.         turtle.select(i+1)
  61.         turtle.suckDown()
  62.       end
  63.     end
  64.     redstone.setOutput('bottom', false)
  65.     sleep(0.5)
  66.   end
  67. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top