Advertisement
DYankee

Inventory management test

Dec 14th, 2020 (edited)
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. local Slot_Count = 16
  2. local width, depth, height = 10, 10, 2
  3.  
  4. DROPPED_ITEMS = {
  5. "minecraft:stone",
  6. "minecraft:dirt",
  7. "minecraft:cobblestone",
  8. "minecraft:sand",
  9. "minecraft:gravel",
  10. "minecraft:flint",
  11. "minecraft:dye",
  12. "forestry:apatite"
  13. }
  14.  
  15.  
  16. function Drop_Items()
  17. print("Droping trash...")
  18. for SlotNum = 1, Slot_Count, 1 do
  19. local Item = turtle.getItemDetail(SlotNum)
  20. if(Item ~= nil) then
  21. for FilterIndex = 1, #DROPPED_ITEMS, 1 do
  22. if(Item["name"] == DROPPED_ITEMS[FilterIndex]) then
  23. print("Droppign - " .. Item["name"])
  24. turtle.select(SlotNum)
  25. turtle.dropDown()
  26. end
  27. end
  28. end
  29. end
  30. end
  31. function GetEnderIndex()
  32. for SlotNum = 1, Slot_Count, 1 do
  33. local Item = turtle.getItemDetail(SlotNum)
  34. if(Item ~=nil) then
  35. if(Item["name"] == "enderstorage:ender_storage") then
  36. return SlotNum
  37. end
  38. end
  39. end
  40. end
  41.  
  42.  
  43. function manageInventory()
  44. Index = GetEnderIndex()
  45. if(Index ~= nil) then
  46. turtle.select(Index)
  47. turtle.digUp()
  48. turtle.placeUp()
  49. end
  50. -- ender chest deployed
  51. for SlotNum = 1, Slot_Count, 1 do
  52. local Item = turtle.getItemDetail(SlotNum)
  53. if(Item ~=nil) then
  54. if(Item["name"] ~= "minecraft:coal_block" and Item["name"] ~= "minecraft:coal") then
  55. turtle.select(SlotNum)
  56. turtle.dropUp()
  57. end
  58. end
  59. end
  60. -- Items are stored
  61. turtle.digUp()
  62. end
  63.  
  64. manageInventory()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement