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:
    • rowHeight

      private int rowHeight
    • outputStream

      private final DataOutputStream outputStream
    • bytes

      private final byte[] bytes
    • width

      private final int width
    • height

      private final int height
    • file

      private File file
  • Constructor Details

    • Screenshot

      public Screenshot(File pGameDirectory, int pWidth, int pHeight, int pRowHeight) throws IOException
      Throws:
      IOException
  • Method Details

    • grab

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

      public static void grab(File pGameDirectory, @Nullable String pScreenshotName, RenderTarget pBuffer, Consumer<Component> pMessageConsumer)
      Saves a screenshot in the game directory with the given file name (or null to generate a time-stamped name).
    • _grab

      private static void _grab(File pGameDirectory, @Nullable String pScreenshotName, RenderTarget pBuffer, Consumer<Component> pMessageConsumer)
    • takeScreenshot

      public static NativeImage takeScreenshot(RenderTarget pFramebuffer)
    • 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.
    • addRegion

      public void addRegion(ByteBuffer pBuffer, int pWidth, int pHeight, int pRowWidth, int pRowHeight)
    • saveRow

      public void saveRow() throws IOException
      Throws:
      IOException
    • close

      public File close() throws IOException
      Throws:
      IOException