@SubscribeEvent public void onClientTick(ClientTickEvent event) { try { if (Minecraft.getMinecraft().inGameHasFocus) { if (!playersUUID.isEmpty()) { gotPlayersUUID = true; } if (!gotPlayersUUID) { playersUUID = UuidHelper.getUUIDFromUsername(Minecraft.getMinecraft().thePlayer.getDisplayName()); System.out.println(playersUUID); } } if (Minecraft.getMinecraft().inGameHasFocus && Minecraft.getMinecraft().func_147104_D() != null) { this.apiQueue.onClientTick(); if (isUpdate) { if (updateTime != 200) { updateTime += 1; } if (updateTime == 200) { isUpdate = false; updateTime = 0; } } if (ticker == 0) { if (InfoHUD.isEnabled) { InfoHUD.display = InfoHUD.getInfoDisplay(); } if (ArmorHUD.isEnabled) { ArmorHUD.getInventory(); } } if (ticker == 10) { ticker = 0; } } } catch (Exception e) { logWarn("An exception occured in onClientTick(). Stacktrace below."); e.printStackTrace(); } }
@SubscribeEvent public void onRenderTick(RenderTickEvent event) { try { if (Minecraft.getMinecraft().func_147104_D() != null) { if (isUpdate) { if ((!Minecraft.getMinecraft().gameSettings.showDebugInfo) && (Minecraft.getMinecraft().inGameHasFocus) && (!(Minecraft.getMinecraft().currentScreen instanceof GuiChat))) { ScaledResolution res = new ScaledResolution( Minecraft.getMinecraft(), Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight); FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; String updateMessage = EnumChatFormatting.RED + "UPDATE Version: " + EnumChatFormatting.YELLOW + ChromaPixelUpdater.update; String forumLink = EnumChatFormatting.GOLD + "Download from here: " + EnumChatFormatting.GREEN + "http://tiny.cc/ChromaPixel"; int y = res.getScaledHeight() / 2 - 10; int x = res.getScaledWidth() / 2 - (fontRenderer.getStringWidth(updateMessage) / 2); fontRenderer.drawString(updateMessage, x, y, 0xffffff, true); x = res.getScaledWidth() / 2 - (fontRenderer.getStringWidth(forumLink) / 2); fontRenderer.drawString(forumLink, x, y + 10, 0xffffff, true); } } if ((!Minecraft.getMinecraft().gameSettings.showDebugInfo) && (Minecraft.getMinecraft().inGameHasFocus) && (!(Minecraft.getMinecraft().currentScreen instanceof GuiChat))) { if (this.CONFIG.showLogo) { Minecraft.getMinecraft() .fontRenderer .drawString( ChromaPixelMod.CHROMA_PIXEL + EnumChatFormatting.GOLD + " " + ChromaPixelMod.VERSION + EnumChatFormatting.BOLD + " BETA", 1, 1, 0xffffff); } if (ArmorHUD.isEnabled) { ScaledResolution res = new ScaledResolution( Minecraft.getMinecraft(), Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight); Minecraft.getMinecraft() .fontRenderer .drawString( EnumChatFormatting.GRAY + "[" + InfoHUD.mainColor + "Armor HUD" + EnumChatFormatting.GRAY + "]", res.getScaledWidth() - (Minecraft.getMinecraft() .fontRenderer .getStringWidth( EnumChatFormatting.GRAY + "[" + InfoHUD.mainColor + "Armor HUD" + EnumChatFormatting.GRAY + "]") + 1), 15, 0xffffff); } InfoHUD.renderDisplay(); ArmorHUD.render(); EffectHUD.render(); } } } catch (Exception e) { logWarn("An exception occured in onRenderTick(). Stacktrace below."); e.printStackTrace(); } }