Java Code Examples for org.lwjgl.opengl.GL11#glScalef()

The following examples show how to use org.lwjgl.opengl.GL11#glScalef() . 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: VanillaEnhancementsHud.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
@InvokeEvent
public void renderDamage(RenderHUDEvent e) {
    if (Settings.DAMAGE_ABOVE_HOTBAR) {
        ItemStack heldItemStack = mc.thePlayer.inventory.getCurrentItem();
        if (heldItemStack != null) {
            GL11.glPushMatrix();
            GL11.glScalef(0.5f, 0.5f, 0.5f);
            ScaledResolution res = ResolutionUtil.current();
            String attackDamage = getAttackDamageString(heldItemStack);
            int y = res.getScaledHeight() - 59;
            y += (mc.playerController.shouldDrawHUD() ? -1 : 14);
            y = y + mc.fontRendererObj.FONT_HEIGHT;
            y <<= 1;
            y += mc.fontRendererObj.FONT_HEIGHT;
            int x = res.getScaledWidth() - (mc.fontRendererObj.getStringWidth(attackDamage) >> 1);
            mc.fontRendererObj.drawString(attackDamage, x, y, 13421772);
            GL11.glScalef(2.0f, 2.0f, 2.0f);
            GL11.glPopMatrix();
        }
    }
}
 
Example 2
Source File: MoCRenderDeer.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
protected void stretch(MoCEntityDeer entitydeer)
{
    float f = entitydeer.getEdad() * 0.01F;
    float f1 = 0.0F;
    if (entitydeer.getType() == 1)
    {
        f1 = 1.7F;
    }
    else if (entitydeer.getType() == 2)
    {
        f1 = 1.3F;
    }
    else
    {
        f1 = f;
    }
    if (entitydeer.getIsAdult())
    {
        f = 1.0F;
    }
    GL11.glScalef(f1, f1, f1);
}
 
Example 3
Source File: RenderTracker.java    From WirelessRedstone with MIT License 6 votes vote down vote up
@SuppressWarnings("incomplete-switch")
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{
    switch(type)
    {
        case ENTITY:
            GL11.glScaled(1.9, 1.9, 1.9);
            renderTracker(item.getItemDamage());                
        break;
        case EQUIPPED:
        case EQUIPPED_FIRST_PERSON:
            GL11.glPushMatrix();
            GL11.glTranslated(0.4, 0.3, 0.5);
            GL11.glScaled(2, 2, 2);
            renderTracker(item.getItemDamage());
            GL11.glPopMatrix();
        break;
        case INVENTORY:
            GL11.glTranslated(0, -0.7, 0);
            GL11.glScalef(2, 2, 2);
            renderTracker(item.getItemDamage());
        break;
    }
}
 
Example 4
Source File: RenderItemPneumaticCilinder.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
private void render(float x, float y, float z, float scale){

        GL11.glPushMatrix();
        GL11.glRotatef(-90F, 1F, 0, 0);
        // GL11.glDisable(GL11.GL_LIGHTING);

        // Scale, Translate, Rotate
        GL11.glScalef(scale, scale, scale);
        GL11.glTranslatef(x, y, z);
        GL11.glRotatef(-90F, 1F, 0, 0);

        // Bind texture
        FMLClientHandler.instance().getClient().getTextureManager().bindTexture(Textures.MODEL_PNEUMATIC_CILINDER);

        // Render
        model.renderModel(1F / 16F);

        // GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glPopMatrix();
    }
 
Example 5
Source File: ItemChiselRenderer.java    From Chisel with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void renderItem(ItemRenderType type, ItemStack stack, Object... data)
{
    RenderHelper.enableGUIStandardItemLighting();

    renderItem.renderItemIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().renderEngine, stack, 0, 0);

    if(stack.stackTagCompound == null) return;

    ItemStack chiselTarget = ItemStack.loadItemStackFromNBT(stack.stackTagCompound.getCompoundTag("chiselTarget"));
    if(chiselTarget == null) return;

    GL11.glPushMatrix();
    GL11.glScalef(0.65f, 0.65f, 0.65f);
    GL11.glTranslatef(-8f, -8f, 0.0f);

    renderItem.renderItemIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().renderEngine, chiselTarget, 8, 8);

    GL11.glPopMatrix();
}
 
Example 6
Source File: Gui.java    From Slyther with MIT License 5 votes vote down vote up
public void drawCenteredString(String text, float x, float y, float scale, int color) {
    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glScalef(scale, scale, 1.0F);
    font.drawString(x / scale - font.getWidth(text) / 2.0F, y / scale - font.getHeight() / 2.0F, text, new org.newdawn.slick.Color(color));
    GL11.glPopMatrix();
}
 
Example 7
Source File: RenderTileInfusionClaw.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void renderWand(ItemStack wandStack, float ticks) {
    GL11.glRotatef(((ticks/3) / 20.0F) * (180F / (float)Math.PI), 0, 1f, 0);

    renderTopPart();

    if (wandStack != null && wandStack.stackSize > 0) {
        GL11.glPushMatrix();

        ItemWandCasting item = (ItemWandCasting) ConfigItems.itemWandCasting;
        ItemStack wandFocusStack = wandStack.copy();
        item.setFocus(wandFocusStack, new ItemStack(ConfigItems.itemFocusPrimal));

        GL11.glRotatef(180, 1, 0, 0);
        GL11.glScalef(0.5f, 0.5f, 0.5f);
        GL11.glTranslatef(0, MathHelper.sin((ticks / 3) / 10.0F) * 0.08F + 0.08F, 0);

        GL11.glTranslatef(0, -1.4924f, 0);
        if(item.isStaff(wandFocusStack)) {
            GL11.glTranslatef(0, -0.5f, 0);

            STAFF_RENDERER.renderItem(IItemRenderer.ItemRenderType.ENTITY, wandFocusStack);
        } else {
            WAND_RENDERER.renderItem(IItemRenderer.ItemRenderType.ENTITY, wandFocusStack);
        }
        GL11.glPopMatrix();
    }
}
 
Example 8
Source File: RenderItemTubeModule.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
private void render(float x, float y, float z, float scale, int itemDamage){
    module.setDirection(ForgeDirection.UP);
    GL11.glPushMatrix();
    scale *= 0.2 * (1 / module.getWidth());
    GL11.glScalef(scale, scale, scale);
    GL11.glDisable(GL11.GL_CULL_FACE);
    module.renderDynamic(x, y, z, 0, 0, true);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glPopMatrix();
}
 
Example 9
Source File: MoCRenderBear.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
protected void stretch(MoCEntityBear entitybear)
{
    float sizeFactor = entitybear.getEdad() * 0.01F;
    if (entitybear.getIsAdult())
    {
        sizeFactor = 1.0F;
    }
    sizeFactor *= entitybear.getBearSize();
    GL11.glScalef(sizeFactor, sizeFactor, sizeFactor);
}
 
Example 10
Source File: Gui.java    From Slyther with MIT License 5 votes vote down vote up
public void drawCenteredLargeString(String text, float x, float y, float scale, int color) {
    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glScalef(scale, scale, 1.0F);
    largeFont.drawString(x / scale - largeFont.getWidth(text) / 2.0F, y / scale - largeFont.getHeight() / 2.0F, text, new org.newdawn.slick.Color(color));
    GL11.glPopMatrix();
}
 
Example 11
Source File: RenderUtilsLiving.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public static void drawItem(double x, double y, double z, double offX, double offY, double scale, ItemStack item) {
	glSetup(x, y, z);
	
    GL11.glScaled(0.4*scale, 0.4*scale, 0);
    
    GL11.glTranslated(offX, offY, 0);
    if (item.getItem() instanceof BlockItem) GL11.glRotatef(180F, 1F, 180F, 10F);
    mc.getItemRenderer().renderItem(new ItemStack(item.getItem()), ItemCameraTransforms.TransformType.GUI);
    if (item.getItem() instanceof BlockItem) GL11.glRotatef(-180F, -1F, -180F, -10F);
    GL11.glDisable(GL11.GL_LIGHTING);
    
    GL11.glScalef(-0.05F, -0.05F, 0);
    
    if (item.getCount() > 0) {
	    int w = mc.fontRenderer.getStringWidth("x" + item.getCount()) / 2;
	    mc.fontRenderer.drawStringWithShadow("x" + item.getCount(), 7 - w, 5, 0xffffff);
    }
    
    GL11.glScalef(0.85F, 0.85F, 0.85F);
    
    int c = 0;
    for (Entry<Enchantment, Integer> m: EnchantmentHelper.getEnchantments(item).entrySet()) {
    	int w1 = mc.fontRenderer.getStringWidth(I18n.format(m.getKey().getName()).substring(0, 2) + m.getValue()) / 2;
    	mc.fontRenderer.drawStringWithShadow(
    			I18n.format(m.getKey().getName()).substring(0, 2) + m.getValue(), -4 - w1, c*10-1,
    			m.getKey() == Enchantments.VANISHING_CURSE || m.getKey() == Enchantments.BINDING_CURSE
    			? 0xff5050 : 0xffb0e0);
    	c--;
    }
    
    glCleanup();
}
 
Example 12
Source File: MoCRenderShark.java    From mocreaturesdev with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void doRenderLiving(EntityLiving entityliving, double d, double d1, double d2, float f, float f1)
{
    MoCEntityShark entityshark = (MoCEntityShark) entityliving;
    super.doRenderLiving(entityshark, d, d1, d2, f, f1);
    boolean flag = MoCreatures.proxy.getDisplayPetName() && !(entityshark.getName()).isEmpty();
    boolean flag1 = MoCreatures.proxy.getDisplayPetHealth();
    boolean flag2 = MoCreatures.proxy.getDisplayPetIcons();
    if (entityshark.renderName())
    {
        float f2 = 1.6F;
        float f3 = 0.01666667F * f2;
        float f4 = entityshark.getDistanceToEntity(renderManager.livingPlayer);
        if (f4 < 16F)
        {
            String s = "";
            s = (new StringBuilder()).append(s).append(entityshark.getName()).toString();
            float f5 = 0.1F;
            FontRenderer fontrenderer = getFontRendererFromRenderManager();
            GL11.glPushMatrix();
            GL11.glTranslatef((float) d + 0.0F, (float) d1 + f5, (float) d2);
            GL11.glNormal3f(0.0F, 1.0F, 0.0F);
            GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
            GL11.glScalef(-f3, -f3, f3);
            GL11.glDisable(2896 /* GL_LIGHTING */);
            Tessellator tessellator = Tessellator.instance;
            byte byte0 = -50;
            if (flag1)
            {
                GL11.glDisable(3553 /* GL_TEXTURE_2D */);
                if (!flag)
                {
                    byte0 += 8;
                }
                tessellator.startDrawingQuads();
                // might break SSP
                float f6 = entityshark.getHealth();
                float f7 = entityshark.getMaxHealth();
                float f8 = f6 / f7;
                float f9 = 40F * f8;
                tessellator.setColorRGBA_F(0.7F, 0.0F, 0.0F, 1.0F);
                tessellator.addVertex(-20F + f9, -10 + byte0, 0.0D);
                tessellator.addVertex(-20F + f9, -6 + byte0, 0.0D);
                tessellator.addVertex(20D, -6 + byte0, 0.0D);
                tessellator.addVertex(20D, -10 + byte0, 0.0D);
                tessellator.setColorRGBA_F(0.0F, 0.7F, 0.0F, 1.0F);
                tessellator.addVertex(-20D, -10 + byte0, 0.0D);
                tessellator.addVertex(-20D, -6 + byte0, 0.0D);
                tessellator.addVertex(f9 - 20F, -6 + byte0, 0.0D);
                tessellator.addVertex(f9 - 20F, -10 + byte0, 0.0D);
                tessellator.draw();
                GL11.glEnable(3553 /* GL_TEXTURE_2D */);
            }
            if (flag)
            {
                GL11.glDepthMask(false);
                GL11.glDisable(2929 /* GL_DEPTH_TEST */);
                GL11.glEnable(3042 /* GL_BLEND */);
                GL11.glBlendFunc(770, 771);
                GL11.glDisable(3553 /* GL_TEXTURE_2D */);
                tessellator.startDrawingQuads();
                int i = fontrenderer.getStringWidth(s) / 2;
                tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
                tessellator.addVertex(-i - 1, -1 + byte0, 0.0D);
                tessellator.addVertex(-i - 1, 8 + byte0, 0.0D);
                tessellator.addVertex(i + 1, 8 + byte0, 0.0D);
                tessellator.addVertex(i + 1, -1 + byte0, 0.0D);
                tessellator.draw();
                GL11.glEnable(3553 /* GL_TEXTURE_2D */);
                fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, 0x20ffffff);
                GL11.glEnable(2929 /* GL_DEPTH_TEST */);
                GL11.glDepthMask(true);
                fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, -1);
                GL11.glDisable(3042 /* GL_BLEND */);
                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            }
            GL11.glEnable(2896 /* GL_LIGHTING */);
            GL11.glPopMatrix();
        }
    }
}
 
Example 13
Source File: ModelAssemblyIOUnit.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
public void renderModel(float size, float[] angles, float clawProgress, EntityItem carriedItem){
    float clawTrans;
    float scaleFactor = 0.7F;

    IAssemblyRenderOverriding renderOverride = null;
    if(carriedItem != null) {
        renderOverride = AssemblyRenderOverriding.renderOverrides.get(carriedItem.getEntityItem());
        if(renderOverride != null) {
            clawTrans = renderOverride.getIOUnitClawShift(carriedItem.getEntityItem());
        } else {
            if(carriedItem.getEntityItem().getItem() instanceof ItemBlock) {
                clawTrans = 1.5F / 16F - clawProgress * 0.1F / 16F;
            } else {
                clawTrans = 1.5F / 16F - clawProgress * 1.4F / 16F;
                scaleFactor = 0.4F;
            }
        }
    } else {
        clawTrans = 1.5F / 16F - clawProgress * 1.5F / 16F;
    }
    Base.render(size);
    GL11.glPushMatrix();
    GL11.glRotatef(angles[0], 0, 1, 0);
    BaseTurn.render(size);
    BaseTurn2.render(size);
    GL11.glTranslated(0, 18 / 16F, 0);
    GL11.glRotatef(angles[1], 1, 0, 0);
    GL11.glTranslated(0, -18 / 16F, 0);
    ArmBase1.render(size);
    ArmBase2.render(size);
    SupportMiddle.render(size);
    GL11.glTranslated(0, 18 / 16F, 6 / 16F);
    GL11.glRotatef(angles[2], 1, 0, 0);
    GL11.glTranslated(0, -18 / 16F, -6 / 16F);
    ArmMiddle1.render(size);
    ArmMiddle2.render(size);
    GL11.glTranslated(0, 3 / 16F, 6 / 16F);
    GL11.glRotatef(angles[3], 1, 0, 0);
    GL11.glTranslated(0, -3 / 16F, -6 / 16F);
    ClawBase.render(size);
    GL11.glTranslated(0, 3 / 16F, 0);
    GL11.glRotatef(angles[4], 0, 0, 1);
    GL11.glTranslated(0, -3 / 16F, 0);
    ClawAxil.render(size);
    ClawTurn.render(size);
    GL11.glPushMatrix();
    GL11.glTranslated(clawTrans, 0, 0);
    Claw1.render(size);
    GL11.glTranslated(-2 * clawTrans, 0, 0);
    Claw2.render(size);
    GL11.glPopMatrix();

    if(carriedItem != null) {
        if(renderOverride == null || renderOverride.applyRenderChangeIOUnit(carriedItem.getEntityItem())) {
            GL11.glRotated(90, 1, 0, 0);
            GL11.glTranslated(0, carriedItem.getEntityItem().getItem() instanceof ItemBlock ? 1.5 / 16D : 0.5 / 16D, -3 / 16D);
            GL11.glRotated(-90, 0, 1, 0);

            GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
            customRenderItem.doRender(carriedItem, 0, 0, 0, 0, 0);
        }
    }

    GL11.glPopMatrix();
}
 
Example 14
Source File: OpenGLHelper.java    From Et-Futurum with The Unlicense 4 votes vote down vote up
public static void scale(float x, float y, float z) {
	GL11.glScalef(x, y, z);
}
 
Example 15
Source File: ImmediateModeOGLRenderer.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * @see org.newdawn.slick.opengl.renderer.SGL#glScalef(float, float, float)
 */
public void glScalef(float x, float y, float z) {
	GL11.glScalef(x, y, z);
}
 
Example 16
Source File: RabbitRenderer.java    From Et-Futurum with The Unlicense 4 votes vote down vote up
@Override
protected void preRenderCallback(EntityLivingBase entityliving, float patialTickTime) {
	GL11.glScalef(0.65F, 0.65F, 0.65F);
}
 
Example 17
Source File: TrueTypeFont.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 4 votes vote down vote up
public void drawString(float x, float y, String whatchars, int startIndex, int endIndex, float scaleX, float scaleY, int format, float... rgba) {
	if(rgba.length == 0) rgba = new float[]{1f,1f,1f,1f};
	GL11.glPushMatrix();
	GL11.glScalef (scaleX, scaleY, 1.0f);

	FloatObject floatObject = null;
	int charCurrent;


	float totalwidth = 0;
	int i = startIndex, d, c;
	float startY = 0;



	switch (format) {
		case ALIGN_RIGHT: {
			d = -1;
			c = correctR;

			while (i < endIndex) {
				if (whatchars.charAt(i) == '\n') startY -= fontHeight;
				i++;
			}
			break;
		}
		case ALIGN_CENTER: {
			for (int l = startIndex; l <= endIndex; l++) {
				charCurrent = whatchars.charAt(l);
				if (charCurrent == '\n') break;
				if (charCurrent < 256) {
					floatObject = charArray[charCurrent];
				} else {
					floatObject = (FloatObject)customChars.get( new Character( (char) charCurrent ) );
				}
				totalwidth += floatObject.width-correctL;
			}
			totalwidth /= -2;
		}
		case ALIGN_LEFT:
		default: {
			d = 1;
			c = correctL;
			break;
		}

	}
	GL11.glBindTexture(GL11.GL_TEXTURE_2D, fontTextureID);
	Tessellator t = Tessellator.instance;
	t.startDrawingQuads();
//	GL11.glBegin(GL11.GL_QUADS);
	if(rgba.length == 4) t.setColorRGBA_F(rgba[0], rgba[1], rgba[2], rgba[3]);
	while (i >= startIndex && i <= endIndex) {

		charCurrent = whatchars.charAt(i);
		if (charCurrent < 256) {
			floatObject = charArray[charCurrent];
		} else {
			floatObject = (FloatObject)customChars.get( new Character( (char) charCurrent ) );
		}

		if( floatObject != null ) {
			if (d < 0) totalwidth += (floatObject.width-c) * d;
				if (charCurrent == '\n') {
					startY -= fontHeight * d;
					totalwidth = 0;
					if (format == ALIGN_CENTER) {
						for (int l = i+1; l <= endIndex; l++) {
							charCurrent = whatchars.charAt(l);
							if (charCurrent == '\n') break;
							if (charCurrent < 256) {
								floatObject = charArray[charCurrent];
							} else {
								floatObject = (FloatObject)customChars.get( new Character( (char) charCurrent ) );
							}
							totalwidth += floatObject.width-correctL;
						}
						totalwidth /= -2;
					}
					//if center get next lines total width/2;
				}
				else {
					drawQuad((totalwidth + floatObject.width) + x/scaleX,
							 startY + y/scaleY,
							 totalwidth + x/scaleX,
							 (startY + floatObject.height) + y/scaleY,
						floatObject.storedX + floatObject.width,
						floatObject.storedY + floatObject.height,
						floatObject.storedX,
						floatObject.storedY);
					if (d > 0) totalwidth += (floatObject.width-c) * d ;
				}
				i += d;

		}
	}
	t.draw();
//	GL11.glEnd();

	GL11.glPopMatrix();
}
 
Example 18
Source File: TileEntityRendererMonitorStorageFluid.java    From ExtraCells1 with MIT License 4 votes vote down vote up
@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partialTickTime)
{
	if (tileentity instanceof TileEntityMonitorStorageFluid)
	{
		Fluid fluid = ((TileEntityMonitorStorageFluid) tileentity).getFluid();
		if (fluid == null || fluid.getIcon() == null)
			return;
		Icon fluidIcon = fluid.getFlowingIcon();

		GL11.glPushMatrix();
		GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);

		FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
		ForgeDirection d = ForgeDirection.getOrientation(tileentity.blockMetadata);
		GL11.glTranslated(x + 0.5D, y + 0.5D, z + 0.5D);
		GL11.glTranslated(d.offsetX * 0.76D, d.offsetY * 0.76D, d.offsetZ * 0.76D);
		if (d == ForgeDirection.UP)
		{
			GL11.glScalef(1.0F, -1.0F, 1.0F);
			GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
			GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
		}

		if (d == ForgeDirection.DOWN)
		{
			GL11.glScalef(1.0F, -1.0F, 1.0F);
			GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
			GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
		}

		if (d == ForgeDirection.EAST)
		{
			GL11.glScalef(-1.0F, -1.0F, -1.0F);
			GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
		}

		if (d == ForgeDirection.WEST)
		{
			GL11.glScalef(-1.0F, -1.0F, -1.0F);
			GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
		}

		if (d == ForgeDirection.NORTH)
		{
			GL11.glScalef(-1.0F, -1.0F, -1.0F);
		}

		if (d == ForgeDirection.SOUTH)
		{
			GL11.glScalef(-1.0F, -1.0F, -1.0F);
			GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
		}

		GL11.glTranslatef(0.01F, 0.13F, -0.24F);
		GL11.glScalef(0.0625F * 0.25F, 0.0625F * 0.25F, 0.01612903F);

		long qty = ((TileEntityMonitorStorageFluid) tileentity).getAmount();
		if (qty > 999999999999L)
		{
			qty = 999999999999L;
		}
		String msg = Long.toString(qty) + "mB";
		if (Extracells.shortenedBuckets)
		{
			if (qty > 1000000000L)
				msg = Long.toString(qty / 1000000000L) + "MegaB";
			else if (qty > 1000000L)
				msg = Long.toString(qty / 1000000L) + "KiloB";
			else if (qty > 9999L)
			{
				msg = Long.toString(qty / 1000L) + "B";
			}
		}

		TileEntityMonitorStorageFluid TE = (TileEntityMonitorStorageFluid) tileentity;
		if (TE.isMachineActive())
		{
			GL11.glTranslated(-8.6F, -16.3, -1.2F);
			Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
			Tessellator cake = Tessellator.instance;
			cake.startDrawingQuads();
			cake.setBrightness(255);
			cake.setColorRGBA_F(1.0f, 1.0f, 1.0f, 1.0f);
			cake.addVertexWithUV(0, 16, 0, fluidIcon.getMinU(), fluidIcon.getMaxV());
			cake.addVertexWithUV(16, 16, 0, fluidIcon.getMaxU(), fluidIcon.getMaxV());
			cake.addVertexWithUV(16, 0, 0, fluidIcon.getMaxU(), fluidIcon.getMinV());
			cake.addVertexWithUV(0, 0, 0, fluidIcon.getMinU(), fluidIcon.getMinV());
			cake.draw();

			int width = fr.getStringWidth(msg);
			GL11.glTranslatef(8.25F - 0.5F * width, 24.0F, 0);
			GL11.glScaled(1, 0.5, 1);
			fr.drawString(msg, 0, 0, 0x00FFFF);
		}
		GL11.glPopMatrix();
		GL11.glPopAttrib();
	}
}
 
Example 19
Source File: GLUtils.java    From ehacks-pro with GNU General Public License v3.0 4 votes vote down vote up
public static void drawSmallString(String s, int x, int y, int co) {

        GL11.glScalef(0.5f, 0.5f, 0.5f);
        Wrapper.INSTANCE.fontRenderer().drawStringWithShadow(s, x * 2, y * 2, co);
        GL11.glScalef(2.0f, 2.0f, 2.0f);
    }
 
Example 20
Source File: MoCRenderDolphin.java    From mocreaturesdev with GNU General Public License v3.0 4 votes vote down vote up
public void doRenderLiving2(EntityLiving entityliving, double d, double d1, double d2, float f, float f1)
{
    MoCEntityDolphin entitydolphin = (MoCEntityDolphin) entityliving;
    super.doRenderLiving(entitydolphin, d, d1, d2, f, f1);
    if (entitydolphin.renderName())
    {
        float f2 = 1.6F;
        float f3 = 0.01666667F * f2;
        float f4 = entityliving.getDistanceToEntity(renderManager.livingPlayer);
        String s = "";
        s = (new StringBuilder()).append(s).append(entitydolphin.getName()).toString();
        if ((f4 < 12F) && (s.length() > 0))
        {
            FontRenderer fontrenderer = getFontRendererFromRenderManager();
            GL11.glPushMatrix();
            GL11.glTranslatef((float) d + 0.0F, (float) d1 + 0.3F, (float) d2);
            GL11.glNormal3f(0.0F, 1.0F, 0.0F);
            GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
            GL11.glScalef(-f3, -f3, f3);
            GL11.glDisable(2896 /* GL_LIGHTING */);
            GL11.glDepthMask(false);
            GL11.glDisable(2929 /* GL_DEPTH_TEST */);
            GL11.glEnable(3042 /* GL_BLEND */);
            GL11.glBlendFunc(770, 771);
            Tessellator tessellator = Tessellator.instance;
            byte byte0 = -50;
            GL11.glDisable(3553 /* GL_TEXTURE_2D */);
            tessellator.startDrawingQuads();
            int i = fontrenderer.getStringWidth(s) / 2;
            tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
            tessellator.addVertex(-i - 1, -1 + byte0, 0.0D);
            tessellator.addVertex(-i - 1, 8 + byte0, 0.0D);
            tessellator.addVertex(i + 1, 8 + byte0, 0.0D);
            tessellator.addVertex(i + 1, -1 + byte0, 0.0D);
            if (MoCreatures.proxy.getDisplayPetHealth())
            {
                float f5 = entitydolphin.getHealth();
                float f6 = entitydolphin.getMaxHealth();
                float f7 = f5 / f6;
                float f8 = 40F * f7;
                tessellator.setColorRGBA_F(0.7F, 0.0F, 0.0F, 1.0F);
                tessellator.addVertex(-20F + f8, -10 + byte0, 0.0D);
                tessellator.addVertex(-20F + f8, -6 + byte0, 0.0D);
                tessellator.addVertex(20D, -6 + byte0, 0.0D);
                tessellator.addVertex(20D, -10 + byte0, 0.0D);
                tessellator.setColorRGBA_F(0.0F, 0.7F, 0.0F, 1.0F);
                tessellator.addVertex(-20D, -10 + byte0, 0.0D);
                tessellator.addVertex(-20D, -6 + byte0, 0.0D);
                tessellator.addVertex(f8 - 20F, -6 + byte0, 0.0D);
                tessellator.addVertex(f8 - 20F, -10 + byte0, 0.0D);
            }
            tessellator.draw();
            GL11.glEnable(3553 /* GL_TEXTURE_2D */);
            fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, 0x20ffffff);
            GL11.glEnable(2929 /* GL_DEPTH_TEST */);
            GL11.glDepthMask(true);
            fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, -1);
            GL11.glEnable(2896 /* GL_LIGHTING */);
            GL11.glDisable(3042 /* GL_BLEND */);
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            GL11.glPopMatrix();
        }
    }
}