MayaTheShy 4be2d7be8f fix: replace sleep(0) with os.pullEvent() + add diagnostic logging
sleep(0) wakes the processor only on timer ticks, causing a
1-tick delay. os.pullEvent() with no filter wakes the processor
on ANY event — including the modem_message that triggered the
capture — so items are processed in the same event cycle.

Added logging to capture and processor tasks:
- NET-CAP: logs each queued message with type and queue depth
- NET-PROC: logs each message being processed
- Both log on startup to confirm they're running
2026-03-29 00:02:07 -04:00
2026-03-22 17:18:33 -04:00
2026-03-15 15:05:01 -04:00
2026-03-15 15:05:27 -04:00

Inventory-Manager-CC

A Minecraft inventory management system built on CC:Tweaked. Automates storage sorting, smelting, crafting, and item dispensing across networked computers, turtles, and peripherals — with an optional web dashboard for remote monitoring and control.

Architecture

┌──────────────────────────────────────────────────────────────┐
│                      Minecraft World                         │
│                                                              │
│  ┌──────────────────────┐     modem channels 4200-4204       │
│  │  inventoryManager.lua │◄──────────────────────┐           │
│  │   (master computer)   │───────────────────────┤           │
│  └──────┬───────────────┘                        │           │
│         │ peripherals                            │           │
│   ┌─────┴──────┬───────────┐          ┌──────────┴────────┐  │
│   │  chests /  │ furnaces  │          │ inventoryClient   │  │
│   │  barrels   │ smokers   │          │  (display client) │  │
│   │            │ blasters  │          └───────────────────┘  │
│   └────────────┴───────────┘                                 │
│  ┌──────────────────┐  ┌────────────────────┐                │
│  │ craftingTurtle.lua│  │dropperController   │                │
│  │  (auto-craft)     │  │  (redstone pulses) │                │
│  └──────────────────┘  └────────────────────┘                │
│  ┌──────────────────────┐         HTTP                       │
│  │ inventoryWebBridge.lua│─────────────────┐                 │
│  └──────────────────────┘                  │                 │
└────────────────────────────────────────────┼─────────────────┘
                                             ▼
                                  ┌──────────────────┐
                                  │  Web Server :3001 │ ◄── SQLite
                                  └────────┬─────────┘
                                           │ WebSocket + REST
                                  ┌────────▼─────────┐
                                  │ React Dashboard   │ (port 80)
                                  └──────────────────┘

Components

In-Game (Lua)

File Role Description
inventoryManager.lua Master Controller The brain — scans all networked chests, auto-sorts/defrags items, auto-smelts ores and food, dispatches crafting jobs, manages composting, fires alerts on low stock, and broadcasts state on modem channel 4200. Requires an attached monitor and wired modem.
inventoryClient.lua Display Client A read-only dashboard that mirrors the master's state on a separate monitor. Supports search, pagination, and sending item orders back to the master.
craftingTurtle.lua Crafting Worker Runs on a Crafting Turtle. When the master places ingredients in its grid, it auto-crafts and reports results. Must be connected to the master via wired network.
dropperController.lua Dropper Driver Pulses redstone to fire items out of a dropper block until empty. Runs on a computer adjacent to the dropper.
inventoryWebBridge.lua Web Bridge Bridges the in-game modem network to the external web server over HTTP/WebSocket. Forwards state from the master and relays commands from the web dashboard back into the game.
miningTurtle.lua Mining Turtle Runs on a mining turtle connected to the wired network. Continuously mines downward, auto-dumps inventory to networked storage, auto-refuels from storage, and triggers master scans after dumping.
listDevicesByType.lua Diagnostic Utility Lists all peripherals on the wired network grouped by type. Useful for discovering connected chests, furnaces, etc.
autorun/startup.lua Opus Autorun Auto-detects the computer's role from config files and launches the appropriate program. For use with Opus OS.

Web Stack (Docker)

Component Description
Server (web/server/) Express + WebSocket API backed by SQLite. Receives state from the Lua bridge, persists item history, and pushes real-time updates to browser clients.
Client (web/client/) React SPA (Vite + Zustand) served via Nginx. Tabbed panels for inventory grid, smelting, crafting, analytics, alerts, and settings.
Docker Compose Orchestrates server and client containers on an internal bridge network. Only port 80 is exposed; the Nginx client proxies API/WS requests to the server.

Quick Start

Prerequisites

  • Minecraft with CC:Tweaked installed
  • Opus OS installed on all CC:Tweaked computers (required for the UI framework)
  • A CC:Tweaked computer with a wired modem and monitor attached
  • HTTP access enabled in the CC:Tweaked config (for the web bridge)

On any CC:Tweaked computer running Opus, open the shell and run:

package install inventory-manager

An interactive setup wizard will guide you through role selection (Manager, Client, Web Bridge, or Mining Turtle) and peripheral configuration. The package installs all required files and an autorun script that launches the correct program on boot. Reboot after installation.

To update later:

package update inventory-manager

2. Start the Web Dashboard (Optional)

On the host machine, navigate to the web/ directory and run:

docker compose up -d --build

The dashboard will be available at http://localhost on port 80.

Manual Install (Without Opus)

If you are not using Opus, you can install individual components with wget. Note that the monitor dashboard requires the Opus UI framework (opus.ui), so Opus is still needed on computers with monitors.

Click to expand manual install instructions

Master Controller

On your main CC:Tweaked computer (with the monitor and wired modem):

wget https://git.spatulaa.com/MayaTheShy/Inventory-Manager-CC/raw/branch/main/startup/manager.lua startup.lua

Display Client

On a separate CC:Tweaked computer with a monitor:

wget https://git.spatulaa.com/MayaTheShy/Inventory-Manager-CC/raw/branch/main/startup/client.lua startup.lua

Crafting Turtle

On a Crafting Turtle connected to the wired network:

wget https://git.spatulaa.com/MayaTheShy/Inventory-Manager-CC/raw/branch/main/startup/turtle.lua startup.lua

Mining Turtle

On a Mining Turtle connected to the wired network:

wget https://git.spatulaa.com/MayaTheShy/Inventory-Manager-CC/raw/branch/main/startup/miner.lua startup.lua

Web Bridge

On any CC:Tweaked computer with a wired modem and HTTP access:

wget https://git.spatulaa.com/MayaTheShy/Inventory-Manager-CC/raw/branch/main/startup/bridge.lua startup.lua

These startup scripts auto-download all required files from the repository before launching.

Modem Channels

Channel Purpose
4200 Master → Clients/Bridge (state broadcast)
4201 Clients/Bridge → Master (orders & commands)
4202 Master → Client (order/craft result replies)
4203 Master → Crafting Turtle (craft requests)
4204 Crafting Turtle → Master (craft results)
4205 System channel (remote reboot all computers)

Startup Scripts

The startup/ directory contains self-updating startup scripts that download the latest code from the git repository before launching. These are used by the manual install method above and can also be used standalone:

Script Role
startup/manager.lua Master controller with auto-update for all manager modules
startup/client.lua Client with auto-update, first-run setup wizard, and optional dropper
startup/turtle.lua Crafting turtle with auto-update
startup/bridge.lua Web bridge with auto-update
startup/miner.lua Mining turtle with auto-update

License

See LICENSE for details.

Description
No description provided
Readme GPL-3.0 3.8 MiB
Languages
Lua 59.2%
JavaScript 31.6%
CSS 8.6%
Dockerfile 0.4%
Shell 0.1%