本文整理汇总了Java中net.minecraft.util.ScreenShotHelper类的典型用法代码示例。如果您正苦于以下问题:Java ScreenShotHelper类的具体用法?Java ScreenShotHelper怎么用?Java ScreenShotHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ScreenShotHelper类属于net.minecraft.util包,在下文中一共展示了ScreenShotHelper类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dispatchKeypresses
import net.minecraft.util.ScreenShotHelper; //导入依赖的package包/类
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));
}
}
}
}
}
示例2: dispatchKeypresses
import net.minecraft.util.ScreenShotHelper; //导入依赖的package包/类
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;
}
}
}
示例3: screenshotListener
import net.minecraft.util.ScreenShotHelper; //导入依赖的package包/类
/**
* 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;
}
}
示例4: screenshotListener
import net.minecraft.util.ScreenShotHelper; //导入依赖的package包/类
/**
* 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;
}
}
示例5: createWorldIcon
import net.minecraft.util.ScreenShotHelper; //导入依赖的package包/类
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);
}
}
}
示例6: tryGettingScreenshot
import net.minecraft.util.ScreenShotHelper; //导入依赖的package包/类
/**
* 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();
}
}
}
示例7: onPlayerDeathImage
import net.minecraft.util.ScreenShotHelper; //导入依赖的package包/类
@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();
}
}
示例8: takeScreenshot
import net.minecraft.util.ScreenShotHelper; //导入依赖的package包/类
/**
* 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()));
}
}
示例9: func_71365_K
import net.minecraft.util.ScreenShotHelper; //导入依赖的package包/类
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;
}
}
示例10: getScreenshot
import net.minecraft.util.ScreenShotHelper; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public static BufferedImage getScreenshot() {
BufferedImage image = ScreenShotHelper.createScreenshot(Minecraft.getMinecraft().displayWidth,
Minecraft.getMinecraft().displayHeight, Minecraft.getMinecraft().getFramebuffer());
return image;
}
示例11: getFormattingScreenshot
import net.minecraft.util.ScreenShotHelper; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public static BufferedImage getFormattingScreenshot() {
BufferedImage image = ScreenShotHelper.createScreenshot(Minecraft.getMinecraft().displayWidth,
Minecraft.getMinecraft().displayHeight, Minecraft.getMinecraft().getFramebuffer());
return FormattingPicture(image);
}
示例12: dispatchKeypresses
import net.minecraft.util.ScreenShotHelper; //导入依赖的package包/类
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);
}
}
}
}
示例13: takeScreenShot
import net.minecraft.util.ScreenShotHelper; //导入依赖的package包/类
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));
}
示例14: takeScreenshot
import net.minecraft.util.ScreenShotHelper; //导入依赖的package包/类
/**
* 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()));
}