Skip to content

Add a new gt_machine driver for oc#199

Closed
czqwq wants to merge 1 commit into
masterfrom
new-driver
Closed

Add a new gt_machine driver for oc#199
czqwq wants to merge 1 commit into
masterfrom
new-driver

Conversation

@czqwq

@czqwq czqwq commented Jun 6, 2026

Copy link
Copy Markdown

Change Summary: Restoring GT Machine Driver and Enhancing OC Integration

Root Cause

The gt_machine driver was previously removed from the codebase, leaving only gt_energyContainer (DriverEnergyContainer.java), which exposes only energy-related methods. As a result, scripts controlling GT machines such as the Black Hole Compressor could not function because required callbacks like getName, setWorkAllowed, getWorkProgress, and getWorkMaxProgress do not exist in gt_energyContainer.

Implemented Changes

Change 1 – New DriverGTMachine.java

  • Path: OpenComputers/src/main/scala/li/cil/oc/integration/gregtech/DriverGTMachine.java

  • Purpose: Provides a dedicated OC driver for all GT machine blocks that implement IGregTechTileEntity (including the Black Hole Compressor controller).

  • Exposed Lua callbacks:

Callback | Description -- | -- getName() | Returns the machine's registry name (e.g., multimachine.blackholecompressor) setWorkAllowed(bool) | Enables/disables machine operation isWorkAllowed() | Queries whether work is allowed getWorkProgress() | Current recipe progress (in ticks) getWorkMaxProgress() | Total ticks required for the current recipe isActive() | Whether the machine is actively running
  • Priority: Driver priority set to 0 (higher than DriverEnergyContainer's -1). Thus GT machines appear as component type gt_machine in the OC network, while energy methods (merged from DriverEnergyContainer) remain available.

Change 2 – Registration in ModGregtech.scala

Adds the new driver to OC’s driver registry:

scala
Driver.add(new DriverGTMachine)

Final Result

  • Full functionality restored for the Black Hole Compressor and similar GT machines that depend on work state and progress queries.

  • Scripts can access both machine control methods (via gt_machine) and energy methods without extra adaptation.

  • Priority mechanism ensures backward compatibility; existing energy container drivers remain unaffected.

fixes GTNewHorizons/GT-New-Horizons-Modpack#25071

@czqwq czqwq added the Affects Balance Change affecting balance. Requires admin approval before merging. label Jun 6, 2026

@PLASMAchicken PLASMAchicken left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for the AI generated PR, this takes wrong assumptions and does not fix the cause ( see GTNewHorizons/GT-New-Horizons-Modpack#25071 )

@PLASMAchicken PLASMAchicken deleted the new-driver branch June 6, 2026 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Affects Balance Change affecting balance. Requires admin approval before merging. AI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New version of GT seems like broken opencomputer adapter

2 participants