Example usage for net.minecraftforge.client.event ScreenshotEvent getScreenshotFile

List of usage examples for net.minecraftforge.client.event ScreenshotEvent getScreenshotFile

Introduction

In this page you can find the example usage for net.minecraftforge.client.event ScreenshotEvent getScreenshotFile.

Prototype

public File getScreenshotFile() 

Source Link

Usage

From source file:vazkii.quark.client.feature.PanoramaMaker.java

License:Creative Commons License

@SubscribeEvent
public void takeScreenshot(ScreenshotEvent event) {
    if (takingPanorama)
        return;//from ww w  . j  av  a2s.co m

    if (GuiScreen.isCtrlKeyDown() && GuiScreen.isShiftKeyDown()
            && Minecraft.getMinecraft().currentScreen == null) {
        takingPanorama = true;
        panoramaStep = 0;

        if (panoramaDir == null)
            panoramaDir = new File(event.getScreenshotFile().getParentFile(), "panoramas");
        if (!panoramaDir.exists())
            panoramaDir.mkdirs();

        int i = 0;
        String ts = getTimestamp();
        do {
            if (fullscreen) {
                if (i == 0)
                    currentDir = new File(panoramaDir + "_fullres", ts);
                else
                    currentDir = new File(panoramaDir, ts + "_" + i + "_fullres");
            } else {
                if (i == 0)
                    currentDir = new File(panoramaDir, ts);
                else
                    currentDir = new File(panoramaDir, ts + "_" + i);
            }
        } while (currentDir.exists());

        currentDir.mkdirs();

        event.setCanceled(true);

        ITextComponent panoramaDirComponent = new TextComponentString(currentDir.getName());
        panoramaDirComponent.getStyle()
                .setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, currentDir.getAbsolutePath()))
                .setUnderlined(true);
        event.setResultMessage(new TextComponentTranslation("quarkmisc.panoramaSaved", panoramaDirComponent));
    }
}

From source file:vazkii.quark.misc.feature.PanoramaMaker.java

License:Creative Commons License

@SubscribeEvent
public void takeScreenshot(ScreenshotEvent event) {
    if (takingPanorama)
        return;//  ww w . jav  a 2s .  co  m

    if (GuiScreen.isCtrlKeyDown() && GuiScreen.isShiftKeyDown()
            && Minecraft.getMinecraft().currentScreen == null) {
        takingPanorama = true;
        panoramaStep = 0;

        if (panoramaDir == null)
            panoramaDir = new File(event.getScreenshotFile().getParentFile(), "panoramas");
        if (!panoramaDir.exists())
            panoramaDir.mkdirs();

        int i = 0;
        String ts = getTimestamp();
        do {
            if (fullscreen) {
                if (i == 0)
                    currentDir = new File(panoramaDir + "_fullres", ts);
                else
                    currentDir = new File(panoramaDir, ts + "_" + i + "_fullres");
            } else {
                if (i == 0)
                    currentDir = new File(panoramaDir, ts);
                else
                    currentDir = new File(panoramaDir, ts + "_" + i);
            }
        } while (currentDir.exists());

        currentDir.mkdirs();

        event.setCanceled(true);
    }
}

From source file:vazkii.quark.vanity.feature.PanoramaMaker.java

License:Creative Commons License

@SubscribeEvent
public void takeScreenshot(ScreenshotEvent event) {
    if (takingPanorama)
        return;//  ww  w  .  jav  a  2  s.  c o m

    if (GuiScreen.isCtrlKeyDown() && GuiScreen.isShiftKeyDown()
            && Minecraft.getMinecraft().currentScreen == null) {
        takingPanorama = true;
        panoramaStep = 0;

        if (panoramaDir == null)
            panoramaDir = new File(event.getScreenshotFile().getParentFile(), "panoramas");
        if (!panoramaDir.exists())
            panoramaDir.mkdirs();

        int i = 0;
        String ts = getTimestamp();
        do {
            if (i == 0)
                currentDir = new File(panoramaDir, ts);
            else
                currentDir = new File(panoramaDir, ts + "_" + i);
        } while (currentDir.exists());

        currentDir.mkdirs();

        event.setCanceled(true);
    }
}