ScreenshotRunner
Captures the game's framebuffer for the take_screenshot tool.
The render thread's whole contribution is one pixel-array copy; scaling and encoding run on the calling (HTTP) thread, so a screenshot costs the game a texture readback and nothing else. The hop over is pending, not vanilla's own Minecraft#execute: a disconnect clears that queue (dropAllTasks), and a request dropped there leaves its caller waiting for good. A screenshot only reads, so a world being left does not concern it.
JPEG at a fixed size and quality, with nothing exposed to the caller: both are questions only whoever consumes the image can answer, and that is a model with no idea what resolution it can actually see. The cost of getting them wrong is ours, so the numbers are ours.
Loaded on the client only — by the render heartbeat and by the client path — so it never touches client classes on a dedicated server. Minecraft.getInstance() is non-null from mod init on, but half-built until its constructor returns — the hop onto the render thread is what makes that safe, not Lanes.RENDER.isReady, which is a physical-side constant and would not catch a render-state read placed ahead of it.
Types
Pixels as ScreenshotCompat handed them over: ARGB, top-down, row-major — BufferedImage.setRGB's own layout. Filled by the deprecated NativeImage#makePixelArray, used anyway because it is the only whole-image accessor 1.18.2 has; every replacement arrived later than the versions we target.
Properties
Requests waiting for the next frame; only drain takes them, and nothing clears them.
Functions
Scaling on this thread, deliberately: the GPU-side downscale takeScreenshot grew at 1.21.6 would cost a version seam and does not exist on the older nodes.
The long form, because ImageIO.write gives no way to set the quality.