Java 类net.minecraft.util.ScreenShotHelper 实例源码

项目:Zombe-Modpack    文件:Minecraft.java   
public void dispatchKeypresses()
{
    int i = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() + 256 : Keyboard.getEventKey();

    if (i != 0 && !Keyboard.isRepeatEvent())
    {
        if (!(this.currentScreen instanceof GuiControls) || ((GuiControls)this.currentScreen).time <= getSystemTime() - 20L)
        {
            if (Keyboard.getEventKeyState())
            {
                if (i == this.gameSettings.keyBindFullscreen.getKeyCode())
                {
                    this.toggleFullscreen();
                }
                else if (i == this.gameSettings.keyBindScreenshot.getKeyCode())
                {
                    this.ingameGUI.getChatGUI().printChatMessage(ScreenShotHelper.saveScreenshot(this.mcDataDir, this.displayWidth, this.displayHeight, this.framebufferMc));
                }
            }
        }
    }
}
项目:Backmemed    文件:Minecraft.java   
public void dispatchKeypresses()
{
    int i = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() + 256 : Keyboard.getEventKey();

    if (i != 0 && !Keyboard.isRepeatEvent())
    {
        if (!(this.currentScreen instanceof GuiControls) || ((GuiControls)this.currentScreen).time <= getSystemTime() - 20L)
        {
            if (Keyboard.getEventKeyState())
            {
                if (i == this.gameSettings.keyBindFullscreen.getKeyCode())
                {
                    this.toggleFullscreen();
                }
                else if (i == this.gameSettings.keyBindScreenshot.getKeyCode())
                {
                    this.ingameGUI.getChatGUI().printChatMessage(ScreenShotHelper.saveScreenshot(this.mcDataDir, this.displayWidth, this.displayHeight, this.framebufferMc));
                }
            }
        }
    }
}
项目:CustomWorldGen    文件:Minecraft.java   
public void dispatchKeypresses()
{
    int i = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() + 256 : Keyboard.getEventKey();

    if (i != 0 && !Keyboard.isRepeatEvent())
    {
        if (!(this.currentScreen instanceof GuiControls) || ((GuiControls)this.currentScreen).time <= getSystemTime() - 20L)
        {
            if (Keyboard.getEventKeyState())
            {
                if (this.gameSettings.keyBindFullscreen.isActiveAndMatches(i))
                {
                    this.toggleFullscreen();
                }
                else if (this.gameSettings.keyBindScreenshot.isActiveAndMatches(i))
                {
                    this.ingameGUI.getChatGUI().printChatMessage(ScreenShotHelper.saveScreenshot(this.mcDataDir, this.displayWidth, this.displayHeight, this.framebufferMc));
                }
            }
            else if (this.currentScreen instanceof GuiControls) ((GuiControls)this.currentScreen).buttonId = null;
        }
    }
}
项目:Resilience-Client-Source    文件:Minecraft.java   
/**
 * checks if keys are down
 */
private void screenshotListener()
{
    if (this.gameSettings.keyBindScreenshot.isPressed())
    {
        if (!this.isTakingScreenshot)
        {
            this.isTakingScreenshot = true;
            this.ingameGUI.getChatGUI().func_146227_a(ScreenShotHelper.saveScreenshot(this.mcDataDir, this.displayWidth, this.displayHeight, this.mcFramebuffer));
        }
    }
    else
    {
        this.isTakingScreenshot = false;
    }
}
项目:ExpandedRailsMod    文件:Minecraft.java   
public void dispatchKeypresses()
{
    int i = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() + 256 : Keyboard.getEventKey();

    if (i != 0 && !Keyboard.isRepeatEvent())
    {
        if (!(this.currentScreen instanceof GuiControls) || ((GuiControls)this.currentScreen).time <= getSystemTime() - 20L)
        {
            if (Keyboard.getEventKeyState())
            {
                if (this.gameSettings.keyBindFullscreen.isActiveAndMatches(i))
                {
                    this.toggleFullscreen();
                }
                else if (this.gameSettings.keyBindScreenshot.isActiveAndMatches(i))
                {
                    this.ingameGUI.getChatGUI().printChatMessage(ScreenShotHelper.saveScreenshot(this.mcDataDir, this.displayWidth, this.displayHeight, this.framebufferMc));
                }
            }
            else if (this.currentScreen instanceof GuiControls) ((GuiControls)this.currentScreen).buttonId = null;
        }
    }
}
项目:RuneCraftery    文件:Minecraft.java   
/**
 * checks if keys are down
 */
private void screenshotListener()
{
    if (Keyboard.isKeyDown(60))
    {
        if (!this.isTakingScreenshot)
        {
            this.isTakingScreenshot = true;
            this.ingameGUI.getChatGUI().printChatMessage(ScreenShotHelper.saveScreenshot(this.mcDataDir, this.displayWidth, this.displayHeight));
        }
    }
    else
    {
        this.isTakingScreenshot = false;
    }
}
项目:BetterNutritionMod    文件:Minecraft.java   
/**
 * checks if keys are down
 */
private void screenshotListener()
{
    if (Keyboard.isKeyDown(60))
    {
        if (!this.isTakingScreenshot)
        {
            this.isTakingScreenshot = true;
            this.ingameGUI.getChatGUI().printChatMessage(ScreenShotHelper.saveScreenshot(this.mcDataDir, this.displayWidth, this.displayHeight));
        }
    }
    else
    {
        this.isTakingScreenshot = false;
    }
}
项目:Backmemed    文件:EntityRenderer.java   
private void createWorldIcon()
{
    if (this.mc.renderGlobal.getRenderedChunks() > 10 && this.mc.renderGlobal.hasNoChunkUpdates() && !this.mc.getIntegratedServer().isWorldIconSet())
    {
        BufferedImage bufferedimage = ScreenShotHelper.createScreenshot(this.mc.displayWidth, this.mc.displayHeight, this.mc.getFramebuffer());
        int i = bufferedimage.getWidth();
        int j = bufferedimage.getHeight();
        int k = 0;
        int l = 0;

        if (i > j)
        {
            k = (i - j) / 2;
            i = j;
        }
        else
        {
            l = (j - i) / 2;
        }

        try
        {
            BufferedImage bufferedimage1 = new BufferedImage(64, 64, 1);
            Graphics graphics = bufferedimage1.createGraphics();
            graphics.drawImage(bufferedimage, 0, 0, 64, 64, k, l, k + i, l + i, (ImageObserver)null);
            graphics.dispose();
            ImageIO.write(bufferedimage1, "png", (File)this.mc.getIntegratedServer().getWorldIconFile());
        }
        catch (IOException ioexception)
        {
            LOGGER.warn((String)"Couldn\'t save auto screenshot", (Throwable)ioexception);
        }
    }
}
项目:CustomWorldGen    文件:EntityRenderer.java   
private void createWorldIcon()
{
    if (this.mc.renderGlobal.getRenderedChunks() > 10 && this.mc.renderGlobal.hasNoChunkUpdates() && !this.mc.getIntegratedServer().isWorldIconSet())
    {
        BufferedImage bufferedimage = ScreenShotHelper.createScreenshot(this.mc.displayWidth, this.mc.displayHeight, this.mc.getFramebuffer());
        int i = bufferedimage.getWidth();
        int j = bufferedimage.getHeight();
        int k = 0;
        int l = 0;

        if (i > j)
        {
            k = (i - j) / 2;
            i = j;
        }
        else
        {
            l = (j - i) / 2;
        }

        try
        {
            BufferedImage bufferedimage1 = new BufferedImage(64, 64, 1);
            Graphics graphics = bufferedimage1.createGraphics();
            graphics.drawImage(bufferedimage, 0, 0, 64, 64, k, l, k + i, l + i, (ImageObserver)null);
            graphics.dispose();
            ImageIO.write(bufferedimage1, "png", (File)this.mc.getIntegratedServer().getWorldIconFile());
        }
        catch (IOException ioexception)
        {
            LOGGER.warn((String)"Couldn\'t save auto screenshot", (Throwable)ioexception);
        }
    }
}
项目:RemotecraftMod    文件:Core.java   
/**
 * Take screenshot
 * Apparently, it's not possible to call ScreenShotHelper.saveScreenshot() from the NetworkManager thread, so I'm using a flag (mShouldTakeScreenShot)
 */
public void tryGettingScreenshot() {
    if (mShouldTakeScreenShot) {
        mShouldTakeScreenShot = false;
        try {
            ITextComponent chatComponent = ScreenShotHelper.saveScreenshot(mc.mcDataDir.getCanonicalFile(), mc.displayWidth, mc.displayHeight, mc.getFramebuffer());
            String unformattedText = chatComponent.getUnformattedText();
            int size = unformattedText.split(" ").length;
            String fileName = unformattedText.split(" ")[size - 1];
            mManager.sendScreenShot(fileName, mWorld.getSeed());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
项目:DiscordCE    文件:MinecraftEventHandler.java   
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onPlayerDeathImage(GuiOpenEvent e)
{
    EntityPlayer player = Minecraft.getMinecraft().thePlayer;

    if (!(e.getGui() instanceof GuiGameOver)
            || !Config.demiseImage
            || player == null
            || player.getHealth() <= 0F)
        return;

    // Getting discord and minecraft user
    try
    {
        User me = DiscordCE.client.getUserById(DiscordCE.client.getSelfInfo().getId());
        Minecraft mc = Minecraft.getMinecraft();
        ITextComponent t = ScreenShotHelper.saveScreenshot(mc.mcDataDir,
                mc.displayWidth,
                mc.displayHeight,
                mc.getFramebuffer());
        String fileName = new JSONObject(TextComponentBase.Serializer.componentToJson(t)).getJSONArray("with")
                .getJSONObject(0).getJSONObject("clickEvent").getString("value");
        File file = new File(fileName);
        TextChannel c = DiscordCE.client.getTextChannelById(Preferences.i.usingChannel);

        // Doing checks
        if (c == null || !c.checkPermission(me, Permission.MESSAGE_ATTACH_FILES))
            return;

        //Sending file
        c.sendFileAsync(file, null, m -> file.delete());
    }

    catch (Exception e1)
    {
        e1.printStackTrace();
    }
}
项目:AllPI    文件:ClientUtils.java   
/**
 * Takes a screenshot of the player's view (the same as pressing F3), and sends the player a chat notification.
 */
@SideOnly(Side.CLIENT)
public static void takeScreenshot() {
    if(FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
        Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(ScreenShotHelper.saveScreenshot(Minecraft.getMinecraft().mcDataDir, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight, Minecraft.getMinecraft().getFramebuffer()));    
    }
}
项目:ExpandedRailsMod    文件:EntityRenderer.java   
private void createWorldIcon()
{
    if (this.mc.renderGlobal.getRenderedChunks() > 10 && this.mc.renderGlobal.hasNoChunkUpdates() && !this.mc.getIntegratedServer().isWorldIconSet())
    {
        BufferedImage bufferedimage = ScreenShotHelper.createScreenshot(this.mc.displayWidth, this.mc.displayHeight, this.mc.getFramebuffer());
        int i = bufferedimage.getWidth();
        int j = bufferedimage.getHeight();
        int k = 0;
        int l = 0;

        if (i > j)
        {
            k = (i - j) / 2;
            i = j;
        }
        else
        {
            l = (j - i) / 2;
        }

        try
        {
            BufferedImage bufferedimage1 = new BufferedImage(64, 64, 1);
            Graphics graphics = bufferedimage1.createGraphics();
            graphics.drawImage(bufferedimage, 0, 0, 64, 64, k, l, k + i, l + i, (ImageObserver)null);
            graphics.dispose();
            ImageIO.write(bufferedimage1, "png", (File)this.mc.getIntegratedServer().getWorldIconFile());
        }
        catch (IOException ioexception)
        {
            LOGGER.warn((String)"Couldn\'t save auto screenshot", (Throwable)ioexception);
        }
    }
}
项目:RuneCraftery    文件:Minecraft.java   
private void func_71365_K() {
   if(Keyboard.isKeyDown(60)) {
      if(!this.field_71414_F) {
         this.field_71414_F = true;
         this.field_71456_v.func_73827_b().func_73765_a(ScreenShotHelper.func_74291_a(this.field_71412_D, this.field_71443_c, this.field_71440_d));
      }
   } else {
      this.field_71414_F = false;
   }

}
项目:MineCamera    文件:PictureFactory.java   
@SideOnly(Side.CLIENT)
public static BufferedImage getScreenshot() {
    BufferedImage image = ScreenShotHelper.createScreenshot(Minecraft.getMinecraft().displayWidth,
            Minecraft.getMinecraft().displayHeight, Minecraft.getMinecraft().getFramebuffer());
    return image;
}
项目:MineCamera    文件:PictureFactory.java   
@SideOnly(Side.CLIENT)
public static BufferedImage getFormattingScreenshot() {
    BufferedImage image = ScreenShotHelper.createScreenshot(Minecraft.getMinecraft().displayWidth,
            Minecraft.getMinecraft().displayHeight, Minecraft.getMinecraft().getFramebuffer());
    return FormattingPicture(image);
}
项目:BaseClient    文件:Minecraft.java   
public void dispatchKeypresses() {
    int i = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() : Keyboard.getEventKey();

    if (i != 0 && !Keyboard.isRepeatEvent()) {
        if (!(this.currentScreen instanceof GuiControls)
                || ((GuiControls) this.currentScreen).time <= getSystemTime() - 20L) {
            if (Keyboard.getEventKeyState()) {
                if (i == this.gameSettings.keyBindStreamStartStop.getKeyCode()) {
                    if (this.getTwitchStream().isBroadcasting()) {
                        this.getTwitchStream().stopBroadcasting();
                    } else if (this.getTwitchStream().isReadyToBroadcast()) {
                        this.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback() {
                            public void confirmClicked(boolean result, int id) {
                                if (result) {
                                    Minecraft.this.getTwitchStream().func_152930_t();
                                }

                                Minecraft.this.displayGuiScreen((GuiScreen) null);
                            }
                        }, I18n.format("stream.confirm_start", new Object[0]), "", 0));
                    } else if (this.getTwitchStream().func_152928_D() && this.getTwitchStream().func_152936_l()) {
                        if (this.theWorld != null) {
                            this.ingameGUI.getChatGUI()
                                    .printChatMessage(new ChatComponentText("Not ready to start streaming yet!"));
                        }
                    } else {
                        GuiStreamUnavailable.func_152321_a(this.currentScreen);
                    }
                } else if (i == this.gameSettings.keyBindStreamPauseUnpause.getKeyCode()) {
                    if (this.getTwitchStream().isBroadcasting()) {
                        if (this.getTwitchStream().isPaused()) {
                            this.getTwitchStream().unpause();
                        } else {
                            this.getTwitchStream().pause();
                        }
                    }
                } else if (i == this.gameSettings.keyBindStreamCommercials.getKeyCode()) {
                    if (this.getTwitchStream().isBroadcasting()) {
                        this.getTwitchStream().requestCommercial();
                    }
                } else if (i == this.gameSettings.keyBindStreamToggleMic.getKeyCode()) {
                    this.stream.muteMicrophone(true);
                } else if (i == this.gameSettings.keyBindFullscreen.getKeyCode()) {
                    this.toggleFullscreen();
                } else if (i == this.gameSettings.keyBindScreenshot.getKeyCode()) {
                    this.ingameGUI.getChatGUI().printChatMessage(ScreenShotHelper.saveScreenshot(this.mcDataDir,
                            this.displayWidth, this.displayHeight, this.framebufferMc));
                }
            } else if (i == this.gameSettings.keyBindStreamToggleMic.getKeyCode()) {
                this.stream.muteMicrophone(false);
            }
        }
    }
}
项目:TechnicalDimensions    文件:ScreenShotUitls.java   
public static void takeScreenShot(String id, EntityPlayer player) {
    BufferedImage image = ScreenShotHelper.createScreenshot(width, height, Minecraft.getMinecraft().getFramebuffer());
    PacketUtill.INSTANCE.sendToServer(new PacketSaveSS(resize(image, width, height), id));
}
项目:SecurityCraft    文件:ClientUtils.java   
/**
 * Takes a screenshot, and sends the player a notification. <p>
 *
 * Only works on the CLIENT side.
 */
@SideOnly(Side.CLIENT)
public static void takeScreenshot() {
    if(FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
        Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(ScreenShotHelper.saveScreenshot(Minecraft.getMinecraft().mcDataDir, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight, Minecraft.getMinecraft().getFramebuffer()));
}
项目:SecurityCraft    文件:ClientUtils.java   
/**
 * Takes a screenshot, and sends the player a notification. <p>
 *
 * Only works on the CLIENT side.
 */
@SideOnly(Side.CLIENT)
public static void takeScreenshot() {
    if(FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
        Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(ScreenShotHelper.saveScreenshot(Minecraft.getMinecraft().mcDataDir, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight, Minecraft.getMinecraft().getFramebuffer()));
}
项目:SecurityCraft    文件:ClientUtils.java   
/**
 * Takes a screenshot, and sends the player a notification. <p>
 *
 * Only works on the CLIENT side.
 */
@SideOnly(Side.CLIENT)
public static void takeScreenshot() {
    if(FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
        Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(ScreenShotHelper.saveScreenshot(Minecraft.getMinecraft().mcDataDir, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight, Minecraft.getMinecraft().getFramebuffer()));
}
项目:SecurityCraft    文件:ClientUtils.java   
/**
 * Takes a screenshot, and sends the player a notification. <p>
 *
 * Only works on the CLIENT side.
 */
@SideOnly(Side.CLIENT)
public static void takeScreenshot() {
    if(FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
        Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(ScreenShotHelper.saveScreenshot(Minecraft.getMinecraft().mcDataDir, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight, Minecraft.getMinecraft().getFramebuffer()));
}
项目:SecurityCraft    文件:ClientUtils.java   
/**
 * Takes a screenshot, and sends the player a notification. <p>
 *
 * Only works on the CLIENT side.
 */
@SideOnly(Side.CLIENT)
public static void takeScreenshot() {
    if(FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
        Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(ScreenShotHelper.saveScreenshot(Minecraft.getMinecraft().mcDataDir, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight, Minecraft.getMinecraft().getFramebuffer()));
}
项目:SecurityCraft    文件:ClientUtils.java   
/**
 * Takes a screenshot, and sends the player a notification. <p>
 *
 * Only works on the CLIENT side.
 */
@SideOnly(Side.CLIENT)
public static void takeScreenshot() {
    if(FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
        Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(ScreenShotHelper.saveScreenshot(Minecraft.getMinecraft().mcDataDir, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight, Minecraft.getMinecraft().getFramebuffer()));
}