Advertisement
tsargothruneclaw

Mob Grinder Sorting

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