Skip to content

Conversation

@sansiquay
Copy link

Adds ComputerCraft peripheral support to Factory Gauge (Create_FactoryGauge).

Factory Gauge was the only major logistics component without CC support. This enables programmatic factory configuration - reading/writing filters, thresholds, and status without player interaction.

Changes

  • New FactoryGaugePeripheral.java extending SyncedPeripheral
  • Added computerBehaviour field and getCapability() override to FactoryPanelBlockEntity
  • Registered peripheral in ComputerBehaviour.getPeripheralFor()

API

local gauge = peripheral.find("Create_FactoryGauge")

-- Read
gauge.getActivePanels()      -- {"TOP_LEFT", ...}
gauge.getFilter()            -- {name="...", count=1}
gauge.getThreshold()         -- {count=64, mode="items"|"stacks"}
gauge.getNetwork()           -- UUID string
gauge.getStatus()            -- full status object
gauge.isThresholdMet()
gauge.isPromisedMet()
gauge.getLevelInStorage()
gauge.getPromised()
gauge.getAddress()

-- Write
gauge.setFilter("minecraft:iron_ingot")
gauge.setThreshold(64, "items")
gauge.setAddress("A1")
gauge.clearPromises()

All methods accept optional slot parameter (TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT). Defaults to first active panel.

Testing

Place computer next to Factory Gauge, run:

local gauge = peripheral.find("Create_FactoryGauge")
print(textutils.serialize(gauge.getActivePanels()))
print(textutils.serialize(gauge.getFilter()))
gauge.setFilter("minecraft:gold_ingot")
gauge.setThreshold(32, "stacks")
print(textutils.serialize(gauge.getFilter()))  -- should show gold_ingot

Tested on 1.20.1 with CC:Tweaked. All read/write methods verified working.

Adds ComputerCraft peripheral support to Factory Gauge, enabling:
- Reading filter, threshold, network, and status
- Setting filter item programmatically
- Adjusting threshold values and mode
- Multi-panel support (4 slots per block)

Peripheral type: Create_FactoryGauge
return null;
}

FactoryPanelBehaviour panel = blockEntity.panels.get(slot);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pr is awesome and this is a nitpick while nosy-ing around, but since the else statement always return at this point, why not keep this logic in the first if statement and remove the else, just keeps stuff together

@VoidLeech VoidLeech added pr type: feature PR adds a new feature or changes an existing feature pr status: wrong target PR is targeting the wrong branch labels Jan 6, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 6, 2026

@nate123456, this pull request is targeting the wrong branch. Pull requests should target the branch corresponding to the earliest supported Minecraft version unless the changes are specific to code that only exists for a newer Minecraft version. Please change the target branch, resolve any merge conflicts, and leave a message here so we can continue with the process of reviewing and merging this pull request. Thanks!

Move slot lookup logic into if block since else always returns.
Keeps related code together per review feedback.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@sansiquay
Copy link
Author

Factory Gauge (factoryBoard) only exists in mc1.20.1+ - checked mc1.18 and mc1.19 branches and there's no factoryBoard directory. So mc1.20.1/dev is the correct target as far as I could find.

@cakeGit good catch, fixed.

Build failure is Maven Central returning 403 for jgit - not from my changes.

@VoidLeech
Copy link
Collaborator

1.20.1 is no longer supported, so 1.21.1/dev would be the correct branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr status: wrong target PR is targeting the wrong branch pr type: feature PR adds a new feature or changes an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants