Advertisement
rhn

MobfarmLootbot

rhn
Mar 23rd, 2020
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.36 KB | None | 0 0
  1. trash={"_helmet", "_chestplate", "_leggings", "_boots", "minecraft:bow"}
  2. print("Emptying chest in front of turtle. Drops trash straight down. Deposits items into inventories below turtle 5 rows behind starting point.")
  3. print("Will drop any items down containing: ")
  4. for i=1,#trash do
  5.     print(trash[i])
  6. end
  7. fillcount=0
  8. while true do
  9.     if turtle.getFuelLevel()<100 then
  10.         print("Please refuel me!")
  11.     end
  12.     for i=1,17-fillcount do
  13.         turtle.suck()
  14.     end
  15.     fillcount=0
  16.     for i=1,16 do
  17.         turtle.select(i)
  18.         if turtle.getItemCount(i)>0 then
  19.             data = turtle.getItemDetail(i)
  20.             for j=1,#trash do
  21.                 if string.find(data.name,trash[j]) then
  22.                     turtle.dropDown()
  23.                     fillcount=fillcount-1
  24.                 elseif string.find(data.name,"minecraft:coal") then
  25.                     if turtle.getFuelLevel()<10000 then
  26.                     turtle.refuel()
  27.                     fillcount=fillcount-1
  28.                     print("Refueled to: "..turtle.getFuelLevel())
  29.                     end
  30.                 end
  31.             end
  32.             fillcount=fillcount+1
  33.             --print("fillcount="..fillcount)
  34.         end
  35.     end
  36.  
  37.     if fillcount>15 then
  38.    
  39.         for i=1,5 do
  40.             emco=0
  41.             turtle.back()
  42.  
  43.             for i=1,16 do
  44.                 turtle.select(i)
  45.                 turtle.dropDown()
  46.                 if turtle.getItemCount(i)==0 then
  47.                     emco=emco+1
  48.                     --print("emco="..emco)
  49.                 end
  50.             end
  51.             if emco>15 then
  52.                 break
  53.             end
  54.         end
  55.         for i=1,5 do
  56.             turtle.forward()
  57.         end
  58.         fillcount=0
  59.         --print("Reset")
  60.     end
  61.     sleep(50)
  62. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement