Java Code Examples for net.minecraft.client.renderer.GlStateManager#pushMatrix()
The following examples show how to use
net.minecraft.client.renderer.GlStateManager#pushMatrix() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AgriGuiWrapper.java From AgriCraft with MIT License | 6 votes |
@Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { // Calculate relative mouse position. final int relMouseX = mouseX - this.guiLeft; final int relMouseY = mouseY - this.guiTop; // Call Mouse Moved Hook. this.guis.getLast().onUpdateMouse(this, relMouseX, relMouseY); // Save renderer state. GlStateManager.pushAttrib(); GlStateManager.pushMatrix(); // Call render hook. this.guis.getLast().onRenderForeground(this, relMouseX, relMouseY); // Restore renderer state. GlStateManager.popMatrix(); GlStateManager.popAttrib(); }
Example 2
Source File: GuiSurgery.java From Cyberware with MIT License | 6 votes |
public void renderModel(ModelBase model, float x, float y, float scale, float rotation) { GlStateManager.enableColorMaterial(); GlStateManager.pushMatrix(); GlStateManager.translate(x, y, 120F); GlStateManager.scale(-scale, scale, scale); GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); GlStateManager.rotate(10.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(rotation, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); float f1 = 0.7F; GlStateManager.glLightModel(2899, RenderHelper.setColorBuffer(f1, f1, f1, 1.0F)); model.render(null, 0, 0, 0, 0, 0, .0625f); GlStateManager.popMatrix(); RenderHelper.disableStandardItemLighting(); GlStateManager.disableRescaleNormal(); OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); GlStateManager.disableTexture2D(); OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); GlStateManager.enableTexture2D(); }
Example 3
Source File: RenderFairy.java From Wizardry with GNU Lesser General Public License v3.0 | 6 votes |
@SubscribeEvent public static void renderFairy(RenderWorldLastEvent event) { if (Minecraft.getMinecraft().world == null || Minecraft.getMinecraft().player == null) return; GlStateManager.pushMatrix(); List<EntityFairy> fairies = Minecraft.getMinecraft().world.getEntitiesWithinAABB(EntityFairy.class, Minecraft.getMinecraft().player.getEntityBoundingBox().grow(Minecraft.getMinecraft().gameSettings.renderDistanceChunks * 16)); fairies.sort(Comparator.comparingDouble(o -> o.getDistanceSq(Minecraft.getMinecraft().player))); Collections.reverse(fairies); for (EntityFairy fairy : fairies) { if (fairy.isInvisible() || fairy.isDead) continue; FairyData dataFairy = fairy.getDataFairy(); if (dataFairy == null) return; dataFairy.render( fairy.world, new Vec3d(fairy.posX, fairy.posY + (dataFairy.isDepressed ? fairy.height : 0), fairy.posZ), new Vec3d(fairy.lastTickPosX, fairy.lastTickPosY, fairy.lastTickPosZ), event.getPartialTicks()); } GlStateManager.popMatrix(); }
Example 4
Source File: MixinGuiOverlayDebug.java From Hyperium with GNU Lesser General Public License v3.0 | 6 votes |
/** * @reason Add 1.7 debug * @author SiroQ */ @Overwrite public void renderDebugInfo(ScaledResolution scaledResolutionIn) { mc.mcProfiler.startSection("debug"); GlStateManager.pushMatrix(); if (Settings.OLD_DEBUG) { renderOldDebugInfoLeft(); renderOldDebugInfoRight(scaledResolutionIn); GlStateManager.popMatrix(); mc.mcProfiler.endSection(); return; } renderDebugInfoLeft(); renderDebugInfoRight(scaledResolutionIn); GlStateManager.popMatrix(); if (mc.gameSettings.showLagometer) renderLagometer(); mc.mcProfiler.endSection(); }
Example 5
Source File: RenderAltar.java From CommunityMod with GNU Lesser General Public License v2.1 | 6 votes |
private void renderShockwave(int progress, int totalProgress, double x, double y, double z) { if (totalProgress == 0) return; double scale = progress * SHOCKWAVE_DIAMETER / (float) totalProgress; GlStateManager.pushMatrix(); GlStateManager.translate(x + 0.5, y + 1, z + 0.5); GlStateManager.scale(scale, scale, scale); GlStateManager.enableBlend(); GlStateManager.depthMask(false); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.color(1F, 1F, 1F, 1 - progress / (float) totalProgress); GlStateManager.enableAlpha(); GlStateManager.callList(ClientProxy.sphereOutId); GlStateManager.callList(ClientProxy.sphereInId); GlStateManager.popMatrix(); }
Example 6
Source File: Tower.java From LiquidBounce with GNU General Public License v3.0 | 6 votes |
/** * Tower visuals * * @param event */ @EventTarget public void onRender2D(final Render2DEvent event) { if(counterDisplayValue.get()) { GlStateManager.pushMatrix(); final BlockOverlay blockOverlay = (BlockOverlay) LiquidBounce.moduleManager.getModule(BlockOverlay.class); if (blockOverlay.getState() && blockOverlay.getInfoValue().get() && blockOverlay.getCurrentBlock() != null) GlStateManager.translate(0, 15F, 0); final String info = "Blocks: ยง7" + getBlocksAmount(); final ScaledResolution scaledResolution = new ScaledResolution(mc); RenderUtils.drawBorderedRect((scaledResolution.getScaledWidth() / 2) - 2, (scaledResolution.getScaledHeight() / 2) + 5, (scaledResolution.getScaledWidth() / 2) + Fonts.font40.getStringWidth(info) + 2, (scaledResolution.getScaledHeight() / 2) + 16, 3, Color.BLACK.getRGB(), Color.BLACK.getRGB()); GlStateManager.resetColor(); Fonts.font40.drawString(info, scaledResolution.getScaledWidth() / 2, scaledResolution.getScaledHeight() / 2 + 7, Color.WHITE.getRGB()); GlStateManager.popMatrix(); } }
Example 7
Source File: RenderUtils.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
public static void drawArc(float cx, float cy, float r, float startAngle, float angle, int segments, int color) { float red = (float) (color >> 16 & 0xFF) / 255F; float green = (float) (color >> 8 & 0xFF) / 255F; float blue = (float) (color & 0xFF) / 255F; float alpha = (float) (color >> 24 & 0xFF) / 255F; float theta = angle / (float) (segments - 1); double tf = Math.tan(theta); float rf = MathHelper.cos(theta); float x = r * MathHelper.cos(startAngle); float y = r * MathHelper.sin(startAngle); GlStateManager.pushMatrix(); GlStateManager.color(red, green, blue, alpha); GL11.glBegin(GL_LINE_STRIP); for (int ii = 0; ii < segments; ii++) { GL11.glVertex2f(x + cx, y + cy); float tx = -y; float ty = x; x += tx * tf; y += ty * tf; x *= rf; y *= rf; } GL11.glEnd(); GlStateManager.popMatrix(); }
Example 8
Source File: PortalFinderModule.java From seppuku with GNU General Public License v3.0 | 5 votes |
@Listener public void render3D(EventRender3D event) { if (this.mode.getValue() == Mode.THREE_DIMENSIONAL) { final Minecraft mc = Minecraft.getMinecraft(); for (Vec3d portal : this.portals) { GlStateManager.pushMatrix(); final boolean bobbing = mc.gameSettings.viewBobbing; mc.gameSettings.viewBobbing = false; mc.entityRenderer.setupCameraTransform(event.getPartialTicks(), 0); final Vec3d forward = new Vec3d(0, 0, 1).rotatePitch(-(float) Math.toRadians(Minecraft.getMinecraft().player.rotationPitch)).rotateYaw(-(float) Math.toRadians(Minecraft.getMinecraft().player.rotationYaw)); // Line RenderUtil.drawLine3D((float) forward.x, (float) forward.y + mc.player.getEyeHeight(), (float) forward.z, (float) (portal.x - mc.getRenderManager().renderPosX), (float) (portal.y - mc.getRenderManager().renderPosY), (float) (portal.z - mc.getRenderManager().renderPosZ), this.width.getValue(), new Color(red.getValue() / 255.0f, green.getValue() / 255.0f, blue.getValue() / 255.0f).getRGB()); // Info if (this.showInfo.getValue()) { RenderUtil.glBillboardDistanceScaled((float) portal.x, (float) portal.y, (float) portal.z, mc.player, this.infoScale.getValue()); GlStateManager.disableDepth(); this.drawPortalInfoText(portal, 0, 0); GlStateManager.enableDepth(); } mc.gameSettings.viewBobbing = bobbing; mc.entityRenderer.setupCameraTransform(event.getPartialTicks(), 0); GlStateManager.popMatrix(); } } }
Example 9
Source File: GuiImageButton.java From EmergingTechnology with MIT License | 5 votes |
@Override public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) { if (!visible) return; GlStateManager.pushMatrix(); mc.renderEngine.bindTexture(this.texture); GlStateManager.scale(1.0, 1.0, 1.0); drawModalRectWithCustomSizedTexture(this.x, this.y, 16, 16, this.width, this.height, 16, 16); GlStateManager.popMatrix(); }
Example 10
Source File: CustomCrosshair.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
private void drawDebugAxisCrosshair(int screenWidth, int screenHeight) { GlStateManager.pushMatrix(); GlStateManager.translate((float) screenWidth, (float) screenHeight, 0.0f); Entity entity = mc.getRenderViewEntity(); GlStateManager.rotate( entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * 1.0f, -1.0f, 0.0f, 0.0f); GlStateManager .rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * 1.0f, 0.0f, 1.0f, 0.0f); GlStateManager.scale(-1.0f, -1.0f, -1.0f); GlStateManager.disableTexture2D(); GlStateManager.depthMask(false); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.begin(GL11.GL_CLIENT_PIXEL_STORE_BIT, DefaultVertexFormats.POSITION_COLOR); GL11.glLineWidth(2.0f); worldrenderer.pos(0.0, 0.0, 0.0).color(255, 0, 0, 255).endVertex(); worldrenderer.pos(10.0, 0.0, 0.0).color(255, 0, 0, 255).endVertex(); worldrenderer.pos(0.0, 0.0, 0.0).color(0, 255, 0, 255).endVertex(); worldrenderer.pos(0.0, 10.0, 0.0).color(0, 255, 0, 255).endVertex(); worldrenderer.pos(0.0, 0.0, 0.0).color(0, 0, 255, 255).endVertex(); worldrenderer.pos(0.0, 0.0, 10.0).color(0, 0, 255, 255).endVertex(); tessellator.draw(); GL11.glLineWidth(1.0f); GlStateManager.depthMask(true); GlStateManager.enableTexture2D(); GlStateManager.popMatrix(); }
Example 11
Source File: RendererBackpack.java From WearableBackpacks with MIT License | 5 votes |
@Override public void render(TileEntityBackpack entity, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { IBackpack backpack = BackpackHelper.getBackpack(entity); if (backpack == null) return; float angle = entity.facing.getHorizontalAngle(); GlStateManager.pushMatrix(); GlStateManager.translate(x + 0.5, y + 0.5, z + 0.5); GlStateManager.rotate(angle, 0.0F, -1.0F, 0.0F); GlStateManager.translate(-0.5, -0.5, -0.5); renderBackpack(backpack, entity.getAge() + partialTicks, true); GlStateManager.popMatrix(); }
Example 12
Source File: RenderEntityThrownItem.java From Production-Line with MIT License | 5 votes |
/** * Renders the desired {@code T} type Entity. */ @Override public void doRender(T entity, double x, double y, double z, float entityYaw, float partialTicks) { GlStateManager.pushMatrix(); GlStateManager.translate((float) x, (float) y, (float) z); GlStateManager.enableRescaleNormal(); GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GlStateManager.rotate((float) (this.renderManager.options.thirdPersonView == 2 ? -1 : 1) * this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); if (this.renderOutlines) { GlStateManager.enableColorMaterial(); GlStateManager.enableOutlineMode(this.getTeamColor(entity)); } this.itemRenderer.renderItem(this.getStackToRender(entity), ItemCameraTransforms.TransformType.GROUND); if (this.renderOutlines) { GlStateManager.disableOutlineMode(); GlStateManager.disableColorMaterial(); } GlStateManager.disableRescaleNormal(); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); }
Example 13
Source File: GuiChestHook.java From SkyblockAddons with MIT License | 5 votes |
public static void drawScreen(int guiLeft, int guiTop) { EnumUtils.InventoryType inventoryType = EnumUtils.InventoryType.getCurrentInventoryType(); if (textFieldMatch != null && (inventoryType == EnumUtils.InventoryType.ENCHANTMENT_TABLE || inventoryType== EnumUtils.InventoryType.REFORGE_ANVIL)) { GlStateManager.color(1F, 1F, 1F); SkyblockAddons main = SkyblockAddons.getInstance(); String inventoryMessage = inventoryType.getMessage(); int defaultBlue = main.getUtils().getDefaultBlue(255); GlStateManager.pushMatrix(); float scale = 0.75F; GlStateManager.scale(scale, scale, 1); int x = guiLeft - 160; if (x<0) { x = 20; } MinecraftReflection.FontRenderer.drawString(Message.MESSAGE_TYPE_ENCHANTMENTS.getMessage(inventoryMessage), Math.round(x/scale), Math.round((guiTop+40)/scale), defaultBlue); MinecraftReflection.FontRenderer.drawString(Message.MESSAGE_SEPARATE_ENCHANTMENTS.getMessage(), Math.round(x/scale), Math.round((guiTop + 50)/scale), defaultBlue); MinecraftReflection.FontRenderer.drawString(Message.MESSAGE_ENCHANTS_TO_MATCH.getMessage(inventoryMessage), Math.round(x/scale), Math.round((guiTop + 70)/scale), defaultBlue); MinecraftReflection.FontRenderer.drawString(Message.MESSAGE_ENCHANTS_TO_EXCLUDE.getMessage(inventoryMessage), Math.round(x/scale), Math.round((guiTop + 110)/scale), defaultBlue); GlStateManager.popMatrix(); textFieldMatch.drawTextBox(); if (StringUtil.isEmpty(textFieldMatch.getText())) { MinecraftReflection.FontRenderer.drawString("ex. \"prot, feather\"", x+4, guiTop + 86, ChatFormatting.DARK_GRAY); } textFieldExclusions.drawTextBox(); if (StringUtil.isEmpty(textFieldExclusions.getText())) { MinecraftReflection.FontRenderer.drawString("ex. \"proj, blast\"", x+4, guiTop + 126, ChatFormatting.DARK_GRAY); } } }
Example 14
Source File: RenderHelper.java From HoloInventory with MIT License | 5 votes |
public static void start() { GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); GlStateManager.enableRescaleNormal(); GlStateManager.enableAlpha(); GlStateManager.alphaFunc(516, 0.1F); GlStateManager.enableBlend(); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); }
Example 15
Source File: StructureManager.java From Wizardry with GNU Lesser General Public License v3.0 | 4 votes |
/** * Will not draw the structure if it is not already baked. Resource reloading will re-bake if required. * * @param alpha The transparency of the rendered structure. * @param location The ResourceLocation of the structure to look up. */ @SideOnly(Side.CLIENT) public void draw(ResourceLocation location, float alpha) { HashMap<Integer, int[]> cache = vboCache.get(location); if (cache == null || cache.isEmpty()) { bake(location); return; } GlStateManager.pushMatrix(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.enablePolygonOffset(); GlStateManager.doPolygonOffset(1f, -0.05f); // GlStateManager.disableDepth(); int alphaFunc = GL11.glGetInteger(GL11.GL_ALPHA_TEST_FUNC); float alphaRef = GL11.glGetFloat(GL11.GL_ALPHA_TEST_REF); GlStateManager.alphaFunc(GL11.GL_ALWAYS, 1); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); Tessellator tes = Tessellator.getInstance(); BufferBuilder buffer = tes.getBuffer(); for (int layerID : cache.keySet()) { buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); buffer.addVertexData(cache.get(layerID)); for (int i = 0; i < buffer.getVertexCount(); i++) { buffer.putColorRGBA(buffer.getColorIndex(i), 255, 255, 255, (int) (alpha * 255)); } tes.draw(); } GlStateManager.alphaFunc(alphaFunc, alphaRef); // GlStateManager.enableDepth(); GlStateManager.disablePolygonOffset(); GlStateManager.color(1F, 1F, 1F, 1F); GlStateManager.popMatrix(); }
Example 16
Source File: TESRBTank.java From BetterChests with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void render(TileEntityBTank te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { FluidTank tank = te.getTank(); FluidStack stack = tank.getFluid(); if (stack != null) { float fillPercentage = ((float)stack.amount) / tank.getCapacity(); boolean gaseous = stack.getFluid().isGaseous(stack); GlStateManager.pushMatrix(); GL11.glEnable(GL11.GL_BLEND); ResourceLocation loc = stack.getFluid().getStill(stack); TextureAtlasSprite sprite = RenderHelper.getAtlasSprite(loc); RenderHelper.bindBlockTexture(); float minY = !gaseous ? 0 : 1 - fillPercentage; float maxY = gaseous ? 1 : fillPercentage; float minU = sprite.getMinU(); float maxU = sprite.getMaxU(); float minV = sprite.getMinV(); float maxV = sprite.getMaxV(); float minVHorizontal = minV + (maxV - minV) * minY; float maxVHorizontal = minV + (maxV - minV) * maxY; GlStateManager.translate(x, y, z); GlStateManager.translate(0.5, 0.5, 0.5); GlStateManager.scale(12/16D, 12/16D, 12/16D); GlStateManager.translate(-0.5, -0.5, -0.5); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder builder = tessellator.getBuffer(); //south builder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); builder.pos(0, minY, 1).tex(minU, minVHorizontal).endVertex(); builder.pos(1, minY, 1).tex(maxU, minVHorizontal).endVertex(); builder.pos(1, maxY, 1).tex(maxU, maxVHorizontal).endVertex(); builder.pos(0, maxY, 1).tex(minU, maxVHorizontal).endVertex(); tessellator.draw(); //north builder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); builder.pos(1, minY, 0).tex(minU, minVHorizontal).endVertex(); builder.pos(0, minY, 0).tex(maxU, minVHorizontal).endVertex(); builder.pos(0, maxY, 0).tex(maxU, maxVHorizontal).endVertex(); builder.pos(1, maxY, 0).tex(minU, maxVHorizontal).endVertex(); tessellator.draw(); //east builder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); builder.pos(1, minY, 1).tex(minU, minVHorizontal).endVertex(); builder.pos(1, minY, 0).tex(maxU, minVHorizontal).endVertex(); builder.pos(1, maxY, 0).tex(maxU, maxVHorizontal).endVertex(); builder.pos(1, maxY, 1).tex(minU, maxVHorizontal).endVertex(); tessellator.draw(); //west builder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); builder.pos(0, minY, 0).tex(minU, minVHorizontal).endVertex(); builder.pos(0, minY, 1).tex(maxU, minVHorizontal).endVertex(); builder.pos(0, maxY, 1).tex(maxU, maxVHorizontal).endVertex(); builder.pos(0, maxY, 0).tex(minU, maxVHorizontal).endVertex(); tessellator.draw(); //up builder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); builder.pos(1, maxY, 0).tex(minU, minV).endVertex(); builder.pos(0, maxY, 0).tex(maxU, minV).endVertex(); builder.pos(0, maxY, 1).tex(maxU, maxV).endVertex(); builder.pos(1, maxY, 1).tex(minU, maxV).endVertex(); tessellator.draw(); //down builder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); builder.pos(0, minY, 0).tex(minU, minV).endVertex(); builder.pos(1, minY, 0).tex(maxU, minV).endVertex(); builder.pos(1, minY, 1).tex(maxU, maxV).endVertex(); builder.pos(0, minY, 1).tex(minU, maxV).endVertex(); tessellator.draw(); GL11.glDisable(GL11.GL_BLEND); GlStateManager.popMatrix(); } }
Example 17
Source File: MixinItemRenderer.java From Hyperium with GNU Lesser General Public License v3.0 | 4 votes |
@Inject(method = "renderFireInFirstPerson", at = @At("HEAD")) private void preRenderFire(float partialTicks, CallbackInfo ci) { GlStateManager.pushMatrix(); GlStateManager.translate(0, Settings.FIRE_HEIGHT, 0); }
Example 18
Source File: PowerDisplay.java From Cyberware with MIT License | 4 votes |
@Override public void renderElement(int x, int y, EntityPlayer p, ScaledResolution resolution, boolean hudjackAvailable, boolean isConfigOpen, float partialTicks) { if (!isHidden() && hudjackAvailable) { boolean flipHoriz = getHorizontalAnchor() == EnumAnchorHorizontal.RIGHT; float currTime = p.ticksExisted + partialTicks; GL11.glPushMatrix(); GlStateManager.enableBlend(); ICyberwareUserData data = CyberwareAPI.getCapability(p); Minecraft.getMinecraft().getTextureManager().bindTexture(HudHandler.HUD_TEXTURE); FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; if (p.ticksExisted % 20 == 0) { cachedPercent = data.getPercentFull(); cachedCap = data.getCapacity(); cachedTotal = data.getStoredPower(); cachedProd = data.getProduction(); cachedCons = data.getConsumption(); } float[] color = CyberwareAPI.getHUDColor(); int colorHex = CyberwareAPI.getHUDColorHex(); if (cachedPercent != -1) { int amount = Math.round((21F * cachedPercent)); boolean danger = (cachedPercent <= .2F); boolean superDanger = danger && (cachedPercent <= .05F); int xOffset = (danger ? 39 : 0); if (!superDanger || p.ticksExisted % 4 != 0) { int moveX = flipHoriz ? (x + getWidth() - 13) : x; GlStateManager.pushMatrix(); if (!danger) GlStateManager.color(color[0], color[1], color[2]); ClientUtils.drawTexturedModalRect(moveX, y, xOffset, 0, 13, 2 + (21 - amount)); ClientUtils.drawTexturedModalRect(moveX, y + 2 + (21 - amount), 13 + xOffset, 2 + (21 - amount), 13, amount + 2); ClientUtils.drawTexturedModalRect(moveX, y + 2 + (21 - amount), 26 + xOffset, 2 + (21 - amount), 13, amount + 2); GlStateManager.popMatrix(); String output = cachedTotal + " / " + cachedCap; int textX = flipHoriz ? x + getWidth() - 15 - fr.getStringWidth(output) : x + 15; fr.drawStringWithShadow(output, textX, y + 4, danger ? 0xFF0000 : colorHex); output = "-" + cachedCons + " / +" + cachedProd; textX = flipHoriz ? x + getWidth() - 15 - fr.getStringWidth(output) : x + 15; fr.drawStringWithShadow(output, textX, y + 14, danger ? 0xFF0000 : colorHex); } } GL11.glPopMatrix(); } }
Example 19
Source File: MixinGuiNewChat.java From LiquidBounce with GNU General Public License v3.0 | 4 votes |
@Inject(method = "drawChat", at = @At("HEAD"), cancellable = true) private void drawChat(int p_drawChat_1_, final CallbackInfo callbackInfo) { final HUD hud = (HUD) LiquidBounce.moduleManager.getModule(HUD.class); if(hud.getState() && hud.fontChatValue.get()) { callbackInfo.cancel(); if(this.mc.gameSettings.chatVisibility != EntityPlayer.EnumChatVisibility.HIDDEN) { int lvt_2_1_ = this.getLineCount(); boolean lvt_3_1_ = false; int lvt_4_1_ = 0; int lvt_5_1_ = this.drawnChatLines.size(); float lvt_6_1_ = this.mc.gameSettings.chatOpacity * 0.9F + 0.1F; if(lvt_5_1_ > 0) { if(this.getChatOpen()) { lvt_3_1_ = true; } float lvt_7_1_ = this.getChatScale(); int lvt_8_1_ = MathHelper.ceiling_float_int((float) this.getChatWidth() / lvt_7_1_); GlStateManager.pushMatrix(); GlStateManager.translate(2.0F, 20.0F, 0.0F); GlStateManager.scale(lvt_7_1_, lvt_7_1_, 1.0F); int lvt_9_1_; int lvt_11_1_; int lvt_14_1_; for(lvt_9_1_ = 0; lvt_9_1_ + this.scrollPos < this.drawnChatLines.size() && lvt_9_1_ < lvt_2_1_; ++lvt_9_1_) { ChatLine lvt_10_1_ = (ChatLine) this.drawnChatLines.get(lvt_9_1_ + this.scrollPos); if(lvt_10_1_ != null) { lvt_11_1_ = p_drawChat_1_ - lvt_10_1_.getUpdatedCounter(); if(lvt_11_1_ < 200 || lvt_3_1_) { double lvt_12_1_ = (double) lvt_11_1_ / 200.0D; lvt_12_1_ = 1.0D - lvt_12_1_; lvt_12_1_ *= 10.0D; lvt_12_1_ = MathHelper.clamp_double(lvt_12_1_, 0.0D, 1.0D); lvt_12_1_ *= lvt_12_1_; lvt_14_1_ = (int) (255.0D * lvt_12_1_); if(lvt_3_1_) { lvt_14_1_ = 255; } lvt_14_1_ = (int) ((float) lvt_14_1_ * lvt_6_1_); ++lvt_4_1_; if(lvt_14_1_ > 3) { int lvt_15_1_ = 0; int lvt_16_1_ = -lvt_9_1_ * 9; Gui.drawRect(lvt_15_1_, lvt_16_1_ - 9, lvt_15_1_ + lvt_8_1_ + 4, lvt_16_1_, lvt_14_1_ / 2 << 24); String lvt_17_1_ = lvt_10_1_.getChatComponent().getFormattedText(); Fonts.font40.drawStringWithShadow(lvt_17_1_, (float) lvt_15_1_ + 2, (float) (lvt_16_1_ - 8), 16777215 + (lvt_14_1_ << 24)); GL11.glColor4f(1, 1, 1, 1); GlStateManager.resetColor(); } } } } if(lvt_3_1_) { lvt_9_1_ = Fonts.font40.FONT_HEIGHT; GlStateManager.translate(-3.0F, 0.0F, 0.0F); int lvt_10_2_ = lvt_5_1_ * lvt_9_1_ + lvt_5_1_; lvt_11_1_ = lvt_4_1_ * lvt_9_1_ + lvt_4_1_; int lvt_12_2_ = this.scrollPos * lvt_11_1_ / lvt_5_1_; int lvt_13_1_ = lvt_11_1_ * lvt_11_1_ / lvt_10_2_; if(lvt_10_2_ != lvt_11_1_) { lvt_14_1_ = lvt_12_2_ > 0 ? 170 : 96; int lvt_15_2_ = this.isScrolled ? 13382451 : 3355562; Gui.drawRect(0, -lvt_12_2_, 2, -lvt_12_2_ - lvt_13_1_, lvt_15_2_ + (lvt_14_1_ << 24)); Gui.drawRect(2, -lvt_12_2_, 1, -lvt_12_2_ - lvt_13_1_, 13421772 + (lvt_14_1_ << 24)); } } GlStateManager.popMatrix(); } } } }
Example 20
Source File: TcModelRenderer.java From TofuCraftReload with MIT License | 3 votes |
public void renderDirectly() { if (!this.compiled) { this.compileDisplayPane(); } GlStateManager.pushMatrix(); GlStateManager.callList(this.displayList); GlStateManager.popMatrix(); }