Advertisement
rhn

Kekimurus

rhn
Mar 29th, 2020
1,859
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.70 KB | None | 0 0
  1. inv=peripheral.wrap("top")
  2.  
  3. local function getcake()
  4.     for i=1,inv.size() do
  5.         slotmeta=inv.getItemMeta(i)
  6.         if slotmeta~=nil and slotmeta.name=="minecraft:cake" then
  7.             inv.pushItems("down",i,1,1)
  8.             return
  9.         end
  10.     end
  11. end
  12.  
  13.  
  14. --test if there is cake below, if not then place
  15. while true do
  16.     if turtle.getItemCount(1)<1 then
  17.         getcake()
  18.     end
  19.     local success,blockdata=turtle.inspectDown()
  20.     if blockdata.name ~=nil and string.find(blockdata.name, "minecraft:cake") then
  21.         --print("cake found")
  22.         sleep(1)
  23.     else --place cake
  24.         turtle.select(1)
  25.         turtle.placeDown()
  26.     end
  27. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement