Skip to content

Commit

Permalink
Add ME hatch 'connect to any side' copying
Browse files Browse the repository at this point in the history
  • Loading branch information
RecursivePineapple committed Jan 24, 2025
1 parent 64ee7e4 commit cb665fb
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import gregtech.api.enums.VoidingMode;
import gregtech.api.interfaces.IConfigurationCircuitSupport;
import gregtech.api.interfaces.IDataCopyable;
import gregtech.api.interfaces.IMEConnectable;
import gregtech.api.interfaces.metatileentity.IConnectable;
import gregtech.api.interfaces.metatileentity.IFluidLockable;
import gregtech.api.interfaces.metatileentity.IItemLockable;
Expand Down Expand Up @@ -81,6 +82,7 @@ public class GTAnalysisResult implements ITileAnalysisIntegration {
private static final short GT_MULTI_BATCH_MODE = (short) (0b1 << counter++);
private static final short GT_MULTI_INPUT_SEPARATION = (short) (0b1 << counter++);
private static final short GT_MULTI_RECIPE_LOCK = (short) (0b1 << counter++);
private static final short GT_ME_CONNECT_ALL_SIDES = (short) (0b1 << counter++);

private static final GTAnalysisResult NO_OP = new GTAnalysisResult();

Expand Down Expand Up @@ -247,6 +249,10 @@ public GTAnalysisResult(IGregTechTileEntity igte) {
if (mte instanceof MTEHatchDynamoTunnel dynamo) {
mAmperes = dynamo.Amperes;
}

if (mte instanceof IMEConnectable me && me.connectsToAllSides()) {
mGTFlags |= GT_ME_CONNECT_ALL_SIDES;
}
}

@Override
Expand Down Expand Up @@ -436,6 +442,10 @@ public boolean apply(IBlockApplyContext ctx) {
if (mte instanceof MTEHatchDynamoTunnel dynamo) {
dynamo.Amperes = MMUtils.clamp(mAmperes, 0, dynamo.maxAmperes);
}

if (mte instanceof IMEConnectable me) {
me.setConnectsToAllSides((mGTFlags & GT_ME_CONNECT_ALL_SIDES) != 0);
}
}

return true;
Expand Down

0 comments on commit cb665fb

Please sign in to comment.