t0x1c_adr1an

Send

Apr 20th, 2021 (edited)
607
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --- CC
  2. function to_set(a_table)
  3.     local a_set = {}
  4.     for i in pairs(a_table) do
  5.         a_set.i = a_table[i]['name']
  6.     end
  7.     return a_set
  8. end
  9.  
  10. function tostring (set)
  11.   local s = "{"
  12.   local sep = ""
  13.   for e in pairs(set) do
  14.     s = s .. sep .. e
  15.     sep = ", "
  16.   end
  17.   return s .. "}"
  18. end
  19.  
  20. function drop(compare)
  21.     if compare == false then
  22.         for x=2,16 do
  23.             print(x)
  24.             turtle.select(x)
  25.             turtle.drop()
  26.         end
  27.     else
  28.         local chest =  peripheral.wrap('front')
  29.         tostring(to_set(chest.list()))
  30.         for i in pairs(to_set(chest.list())) do
  31.             for x=2,16 do
  32.                 turtle.select(x)
  33.                  if chest.list()[i] ~= nil and turtle.getItemDetail()
  34.                 ['name'] ~= nil then
  35.                     if chest.list()[i]['name'] ==
  36.                             turtle.getItemDetail()['name'] then
  37.                         turtle.drop()
  38.                     end
  39.                 end
  40.             end
  41.         end
  42.     end
  43.  
  44.     turtle.select(1)
  45.     if turtle.getItemDetail()['name'] == 'minecraft:coal' then
  46.         turtle.refuel()
  47.     end
  48. end
  49. drop(true)
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×