Advertisement
tsargothruneclaw

Untitled

Sep 17th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Peripherals
  2.  
  3. chest = peripheral.wrap("bottom")
  4.  
  5. -- Functions
  6.  
  7. function Condense()
  8.     return chest.condenseItems()
  9. end
  10.  
  11. function Condenser(x)
  12.     return chest.pushItem("east",x)
  13. end
  14.  
  15. function isEnchanted(x)
  16.     item=chest.getStackInSlot(x)
  17.     if (item["name"]=="enchanted_book") then return true else return false end
  18. end
  19.  
  20. function maxSlots()
  21.     return chest.getInventorySize()-1
  22. end
  23.  
  24. function isNotDamaged(x)
  25.     item=chest.getStackInSlot(x)
  26.     if(item["dmg"]==0) then return true else return false end
  27. end
  28.  
  29. while true do
  30.     Condense()
  31.     for count=1, maxSlots(), 1 do
  32.         item=chest.getStackInSlot(count)
  33.         if(type(item)=='table') then
  34.             if (isNotDamaged(count)) then
  35.                 print ("Item #"..count.." is NOT damaged")
  36.                 if (isEnchanted(count)) then
  37.                         print ("Item #"..count.." is Enchanted")
  38.                 elseif (item["name"] ~= "item.pe_repair_talisman") then
  39.                         Condenser(count)
  40.                 end
  41.             else
  42.                 print("Item #"..count.." IS damaged")
  43.             end
  44.         end
  45.     end
  46.     sleep(5)
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement