Advertisement
BillBodkin

mobFarmSorter

Oct 17th, 2021 (edited)
1,282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.11 KB | None | 0 0
  1. local inChest = peripheral.wrap("ironchest:diamond_chest_11")
  2.  
  3. local hopper = "minecraft:hopper_8"
  4. local cPrefix = "ironchest:obsidian_chest_"
  5.  
  6. local itemChests = {
  7.     ["minecraft:stone_sword"] = hopper,
  8.     ["minecraft:wither_skeleton_skull"] = "enderstorage:ender_chest_11",
  9.     ["minecraft:bone"] = 326,
  10.     ["minecraft:coal"] = 327,
  11.     ["minecraft:gunpowder"] = 328,
  12.     ["minecraft:creeper_head"] = 329
  13. }
  14.  
  15. while true do
  16.     for i = 1, inChest.size() do
  17.         local item = inChest.getItemDetail(i)
  18.         if item ~= nil then
  19.             local gotoChest = cPrefix .. "325"
  20.             if itemChests[item.name] ~= nil then
  21.                 if type(itemChests[item.name]) == "number" then
  22.                     gotoChest = cPrefix .. tostring(itemChests[item.name])
  23.                 else
  24.                     gotoChest = itemChests[item.name]
  25.                 end
  26.             end
  27.             local moved = inChest.pushItems(gotoChest, i, 64)
  28.             if moved < item.count then
  29.                 inChest.pushItems(peripheral.wrap(hopper), i, 64)
  30.             end
  31.         end
  32.         sleep(0)
  33.     end
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement