Kohjin

XPFarm

Nov 3rd, 2023 (edited)
814
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.61 KB | None | 0 0
  1. settings = {
  2.     ["attacks"] = 32,
  3.     ["valuable"] = { "TConstruct:heartCanister", "minecraft:skull", "OpenBlocks:trophy", "Thaumcraft:ItemLootBag", "DraconicEvolution:mobSoul" }
  4. }
  5.  
  6. function inList(list, item)
  7.   for index, value in ipairs(list) do
  8.     if value == item then
  9.       return true
  10.     end
  11.   end
  12.   return false
  13. end
  14.  
  15. function depositItems()
  16.     for i=1, 16 do
  17.         if turtle.getItemCount(i) ~= 0 then
  18.             local data = turtle.getItemDetail(i)
  19.             print("Slot: " .. i .. " | Item: " .. data.name)
  20.        
  21.             turtle.select(i)
  22.             if inList(settings.valuable, data.name) then
  23.  
  24.                 print("Valuable!")
  25.                 turtle.turnRight()
  26.                 turtle.turnRight()
  27.                 turtle.drop()  
  28.                 turtle.turnLeft()
  29.                 turtle.turnLeft()    
  30.  
  31.             elseif data.name == "minecraft:coal" then
  32.  
  33.                 turtle.turnRight()
  34.                 turtle.drop()
  35.                 turtle.turnLeft()
  36.  
  37.             elseif data.name == "minecraft:bone" then
  38.  
  39.                 turtle.turnLeft()
  40.                 turtle.drop()
  41.                 turtle.turnRight()    
  42.  
  43.             else
  44.  
  45.                 print("Garbage!")
  46.                 turtle.dropDown()
  47.  
  48.             end
  49.         end
  50.     end
  51. end
  52.  
  53. while true do
  54.     print("Attacking...")
  55.     for i=1, settings.attacks do
  56.         turtle.attack()
  57.         sleep(0)
  58.     end
  59.    
  60.     print("Collecting... Sorting...")
  61.     turtle.suck()
  62.     turtle.suck()
  63.     turtle.suck()
  64.     turtle.suck()
  65.     depositItems()
  66.    
  67.     turtle.select(1)
  68.     sleep(0)
  69. end
Advertisement
Add Comment
Please, Sign In to add comment