Apparently, calling PartResourceLibrary.Instance.GetDefinition(resource).id; causes a typeload error. Temporary workaround until I figure out a better way to fix that problem.