Simplified Turbine connection logic

This commit is contained in:
Robert S 2014-06-08 09:11:44 -04:00
parent 14971d9747
commit d76f41a148

View file

@ -1,8 +1,6 @@
package resonantinduction.mechanical.energy.turbine; package resonantinduction.mechanical.energy.turbine;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import resonant.api.grid.INodeProvider;
import resonantinduction.core.interfaces.IMechanicalNode; import resonantinduction.core.interfaces.IMechanicalNode;
import resonantinduction.mechanical.energy.grid.MechanicalNode; import resonantinduction.mechanical.energy.grid.MechanicalNode;
@ -24,19 +22,7 @@ public class TurbineNode extends MechanicalNode
@Override @Override
public boolean canConnect(ForgeDirection from, Object source) public boolean canConnect(ForgeDirection from, Object source)
{ {
if (source instanceof MechanicalNode && !(source instanceof TileTurbine)) return source instanceof MechanicalNode && !(source instanceof TurbineNode) && from == turbine().getDirection().getOpposite();
{
/** Face to face stick connection. */
TileEntity sourceTile = position().translate(from).getTileEntity(turbine().getWorld());
if (sourceTile instanceof INodeProvider)
{
MechanicalNode sourceInstance = (MechanicalNode) ((INodeProvider) sourceTile).getNode(MechanicalNode.class, from.getOpposite());
return sourceInstance == source && from == turbine().getDirection().getOpposite();
}
}
return false;
} }
@Override @Override