Advertisement
rhn

Gourmaryllis

rhn
Apr 26th, 2020
1,401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.81 KB | None | 0 0
  1. foods={"minecraft:carrot","minecraft:cooked_chicken","minecraft:pumpkin_pie","minecraft:bread","minecraft:baked_potato","minecraft:melon"}
  2. time={1.5, 3, 4, 2.5, 2.5, 1}
  3.  
  4. lastfed=0
  5.  
  6. inv=peripheral.wrap("top")
  7. while true do
  8.  
  9. canfeed=false
  10. for j=1,#foods do
  11.     for i=1,inv.size() do
  12.         slotmeta=inv.getItemMeta(i)
  13.         if slotmeta~=nil and slotmeta.name==foods[j] and turtle.getItemCount(j)<1 then
  14.                 inv.pushItems("down",i,1,j)
  15.                 break
  16.         end
  17.     end
  18. end
  19. for i=1,#foods do
  20.     if turtle.getItemCount(i)>0 and lastfed~=i then
  21.         canfeed=true
  22.         break
  23.     end
  24. end
  25. if canfeed then
  26.     for j=1,#foods do
  27.         if lastfed~=j and turtle.getItemCount(j)>0 then
  28.             turtle.select(j)
  29.             turtle.dropDown(1)
  30.             lastfed=j
  31.             sleep(time[j]+1)
  32.             --break
  33.         end
  34.     end
  35. else
  36.     sleep(10)
  37. end
  38.  
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement