Advertisement
TheIncgi

Pick Item code

Jan 22nd, 2019
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.02 KB | None | 0 0
  1. --For use with the Advanced Macros Minecraft mod
  2. function HarvestTree.selectItem(sitem, prefSlot, optInv)
  3.   return HarvestTree.selectItemD(sitem, -1, prefSlot, optInv)
  4. end
  5. --select with damage value
  6. function HarvestTree.selectItemD(sitem, sdmg, prefSlot, optInv)
  7.   local inv = optInv or openInventory()
  8.   local map = inv.mapping.inventory
  9.   prefSlot = prefSlot or 1
  10.  
  11.   for i,j in pairs(map.hotbar) do
  12.     local item = inv.getSlot(j)
  13.     if item and( item.id==sitem and( sdmg==-1 or sdmg==item.dmg)) then
  14.      
  15.       setHotbar(i)
  16.       return j
  17.     end
  18.   end
  19.   for i,j in pairs(map.main) do
  20.     local item = inv.getSlot( j )
  21.     if item and (item.id==sitem and( sdmg==-1 or sdmg==item.dmg))  then
  22.       setHotbar(prefSlot)
  23.       local p = map.hotbar[prefSlot]
  24.       inv.click(j)
  25.       sleep(40)
  26.       inv.click(p)
  27.       sleep(40)
  28.       if inv.getHeld() then
  29.         inv.click(j)
  30.         sleep(40)
  31.       end
  32.       if not optInv then inv.close() end
  33.       return prefSlot
  34.     end
  35.  
  36.   end
  37.   return false
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement