Java Code Examples for net.minecraft.client.renderer.GlStateManager#popMatrix()

The following examples show how to use net.minecraft.client.renderer.GlStateManager#popMatrix() . 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: RenderUtils.java    From Hyperium with GNU Lesser General Public License v3.0 7 votes vote down vote up
public static void drawLine(float x, float y, float x1, float y1, float width, int colour) {
    float red = (float) (colour >> 16 & 0xFF) / 255F;
    float green = (float) (colour >> 8 & 0xFF) / 255F;
    float blue = (float) (colour & 0xFF) / 255F;
    float alpha = (float) (colour >> 24 & 0xFF) / 255F;

    GlStateManager.enableBlend();
    GlStateManager.disableTexture2D();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);

    GlStateManager.pushMatrix();
    GlStateManager.color(red, green, blue, alpha);
    GL11.glLineWidth(width);
    GL11.glBegin(GL11.GL_LINE_STRIP);
    GL11.glVertex2f(x, y);
    GL11.glVertex2f(x1, y1);
    GL11.glEnd();
    GlStateManager.popMatrix();

    GlStateManager.enableTexture2D();
    GlStateManager.disableBlend();
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
 
Example 2
Source File: Utils.java    From SkyblockAddons with MIT License 6 votes vote down vote up
public void drawTextWithStyle(String text, float x, float y, int color) {
    GlStateManager.pushMatrix();
    GlStateManager.translate(x, y, 0);

    if (main.getConfigValues().getTextStyle() == EnumUtils.TextStyle.STYLE_TWO) {
        int colorAlpha = Math.max(getAlpha(color), 4);
        int colorBlack = new Color(0, 0, 0, colorAlpha/255F).getRGB();
        String strippedText = TextUtils.stripColor(text);
        Minecraft.getMinecraft().fontRendererObj.drawString(strippedText,1, 0, colorBlack, false);
        Minecraft.getMinecraft().fontRendererObj.drawString(strippedText, -1, 0, colorBlack, false);
        Minecraft.getMinecraft().fontRendererObj.drawString(strippedText, 0, 1, colorBlack, false);
        Minecraft.getMinecraft().fontRendererObj.drawString(strippedText, 0, -1, colorBlack, false);
        Minecraft.getMinecraft().fontRendererObj.drawString(text, 0, 0, color, false);
    } else {
        Minecraft.getMinecraft().fontRendererObj.drawString(text, 0, 0, color, true);
    }

    GlStateManager.popMatrix();
}
 
Example 3
Source File: GuiPlayerSettings.java    From MediaMod with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    super.drawDefaultBackground();

    GlStateManager.pushMatrix();
    GlStateManager.color(1, 1, 1, 1);

    // Bind the texture for rendering
    mc.getTextureManager().bindTexture(this.headerResource);

    // Render the header
    Gui.drawModalRectWithCustomSizedTexture(width / 2 - 111, 2, 0, 0, 222, 55, 222, 55);
    GlStateManager.popMatrix();

    boolean testing;
    if (ServiceHandler.INSTANCE.getCurrentMediaHandler() == null) {
        testing = true;
    } else {
        testing = !ServiceHandler.INSTANCE.getCurrentMediaHandler().handlerReady();
    }

    PlayerOverlay.INSTANCE.drawPlayer(width / 2 - 80, height / 2 + 10, Settings.MODERN_PLAYER_STYLE, testing, 1.0);

    super.drawScreen(mouseX, mouseY, partialTicks);
}
 
Example 4
Source File: RenderEntityEnderPearl.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void doRender(EntityEnderPearlReusable 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(this.renderManager.playerViewX, 1.0f, 0.0f, 0.0f);
    this.bindTexture(this.getEntityTexture(entity));

    this.renderItem.renderItem(this.getItemStack(entity), ItemCameraTransforms.TransformType.GROUND);

    GlStateManager.disableRescaleNormal();
    GlStateManager.popMatrix();
    super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
 
Example 5
Source File: RenderPeripheral.java    From AgriCraft with MIT License 6 votes vote down vote up
private void renderSeed(TileEntitySeedAnalyzer te, double x, double y, double z) {
    if (te != null && te.hasSpecimen()) {
        // Save Settings
        GlStateManager.pushAttrib();
        GlStateManager.pushMatrix();

        // Translate to the location of our tile entity
        GlStateManager.translate(x, y, z);
        GlStateManager.disableRescaleNormal();

        // Render Seed Item
        renderItemStack(te.getSpecimen(), 0.5, 0.5, 0.5, 0.75, true);

        // Restore Settings
        GlStateManager.popMatrix();
        GlStateManager.popAttrib();
    }
}
 
Example 6
Source File: AgriGuiWrapper.java    From AgriCraft with MIT License 6 votes vote down vote up
@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 7
Source File: ModelClaws.java    From Cyberware with MIT License 6 votes vote down vote up
/**
 * Sets the models various rotation angles then renders the model.
 */
public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale)
{
    super.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
    GlStateManager.pushMatrix();

    if (entityIn.isSneaking())
    {
        GlStateManager.translate(0.0F, 0.2F, 0.0F);
    }

    this.claw1.render(scale);


    GlStateManager.popMatrix();
}
 
Example 8
Source File: GuiSurgery.java    From Cyberware with MIT License 6 votes vote down vote up
public void renderEntity(Entity entity, float x, float y, float scale, float rotation)
{
	GlStateManager.enableColorMaterial();
	GlStateManager.pushMatrix();
	GlStateManager.translate(x, y, 50.0F);
	GlStateManager.scale(-scale, scale, scale);
	GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
	GlStateManager.rotate(rotation, 0.0F, 1.0F, 0.0F);
	RenderHelper.enableStandardItemLighting();
	Minecraft.getMinecraft().getRenderManager().playerViewY = 180.0F;
	Minecraft.getMinecraft().getRenderManager().doRenderEntity(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, false);
	GlStateManager.popMatrix();
	RenderHelper.disableStandardItemLighting();
	GlStateManager.disableRescaleNormal();
	OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
	GlStateManager.disableTexture2D();
	OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
	GlStateManager.enableTexture2D();
}
 
Example 9
Source File: ItemArmorCyberware.java    From Cyberware with MIT License 6 votes vote down vote up
@Override
public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale)
{
	super.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
	GlStateManager.pushMatrix();

	if (this.isChild)
	{
		float f = 2.0F;
		GlStateManager.scale(1.0F / f, 1.0F / f, 1.0F / f);
		GlStateManager.translate(0.0F, 24.0F * scale, 0.0F);
		this.bottomThing.render(scale);

	}
	else
	{
		if (entityIn.isSneaking())
		{
			GlStateManager.translate(0.0F, 0.2F, 0.0F);
		}

		this.bottomThing.render(scale);
	}

	GlStateManager.popMatrix();
}
 
Example 10
Source File: RenderHelper.java    From HoloInventory with MIT License 5 votes vote down vote up
public static void end()
{
    GlStateManager.disableAlpha();
    GlStateManager.disableRescaleNormal();
    GlStateManager.disableLighting();

    GlStateManager.popAttrib();
    GlStateManager.popMatrix();
}
 
Example 11
Source File: HyperiumGui.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void drawScaledText(String text, int trueX, int trueY, double scaleFac, int color, boolean shadow, boolean centered) {
    GlStateManager.pushMatrix();
    GlStateManager.scale(scaleFac, scaleFac, scaleFac);
    fontRendererObj.drawString(text, (float) (((double) trueX) / scaleFac) - (centered ? fontRendererObj.getStringWidth(text) / 2f : 0),
        (float) (((double) trueY) / scaleFac), color, shadow);
    GlStateManager.scale(1 / scaleFac, 1 / scaleFac, 1 / scaleFac);
    GlStateManager.popMatrix();
}
 
Example 12
Source File: RendererBackpack.java    From WearableBackpacks with MIT License 5 votes vote down vote up
@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 13
Source File: DragonHeadRenderer.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
@InvokeEvent
public void onRenderPlayer(RenderPlayerEvent event) {
    if (CosmeticsUtil.shouldHide(EnumPurchaseType.DRAGON_HEAD)) return;
    EntityPlayer entity = event.getEntity();
    if (dragonCosmetic.isPurchasedBy(entity.getUniqueID()) && !entity.isInvisible()) {
        HyperiumPurchase packageIfReady = PurchaseApi.getInstance().getPackageIfReady(event.getEntity().getUniqueID());
        if (packageIfReady == null || packageIfReady.getCachedSettings().isDragonHeadDisabled()) return;

        GlStateManager.pushMatrix();
        GlStateManager.translate(event.getX(), event.getY(), event.getZ());
        renderHead(event.getEntity(), event.getPartialTicks());
        GlStateManager.popMatrix();
    }

}
 
Example 14
Source File: SurfaceHelper.java    From ForgeHax with MIT License 5 votes vote down vote up
public static void drawHead(ResourceLocation skinResource, double x, double y, float scale) {
  GlStateManager.pushMatrix();
  MC.renderEngine.bindTexture(skinResource);
  GlStateManager.color(1.0F, 1.0F, 1.0F, 1.F);
  GlStateManager.scale(scale, scale, scale);
  drawScaledCustomSizeModalRect(
      (x * (1 / scale)), (y * (1 / scale)), 8.0F, 8.0F, 8, 8, 12, 12, 64.0F, 64.0F);
  drawScaledCustomSizeModalRect(
      (x * (1 / scale)), (y * (1 / scale)), 40.0F, 8.0F, 8, 8, 12, 12, 64.0F, 64.0F);
  GlStateManager.popMatrix();
}
 
Example 15
Source File: HyperiumGuiNewChat.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void drawChat(int updateCounter, List<ChatLine> drawnChatLines, int scrollPos, boolean isScrolled, Minecraft mc) {
    if (mc.gameSettings.chatVisibility != EntityPlayer.EnumChatVisibility.HIDDEN) {
        int i = parent.getLineCount();
        boolean flag = false;
        int j = 0;
        int k = drawnChatLines.size();
        float f = mc.gameSettings.chatOpacity * 0.9F + 0.1F;

        if (k > 0) {
            if (parent.getChatOpen()) flag = true;

            float f1 = parent.getChatScale();
            int l = MathHelper.ceiling_float_int((float) parent.getChatWidth() / f1);
            GlStateManager.pushMatrix();
            GlStateManager.translate(2.0F, 20.0F, 0.0F);
            GlStateManager.scale(f1, f1, 1.0F);

            for (int i1 = 0; i1 + scrollPos < drawnChatLines.size() && i1 < i; ++i1) {
                ChatLine chatline = drawnChatLines.get(i1 + scrollPos);

                if (chatline != null) {
                    int j1 = updateCounter - chatline.getUpdatedCounter();

                    if (j1 < 200 || flag) {
                        double d0 = (double) j1 / 200.0D;
                        d0 = 1.0D - d0;
                        d0 = d0 * 10.0D;
                        d0 = MathHelper.clamp_double(d0, 0.0D, 1.0D);
                        d0 = d0 * d0;
                        int l1 = (int) (255.0D * d0);

                        if (flag) l1 = 255;

                        l1 = (int) ((float) l1 * f);
                        ++j;

                        if (l1 > 3) {
                            int i2 = 0;
                            int j2 = -i1 * 9;
                            if (!Settings.FASTCHAT)
                                Gui.drawRect(i2, j2 - 9, i2 + l + 4, j2, l1 / 2 << 24);
                            String s = chatline.getChatComponent().getFormattedText();
                            GlStateManager.enableBlend();
                            mc.fontRendererObj.drawStringWithShadow(s, (float) i2, (float) (j2 - 8), 16777215 + (l1 << 24));
                            GlStateManager.disableAlpha();
                            GlStateManager.disableBlend();
                        }
                    }
                }
            }

            if (flag) {
                int k2 = mc.fontRendererObj.FONT_HEIGHT;
                GlStateManager.translate(-3.0F, 0.0F, 0.0F);
                int l2 = k * k2 + k;
                int i3 = j * k2 + j;
                int j3 = scrollPos * i3 / k;
                int k1 = i3 * i3 / l2;

                if (l2 != i3) {
                    int k3 = j3 > 0 ? 170 : 96;
                    int l3 = isScrolled ? 13382451 : 3355562;
                    Gui.drawRect(0, -j3, 2, -j3 - k1, l3 + (k3 << 24));
                    Gui.drawRect(2, -j3, 1, -j3 - k1, 13421772 + (k3 << 24));
                }
            }

            GlStateManager.popMatrix();
        }
    }
}
 
Example 16
Source File: RenderInfestedLeaves.java    From ExNihiloAdscensio with MIT License 4 votes vote down vote up
@Override
public void renderTileEntityAt(TileInfestedLeaves tile, double x, double y, double z, float partialTicks, int destroyStage)
{
    if(tile != null)
    {
        long seed = tile.getWorld().rand.nextLong();
        int color = tile.getColor();
        
        IBlockState leafBlock = tile.getLeafBlock();
        IBakedModel leafModel = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(leafBlock);
        
        if(leafModel == null)
        {
            leafModel = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(Blocks.LEAVES.getDefaultState());
        }
        
        List<BakedQuad> leafQuads = Lists.newArrayList();
        
        for(EnumFacing side : EnumFacing.VALUES)
        {
            if(leafBlock.shouldSideBeRendered(tile.getWorld(), tile.getPos(), side))
            {
                leafQuads.addAll(leafModel.getQuads(leafBlock, side, seed));
            }
        }
        
        Tessellator tessellator = Tessellator.getInstance();
        VertexBuffer buffer = tessellator.getBuffer();
        
        bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        
        GlStateManager.pushMatrix();
        GlStateManager.translate(x, y, z);
        RenderHelper.disableStandardItemLighting();
        
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
        
        for(BakedQuad quad : leafQuads)
        {
            LightUtil.renderQuadColor(buffer, quad, color);
        }
        
        tessellator.draw();
        
        RenderHelper.enableStandardItemLighting();
        GlStateManager.popMatrix();
    }
}
 
Example 17
Source File: FontUtils.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static void drawItemQuantity(int x, int y, ItemStack item, String quantity, int mode)
{
    if(item == null || (quantity == null && item.stackSize <= 1))
        return;
    
    if(quantity == null)
    {
        switch(mode)
        {
            case 2:
                int q = item.stackSize;
                String postfix = "";
                for(int p = 0; p < 3 && q > 1000; p++)
                {
                    q/=1000;
                    postfix = prefixes[p];
                }
                quantity = Integer.toString(q)+postfix;
            break;
            case 1:
                quantity = "";
                if(item.stackSize/64 > 0)
                    quantity+=item.stackSize/64 + "s";
                if(item.stackSize%64 > 0)
                    quantity+=item.stackSize%64;
            break;
            default:
                quantity = Integer.toString(item.stackSize);
            break;
        }
    }
    
    double scale = quantity.length() > 2 ? 0.5 : 1;
    double sheight = 8*scale;
    double swidth = fontRenderer.getStringWidth(quantity)*scale;

    GlStateManager.disableLighting();
    GlStateManager.disableDepth();
    GlStateManager.pushMatrix();
        GlStateManager.translate(x + 16 - swidth, y + 16 - sheight, 0);
        GlStateManager.scale(scale, scale, 1);
        fontRenderer.drawStringWithShadow(quantity, 0, 0, 0xFFFFFF);
    GlStateManager.popMatrix();
    GlStateManager.enableLighting();
    GlStateManager.enableDepth();
}
 
Example 18
Source File: WorldProviderUnderWorld.java    From Wizardry with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void render(float partialTicks, WorldClient world, Minecraft mc) {
	EntityPlayer p = Minecraft.getMinecraft().player;
	if (p != null) {
		if (p.getEntityWorld().provider instanceof WorldProviderUnderWorld) {
			ResourceLocation sides = new ResourceLocation(Wizardry.MODID, "textures/misc/underworld_sky.png");
			ResourceLocation top = new ResourceLocation(Wizardry.MODID, "textures/misc/underworld_sky_top.png");
			ResourceLocation bottom = new ResourceLocation(Wizardry.MODID, "textures/misc/underworld_sky_bottom.png");
			Minecraft.getMinecraft().renderEngine.bindTexture(sides);
			GlStateManager.pushMatrix();
			GlStateManager.disableCull();
			GlStateManager.disableFog();
			GlStateManager.disableLighting();

			GlStateManager.depthMask(false);
			Tessellator tessellator = Tessellator.getInstance();
			BufferBuilder vertexbuffer = tessellator.getBuffer();

			for (int i = 0; i < 6; ++i) {
				GlStateManager.pushMatrix();

				Minecraft.getMinecraft().renderEngine.bindTexture(bottom);
				if (i == 3) {
					Minecraft.getMinecraft().renderEngine.bindTexture(top);
					GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
				}
				if (i == 1) {
					Minecraft.getMinecraft().renderEngine.bindTexture(sides);
					GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
				}
				if (i == 2) {
					Minecraft.getMinecraft().renderEngine.bindTexture(sides);
					GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
					GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
				}
				if (i == 4) {
					Minecraft.getMinecraft().renderEngine.bindTexture(sides);
					GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
					GlStateManager.rotate(270.0F, 0.0F, 1.0F, 0.0F);
				}
				if (i == 5) {
					Minecraft.getMinecraft().renderEngine.bindTexture(sides);
					GlStateManager.rotate(-90.0F, 0.0F, 0.0F, 1.0F);
					GlStateManager.rotate(-270.0F, 0.0F, 1.0F, 0.0F);
				}

				vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
				vertexbuffer.pos(-100.0D, -100.0D, -100.0D).tex(0.0D, 0.0D).endVertex();
				vertexbuffer.pos(-100.0D, -100.0D, 100.0D).tex(0.0D, 1.0D).endVertex();
				vertexbuffer.pos(100.0D, -100.0D, 100.0D).tex(1.0D, 1.0D).endVertex();
				vertexbuffer.pos(100.0D, -100.0D, -100.0D).tex(1.0D, 0.0D).endVertex();
				tessellator.draw();
				GlStateManager.popMatrix();
			}

			GlStateManager.depthMask(true);
			GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
			GlStateManager.enableCull();
			GlStateManager.enableLighting();
			GlStateManager.disableAlpha();
			GlStateManager.enableFog();
			GlStateManager.disableBlend();
			GlStateManager.popMatrix();
		}
	}
}
 
Example 19
Source File: HudRenderer.java    From Wizardry with GNU Lesser General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public static void renderHud(Post event) {
	ScaledResolution resolution = event.getResolution();
	int width = resolution.getScaledWidth();
	int height = resolution.getScaledHeight();
	EntityPlayer player = Minecraft.getMinecraft().player;

	ItemStack stack = BaublesSupport.getItem(player, ModItems.FAKE_HALO, ModItems.CREATIVE_HALO, ModItems.REAL_HALO);
	if (stack.isEmpty()) return;

	if (event.getType() == ElementType.EXPERIENCE) {

		int barSide = Minecraft.getMinecraft().gameSettings.mainHand == EnumHandSide.RIGHT ? 1 : -1;
		barSide *= Minecraft.getMinecraft().gameSettings.attackIndicator == 2 ? -1 : 1;

		int right = ((width / 2) - (100 / 2)) + 155 * barSide;
		int top = height - 17;

		HUD_TEXTURE.bind();

		GlStateManager.pushMatrix();
		GlStateManager.color(1.0F, 1.0F, 1.0F);
		emptyManaBar.draw(ClientTickHandler.getTicks(), right, top);
		emptyBurnoutBar.draw(ClientTickHandler.getTicks(), right, top + 6);
		GlStateManager.popMatrix();

		try (ManaManager.CapManagerBuilder mgr = ManaManager.forObject(player)) {
			double mana = mgr.getMana();
			double burnout = mgr.getBurnout();
			double maxMana = mgr.getMaxMana();
			double maxBurnout = mgr.getMaxBurnout();

			GlStateManager.pushMatrix();
			GlStateManager.color(1.0F, 1.0F, 1.0F);
			int visualManaLength = 0;
			if (mana > 0)
				visualManaLength = (int) (((mana * 100) / maxMana) % 101);
			fullManaBar.draw(ClientTickHandler.getTicks(), right, top, visualManaLength, 5);

			GlStateManager.color(1.0F, 1.0F, 1.0F);

			int visualBurnoutLength = 0;
			if (burnout > 0)
				visualBurnoutLength = (int) (((burnout * 100) / maxBurnout) % 101);
			fullBurnoutBar.draw(ClientTickHandler.getTicks(), right, top + 6, visualBurnoutLength, 5);

			GlStateManager.popMatrix();
		}
	}
}
 
