* @return whether a connection was made
*/
boolean attemptIntellicutAutoConnect(DisplayedPartConnectable part) {
PartInput inPart = null;
PartOutput outPart = null;
// Copy the reference to avoid threading issues.
DisplayedPartConnectable intellicutPartConnectable = intellicutPart;
// Assign the correct parts to inPart and outPart.
if (intellicutPartConnectable instanceof DisplayedPartInput) {
inPart = (PartInput) intellicutPartConnectable.getPartConnectable();
} else if (intellicutPartConnectable instanceof DisplayedPartOutput) {
outPart = (PartOutput) intellicutPartConnectable.getPartConnectable();
}
if (part instanceof DisplayedPartInput) {
inPart = (PartInput) part.getPartConnectable();
} else if (part instanceof DisplayedPartOutput) {
outPart = (PartOutput) part.getPartConnectable();
}
// Check if parts are valid. They maye be burnt, connected or have a null type.
// A null type occurs if parts belong to a broken gem graph.
if (inPart == null || inPart.isBurnt() || inPart.isConnected() || inPart.getType() == null ||
outPart == null || outPart.isConnected() || outPart.getType() == null) {
return false;
}
Gem inGem = inPart.getGem();
Gem outGem = outPart.getGem();
boolean makeIntellicutConnection = false;
// Connection not possible if both parts are from the same gem.
if (outGem != inGem) {