CC: Tweaked · Setup guide · Advanced
How to Build a CC: Tweaked Storage Network & Auto-Crafting System
In this advanced guide, you will build a centralized item storage network and an on-demand auto-crafting system using CC: Tweaked's Wired Modems, Advanced Computers, and Crafty Turtles. By leveraging the native inventory peripheral methods in Lua, you can create a zero-RF digital storage solution that rivals dedicated logistics mods while giving you total programmable control over every item slot.
What you need
- 1x Advanced Computer (serves as the master controller and search terminal)
- 1x Crafty Turtle (or more for parallel crafting)
- Many Chests or Barrels (for bulk storage) plus 1x distinct Buffer Chest (e.g., an Ender Chest or Trapped Chest) for player input/output
- Wired Modems (1 for every storage container, 1 for the Buffer Chest, 1 for the Crafty Turtle, and 1 for the Advanced Computer)
- Networking Cable (enough to connect all Wired Modems into one continuous backbone)
- Basic familiarity with Lua tables, loops, and the CraftOS shell (`edit` command)
Step by step
1Construct the Physical Storage Grid
Place your bulk storage Barrels or Chests in a compact wall or tower, leaving space behind them for cabling. Attach a Wired Modem directly to the back of every single container by shift-right-clicking. Connect all these modems together using Networking Cable, then right-click each Wired Modem so its outer ring turns red; CraftOS will print the unique peripheral name (such as `minecraft:barrel_0`) in your chat.
Tip: Barrels are vastly preferred over standard Chests because they do not merge into double blocks and can be stacked tightly without locking adjacent lids.
2Install the Terminal and Player Buffer Chest
At the front of your base, place your Advanced Computer and an accessible Buffer Chest right next to each other. Attach Wired Modems to the back of both the computer and this Buffer Chest, connect them into your main Networking Cable line, and right-click both modems to activate them. Write down the exact network name of your Buffer Chest (for example, `minecraft:chest_0`), as it will act as your physical drop-off and pickup window.
Tip: Using a different container type for the Buffer Chest (like a vanilla Chest while your main storage uses Barrels) makes filtering it out in code automatic.
3Integrate the Crafty Turtle Node
Place a Crafty Turtle adjacent to the Networking Cable line and attach a Wired Modem to any side of the turtle. Activate the modem by right-clicking it and record the turtle's assigned network name (such as `turtle_0`). Because turtles cannot have their internal inventory read directly via the generic inventory API, the master computer will push raw ingredients into the turtle using its network name and trigger crafting via Rednet.
Tip: Ensure the Crafty Turtle has no items in its 16 slots before starting; the `turtle.craft()` function fails if unrelated items are cluttering the grid.
4Write the Storage Discovery & Indexing Module
Open the Advanced Computer, run `edit storage.lua`, and write a function that finds all inventories using `peripheral.find('inventory')`. Filter out your Buffer Chest by checking `peripheral.getName(inv) ~= BUFFER_NAME`. Loop through every valid storage container calling `inv.list()`, which returns a table of slots containing `name` and `count`, and aggregate these into a master Lua table mapping item registry names (like `minecraft:iron_ingot`) to their total counts and exact container locations.
Tip: Run your `inv.list()` calls inside `parallel.waitForAll()` functions if your array exceeds 30 barrels; this queries all containers within a single game tick instead of lagging sequentially.
5Code the Item Extraction & Insertion Engine
In `storage.lua`, create a `requestItem(itemName, amount)` function that reads your index table to locate which barrels hold the requested item. For each matching slot, call `sourceBarrel.pushItems(BUFFER_NAME, slot, neededAmount)` and subtract the returned transferred count from your remaining target until satisfied. Similarly, build a `depositAll()` function that loops through `buffer.list()` and pushes every slot into the first bulk barrel that has space.
Tip: `pushItems` and `pullItems` return the exact integer of items actually moved—always use this return value to update your loop counters in case the destination chest fills up mid-transfer.
6Program the Crafty Turtle Listener
Open the Crafty Turtle, determine which side its Wired Modem is attached to, and run `edit startup.lua`. Write a script that opens Rednet on the modem side (`rednet.open('bottom')`, for example) and enters an infinite `while true do` loop waiting for `local id, msg = rednet.receive('autocraft')`. When triggered, the turtle should call `turtle.craft()`, then broadcast a completion reply back to the master computer so the master knows to pull the finished product out of slot 1.
Tip: Because a turtle's 4x4 inventory is larger than a 3x3 crafting grid, your master computer must push ingredients exclusively into turtle slots 1, 2, 3, 5, 6, 7, 9, 10, and 11, leaving column 4 and row 4 completely empty.
7Define Recipes and Craft Dispatch Logic
Back on the Advanced Computer, define a `recipes` table where each key is an output item and its value is a 9-element array mapping to the turtle's 3x3 crafting slots (`{1, 2, 3, 5, 6, 7, 9, 10, 11}`). When you command a craft, make your program verify all ingredients exist in your index, then push each single ingredient from its storage barrel directly to the turtle using `barrel.pushItems(TURTLE_NAME, sourceSlot, 1, targetTurtleSlot)`. Once all slots are loaded, call `rednet.send(turtleID, 'craft', 'autocraft')`, wait for the turtle's confirmation message, and finally call `buffer.pullItems(TURTLE_NAME, 1)` to deliver the crafted item to your pickup chest.
Tip: For multi-item crafts, multiply the pushed count per slot (up to the item's stack limit) so the turtle crafts an entire batch in one `turtle.craft()` operation.
8Build the Interactive Search & Command Loop
Complete `storage.lua` on the Advanced Computer by adding a terminal UI loop that accepts commands like `search <query>`, `get <item> <qty>`, `store`, and `craft <item> <qty>`. Use `string.find(itemName, query)` to match partial item names so typing `iron` displays `minecraft:iron_ingot` along with its current stock. Run the program and test depositing items into the Buffer Chest, running `store`, searching for them, and requesting an auto-craft.
Tip: Use `textutils.pagedTabulate()` to display long search results cleanly without scrolling past the top of the computer screen.
How it works
In CC: Tweaked, any block with an item inventory (such as vanilla Chests, Barrels, Furnaces, and modded crates) automatically acts as a generic `inventory` peripheral when connected to an active Wired Modem. Unlike older versions that required third-party peripheral mods, CC: Tweaked natively exposes methods like `.size()`, `.list()`, `.getItemDetail(slot)`, `.pushItems(toName, fromSlot, limit, toSlot)`, and `.pullItems(fromName, fromSlot, limit, toSlot)` on every inventory on the network.
The true power of the wired network is that items teleport directly between containers through the logic of `.pushItems()` and `.pullItems()` without needing hoppers, pipes, or physical turtle movement. Both the source container and the destination container simply need to exist on the same continuous Networking Cable subnet. Because `.list()` only fetches basic registry names and counts without deep NBT scanning, indexing dozens of barrels takes milliseconds, while `.pushItems()` allows pinpoint slot-to-slot routing—which is what makes loading a Crafty Turtle's exact 3x3 crafting pattern (slots 1–3, 5–7, 9–11) possible over a single cable.
Common mistakes
- Forgetting to activate the Wired Modems: Simply placing a Wired Modem on a barrel and connecting cables does nothing until you right-click the modem itself so the ring turns red and prints the peripheral name in chat.
- Pushing crafting ingredients into Turtle slots 4, 8, or 12–16: A Crafty Turtle has a 4x4 inventory (16 slots), whereas a crafting table is 3x3. If items end up outside the top-left 3x3 sub-grid (slots 1, 2, 3, 5, 6, 7, 9, 10, 11), `turtle.craft()` will fail and return false.
- Using `.getItemDetail()` during the full storage scan: Calling `.getItemDetail()` on every slot fetches heavy NBT/metadata and yields for a full server tick per call, slowing a 50-barrel scan to several seconds. Always use `.list()` for bulk indexing and reserve `.getItemDetail()` for checking individual enchanted or named items.
- Allowing the Buffer Chest to be indexed as bulk storage: If you do not explicitly filter out `BUFFER_NAME` when building your storage pool, the computer will try to store items inside the Buffer Chest itself, creating an infinite deposit loop.
FAQ
Why can't my master computer call `.list()` directly on the Crafty Turtle?
Turtles expose the `turtle` peripheral type on a wired network rather than the generic `inventory` peripheral type. While you cannot call `turtle.list()` remotely from the computer, other inventories CAN push and pull items into or out of the turtle by passing the turtle's network name (e.g., `turtle_0`) to `barrel.pushItems()` or `buffer.pullItems()`.
How do I stop items with custom NBT data (like enchanted books or damaged tools) from merging or getting confused?
The `.list()` method returns an `nbt` hash string alongside `name` and `count` if the item has NBT data. Combine `item.name .. (item.nbt or '')` as your unique index key if you need to distinguish enchanted items from clean ones.
Is there a limit to how many barrels or chests I can connect to one network?
A single wired network can easily handle hundreds of barrels, though you must keep the entire cable network inside loaded chunks. If part of your cable stretches into an unloaded chunk, peripheral names may detach or shift when chunks reload.
Can I do this wirelessly with Ender Modems instead of Wired Modems?
No. Inventory peripheral wrapping and `.pushItems()` / `.pullItems()` item transfers strictly require a physical Wired Modem and Networking Cable connection between the inventories.
By combining CC: Tweaked's native inventory peripheral methods with a Rednet-controlled Crafty Turtle, you now have an expandable, instant-transfer storage and auto-crafting network powered purely by Lua.