Skip to content

Instantly share code, notes, and snippets.

@auxiliary-character
Last active August 29, 2015 14:04
Show Gist options
  • Save auxiliary-character/a5e0822b7143c4efd93c to your computer and use it in GitHub Desktop.
Save auxiliary-character/a5e0822b7143c4efd93c to your computer and use it in GitHub Desktop.
--Based on /u/ThatParadox's code. http://redd.it/2atn8f
--To use:
--pastebin get nD6eVHwy startup
for _,side in pairs(rs.getSides()) do
if peripheral.getType(side) == "ender_chest" then
chest = peripheral.wrap(side)
print("Found chest on "..side.." side.")
break
end
end
--Note that I probably wouldn't use the infinite loop, and I"d
--throw a sleep in there for the sake of the server I play on.
--Of course, it depends on rules, suggestions, and ultimately
--how good your server is.
while true do
for channel=0,4095 do
chest.setFrequency(channel)
chest.condenseItems() --Dirty hack, #chest.getAllStacks() returns 0 if there isn't a stack in the first slot, even if there are other stacks.
if #chest.getAllStacks()>0 then
print("Found items in:", chest.getColorNames())
for slot=1,chest.getInventorySize() do
chest.pushItem("down",slot)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment