Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ME hatch 'connect to any side' copying #21

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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