What you will end up with
A program that reads the contents of an input chest and distributes each item type into a designated output chest. You define the routing rules in the script — it is simple to expand as your storage grows.
What you need
- A Computer (from CC:Tweaked)
- At least two Chests (vanilla or modded) placed adjacent to the computer
- Items in the input chest to test with
"top", "bottom", "left", "right",
"front", or "back".
Step 1 — Check what is in a chest
Place a chest on the top of the computer, put some items in it, then open the terminal and run this to inspect its contents:
You will see output like 1 minecraft:cobblestone 64.
The item.name field is the full item ID you will use for routing rules.
Step 2 — Move items between two chests
Place a second chest on the bottom of the computer. The following moves everything from the top chest to the bottom chest:
pushItems(targetName, slot) moves the entire stack in slot
from this inventory to the target inventory. Use the optional third argument to
limit how many items to move.
Step 3 — Simple item sorter
The sorter below reads the input chest continuously and moves each item to the
correct output chest based on its name. Extend the routes table
to add more item types.
Useful inventory API methods
chest.list()— returns a table of all items indexed by slotchest.getItemDetail(slot)— returns detailed info for one slotchest.size()— returns total number of slotschest.pushItems(targetName, fromSlot, count, toSlot)— move items outchest.pullItems(sourceName, fromSlot, count, toSlot)— pull items inperipheral.getName(wrapped)— get the peripheral name string
Troubleshooting
- peripheral.wrap() returns nil — make sure the chest is directly adjacent to the computer on the correct side.
- Items not moving — check that the output chest has free slots; a full chest rejects incoming items.
- Wrong item name — use the inspect snippet from Step 1 to get the exact
item.namestring before adding it to the routes table.