private void render2D(float partialTicks) { Minecraft minecraft = FMLClientHandler.instance().getClient(); EntityPlayer player = minecraft.thePlayer; ItemStack helmetStack = player.inventory.armorInventory[3]; if (helmetStack != null && minecraft.inGameHasFocus && helmetStack.getItem() == Itemss.pneumaticHelmet) { ScaledResolution sr = new ScaledResolution(minecraft, minecraft.displayWidth, minecraft.displayHeight); GL11.glDepthMask(false); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glPushMatrix(); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); GL11.glColor4d(0, 1, 0, 0.8D); CommonHUDHandler comHudHandler = CommonHUDHandler.getHandlerForPlayer(player); if (comHudHandler.ticksExisted <= comHudHandler.getStartupTime()) { // blockTrackInfo = null; gaveEmptyWarning = false; gaveNearlyEmptyWarning = false; RenderProgressBar.render( sr.getScaledWidth() / 2, 10, sr.getScaledWidth() - 10, 30, -90F, comHudHandler.ticksExisted * 100 / comHudHandler.getStartupTime()); } else { if (comHudHandler.helmetPressure < 0.05F && !gaveEmptyWarning) { addMessage( new ArmorMessage( "The helmet is out of air!", new ArrayList<String>(), 100, 0x70FF0000)); gaveEmptyWarning = true; } if (comHudHandler.helmetPressure > 0.2F && comHudHandler.helmetPressure < 0.5F && !gaveNearlyEmptyWarning) { addMessage( new ArmorMessage( "The helmet almost out of air!", new ArrayList<String>(), 60, 0x70FF0000)); gaveNearlyEmptyWarning = true; } if (GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade.coreComponents") .checked) { for (int i = 0; i < UpgradeRenderHandlerList.instance().upgradeRenderers.size(); i++) { IUpgradeRenderHandler upgradeRenderHandler = UpgradeRenderHandlerList.instance().upgradeRenderers.get(i); if (comHudHandler.upgradeRenderersInserted[i] && GuiKeybindCheckBox.trackedCheckboxes.get( "pneumaticHelmet.upgrade." + upgradeRenderHandler.getUpgradeName()) .checked) { IGuiAnimatedStat stat = upgradeRenderHandler.getAnimatedStat(); if (stat != null) { stat.render(-1, -1, partialTicks); } upgradeRenderHandler.render2D(partialTicks, comHudHandler.helmetPressure > 0F); } } } } // render every item in the list. for (ArmorMessage message : messageList) { message.renderMessage(minecraft.fontRenderer, partialTicks); } GL11.glPopMatrix(); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_TEXTURE_2D); if (comHudHandler.ticksExisted <= comHudHandler.getStartupTime()) minecraft.fontRenderer.drawString( CommonHUDHandler.getHandlerForPlayer().ticksExisted * 100 / comHudHandler.getStartupTime() + "%", sr.getScaledWidth() * 3 / 4 - 8, 16, 0x000000); } else if (helmetStack == null) { messageList.clear(); } }
public void render(float partialTicks, boolean justRenderWhenHovering) { for (IEntityTrackEntry tracker : trackEntries) { tracker.render(entity, partialTicks); } double x = entity.prevPosX + (entity.posX - entity.prevPosX) * partialTicks; double y = entity.prevPosY + (entity.posY - entity.prevPosY) * partialTicks + entity.height / 2D; double z = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * partialTicks; GL11.glDepthMask(false); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glPushMatrix(); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); float red = 0.5F; float green = 0.5F; float blue = 1.0F; float alpha = 0.5F; float size = entity.height * 0.5F; if (ticksExisted < 60) { size += 5 - Math.abs(ticksExisted) * 0.083F; alpha = Math.abs(ticksExisted) * 0.005F; } GL11.glTranslated(x, y, z); GL11.glRotatef(180.0F - RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(180.0F - RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F); GL11.glColor4d(red, green, blue, alpha); float renderSize = oldSize + (size - oldSize) * partialTicks; circle1.render(renderSize, partialTicks); circle2.render(renderSize + 0.2D, partialTicks); int targetAcquireProgress = (int) ((ticksExisted - 50) / 0.7F); if (ticksExisted <= 120 && ticksExisted > 50) { GL11.glColor4d(0, 1, 0, 0.8D); RenderProgressBar.render(0D, 0.4D, 1.8D, 0.9D, 0, targetAcquireProgress); } GL11.glEnable(GL11.GL_TEXTURE_2D); FontRenderer fontRenderer = RenderManager.instance.getFontRenderer(); GL11.glScaled(0.02D, 0.02D, 0.02D); GL11.glColor4d(red, green, blue, alpha); if (ticksExisted > 120) { if (justRenderWhenHovering && !isLookingAtTarget) { stat.closeWindow(); } else { stat.openWindow(); } textList = new ArrayList<String>(); for (IEntityTrackEntry tracker : trackEntries) { tracker.addInfo(entity, textList); } stat.setText(textList); stat.render(-1, -1, partialTicks); } else if (ticksExisted > 50) { fontRenderer.drawString("Acquiring Target...", 0, 0, 0x7F7F7F); fontRenderer.drawString(targetAcquireProgress + "%", 37, 28, 0x002F00); } else if (ticksExisted < -30) { stat.closeWindow(); // if(stat.getWidth() > stat.getMinWidth() || stat.getHeight() > stat.getMinHeight()) { // stat.setText(new ArrayList<String>()); stat.render(-1, -1, partialTicks); // } fontRenderer.drawString("Lost Target!", 0, 0, 0xFF0000); } GL11.glPopMatrix(); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); oldSize = size; }