if (intellicutPart == null) {
return true;
}
Connection connection = null;
PartConnectable part = intellicutPart.getPartConnectable();
if (intellicutMode == IntellicutMode.PART_INPUT) {
// Figure out if we should connect the gem by burning it or by just connecting it.
// We want to perform whatever action results in the highest type closeness.
AutoburnInfo autoburnInfo = AutoburnLogic.getAutoburnInfo(part.getType(), dGem.getGem(), gemCutter.getTypeCheckInfo());
AutoburnUnifyStatus burnStatus = autoburnInfo.getAutoburnUnifyStatus();
boolean attemptToConnect = burnStatus.isAutoConnectable();
if (burnStatus == AutoburnUnifyStatus.UNAMBIGUOUS) {
// Perform the burn if it is unambiguous.
attemptToConnect = autoburnGem(dGem, autoburnInfo);
} else if (burnStatus == AutoburnUnifyStatus.UNAMBIGUOUS_NOT_NECESSARY) {
// Only burn it if that is better than not burning it.
int noBurnTypeCloseness = TypeExpr.getTypeCloseness(part.getType(), dGem.getGem().getOutputPart().getType(), gemCutter.getPerspective().getWorkingModuleTypeInfo());
if (autoburnInfo.getMaxTypeCloseness() > noBurnTypeCloseness) {
attemptToConnect = autoburnGem(dGem, autoburnInfo);
}
}