Advertisement
mldierks

FIsh Sort

Jan 27th, 2020
501
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.94 KB | None | 0 0
  1. -- Variables --
  2. local tJunkItems = {
  3.     "minecraft:potion",
  4.     "minecraft:leather_boots",
  5.     "minecraft:dirt",
  6.     "minecraft:tripwire_hook",
  7.     "minecraft:rotten_flesh"
  8. }
  9.  
  10. local sItemOutput = "front"
  11. local sJunkOutput = "bottom"
  12.  
  13. local tSideMapping = {
  14.     front  = "drop",
  15.     bottom = "dropDown",
  16.     top    = "dropUp"
  17. }
  18. -- Variables --
  19.  
  20.  
  21. -- Functions --
  22. local function sort()
  23.     local tItem = turtle.getItemDetail()
  24.  
  25.     if not tItem then
  26.         return
  27.     end
  28.  
  29.     for _, v in pairs(tJunkItems) do
  30.         if tItem.name == v then
  31.             turtle[tSideMapping[sJunkOutput]]()
  32.             return
  33.         end
  34.     end
  35.  
  36.     turtle[tSideMapping[sItemOutput]]()
  37. end
  38. -- Functions --
  39.  
  40.  
  41. -- Main Program --
  42. local e
  43.  
  44. while true do
  45.     e = {os.pullEvent()}
  46.  
  47.     if e[1] == "char" and e[2]:lower() == "q" then
  48.         break
  49.     elseif e[1] == "turtle_inventory" then
  50.         sort()
  51.     end
  52. end
  53. -- Main Program --
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement