Okay, thanks for the hint.
However, I couldn't find a tutorial for capes. Geckolib's wiki page didn't help me either. Does anyone know how to do this with capes?
But there are mods in which this is possible. Even in current versions. It is no longer possible to change a cape directly via the function, but it must be possible in some other way.