I want to take screenshots when certain events occur, such as reaching a certain coordinate or completing a achievement.
For example, if I get a diamond, I want a screenshot called DIAMONDS.png.
It seems like there should be a class like https://mcstreetguy.github.io/ForgeJavaDocs/1.20.1-latest/net/minecraft/client/Screenshot.html, so it seems like it should be possible in some way, but I don't know how to do it in detail. I tried calling takeScreenshot(), but it didn't work.
Does anyone have a good way to do it?