Example 20
Source File: ChamsModule.java    From seppuku with GNU General Public License v3.0 4 votes vote down vote up
@Listener
public void renderEntity(EventRenderEntity event) {
    if (event.getEntity() != null && checkFilter(event.getEntity())) {

        boolean shadow = Minecraft.getMinecraft().getRenderManager().isRenderShadow();

        if (event.getStage() == EventStageable.EventStage.PRE) {

            Minecraft.getMinecraft().getRenderManager().setRenderShadow(false);
            Minecraft.getMinecraft().getRenderManager().setRenderOutlines(false);

            switch (this.mode.getValue()) {
                case NORMAL:
                    GlStateManager.pushMatrix();
                    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
                    glEnable(GL11.GL_POLYGON_OFFSET_FILL);
                    glPolygonOffset(1.0f, -1100000.0f);
                    GlStateManager.popMatrix();
                    break;
                case TEXTURE:
                    GlStateManager.pushMatrix();
                    glEnable(GL11.GL_POLYGON_OFFSET_FILL);
                    glPolygonOffset(1.0f, -1100000.0f);
                    glDisable(GL11.GL_TEXTURE_2D);
                    GlStateManager.color(1, 1, 1);
                    GlStateManager.popMatrix();
                    break;
                case FLAT:
                    GlStateManager.pushMatrix();
                    glEnable(GL11.GL_POLYGON_OFFSET_FILL);
                    glPolygonOffset(1.0f, -1100000.0f);
                    glDisable(GL11.GL_TEXTURE_2D);
                    glDisable(GL11.GL_LIGHTING);
                    GlStateManager.color(1, 1, 1);
                    GlStateManager.popMatrix();
                    break;
                case WIREFRAME:
                    GlStateManager.pushMatrix();
                    glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
                    glEnable(GL11.GL_POLYGON_OFFSET_LINE);
                    glPolygonOffset(1.0f, -1100000.0f);
                    glDisable(GL11.GL_TEXTURE_2D);
                    glDisable(GL11.GL_LIGHTING);
                    glEnable(GL_LINE_SMOOTH);
                    glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
                    glLineWidth(1);
                    GlStateManager.color(1, 1, 1);
                    GlStateManager.popMatrix();
                    break;
            }
        }
        if (event.getStage() == EventStageable.EventStage.POST) {

            Minecraft.getMinecraft().getRenderManager().setRenderShadow(shadow);

            switch (this.mode.getValue()) {
                case NORMAL:
                    GlStateManager.pushMatrix();
                    glDisable(GL11.GL_POLYGON_OFFSET_FILL);
                    glPolygonOffset(1.0f, 1100000.0f);
                    GlStateManager.popMatrix();
                    break;
                case TEXTURE:
                    GlStateManager.pushMatrix();
                    glDisable(GL11.GL_POLYGON_OFFSET_FILL);
                    glPolygonOffset(1.0f, 1100000.0f);
                    glEnable(GL11.GL_TEXTURE_2D);
                    GlStateManager.popMatrix();
                    break;
                case FLAT:
                    GlStateManager.pushMatrix();
                    glDisable(GL11.GL_POLYGON_OFFSET_FILL);
                    glPolygonOffset(1.0f, 1100000.0f);
                    glEnable(GL11.GL_TEXTURE_2D);
                    glEnable(GL11.GL_LIGHTING);
                    GlStateManager.popMatrix();
                    break;
                case WIREFRAME:
                    GlStateManager.pushMatrix();
                    glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
                    glDisable(GL11.GL_POLYGON_OFFSET_LINE);
                    glPolygonOffset(1.0f, 1100000.0f);
                    glEnable(GL11.GL_TEXTURE_2D);
                    glEnable(GL11.GL_LIGHTING);
                    glDisable(GL_LINE_SMOOTH);
                    GlStateManager.popMatrix();
                    break;
            }
        }
    }
}