Class Screenshot

java.lang.Object
net.minecraft.client.Screenshot

public class Screenshot extends Object
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • SCREENSHOT_DIR

      public static final String SCREENSHOT_DIR
      See Also:
  • Constructor Details

    • Screenshot

      public Screenshot()
  • Method Details

    • grab

      public static void grab(File pGameDirectory, RenderTarget pRenderTarget, Consumer<Component> pMessageConsumer)
      Saves a screenshot in the game directory with a time-stamped filename.
    • grab

      public static void grab(File pGameDirectory, @Nullable String pFilename, RenderTarget pRenderTarget, int pDownscaleFactor, Consumer<Component> pMessageConsumer)
    • takeScreenshot

      public static void takeScreenshot(RenderTarget pRenderTarget, Consumer<NativeImage> pWriter)
    • takeScreenshot

      public static void takeScreenshot(RenderTarget pRenderTarget, int pDownscaleFactor, Consumer<NativeImage> pWriter)
    • getFile

      private static File getFile(File pGameDirectory)
      Creates a unique PNG file in the given directory named by a timestamp. Handles cases where the timestamp alone is not enough to create a uniquely named file, though it still might suffer from an unlikely race condition where the filename was unique when this method was called, but another process or thread created a file at the same path immediately after this method returned.