Package net.minecraft.client.gui

Examples of net.minecraft.client.gui.FontRenderer


    int height = gui.getHeight();
    int x = gui.getLeft() + 16;
    int y = gui.getTop() + 12;
   
    Brew brew = recipe.getBrew();
    FontRenderer renderer = Minecraft.getMinecraft().fontRenderer;
    boolean unicode = renderer.getUnicodeFlag();
    renderer.setUnicodeFlag(true);
    String s = EnumChatFormatting.BOLD + String.format(StatCollector.translateToLocal("botaniamisc.brewOf"), StatCollector.translateToLocal(brew.getUnlocalizedName()));
    renderer.drawString(s, gui.getLeft() + gui.getWidth() / 2 - renderer.getStringWidth(s) / 2, y, 0x222222);
    renderer.setUnicodeFlag(unicode);
    PageText.renderText(x, y + 22, width, height, text);
   
    ItemStack book = Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem();
    if(book != null && book.getItem() instanceof ILexicon && ((ILexicon) book.getItem()).isKnowledgeUnlocked(book, BotaniaAPI.elvenKnowledge)) {
      renderItemAtLinePos(gui, 20, 2, y + 12, recipe.getOutput(new ItemStack(ModItems.vial)));
View Full Code Here


  }

  @Override
  @SideOnly(Side.CLIENT)
  public void renderManaBar(IGuiLexiconEntry gui, RecipeRuneAltar recipe, int mx, int my) {
    FontRenderer font = Minecraft.getMinecraft().fontRenderer;
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    String manaUsage = StatCollector.translateToLocal("botaniamisc.manaUsage");
    font.drawString(manaUsage, gui.getLeft() + gui.getWidth() / 2 - font.getStringWidth(manaUsage) / 2, gui.getTop() + 115, 0x66000000);

    int ratio = 10;
    int x = gui.getLeft() + gui.getWidth() / 2 - 50;
    int y = gui.getTop() + 125;

    if(mx > x + 1 && mx <= x + 101 && my > y - 14 && my <= y + 11)
      ratio = 1;

    HUDHandler.renderManaBar(x, y, 0x0000FF, 0.75F, recipe.getManaUsage(), TilePool.MAX_MANA / ratio);

    String ratioString = String.format(StatCollector.translateToLocal("botaniamisc.ratio"), ratio);

    boolean unicode = font.getUnicodeFlag();
    font.setUnicodeFlag(true);
    font.drawString(ratioString, x + 100 - font.getStringWidth(ratioString), y + 5, 0x99000000);
    font.setUnicodeFlag(unicode);    GL11.glDisable(GL11.GL_BLEND);
  }
View Full Code Here

        GL11.glRotatef(90, 1, 0, 0);

        GL11.glTranslatef(displayWidth / 2, 1F, displayHeight / 2);
        GL11.glRotatef(-90, 1, 0, 0);

        FontRenderer fontRenderer = binRenderer.func_147498_b();//getFontRenderer();

        int requiredWidth = Math.max(fontRenderer.getStringWidth(amount), 1);
        int lineHeight = fontRenderer.FONT_HEIGHT + 2;
        int requiredHeight = lineHeight * 1;
        float scaler = 0.4F;
        float scaleX = (displayWidth / requiredWidth);
        float scale = scaleX * scaler;

        if(maxScale > 0)
        {
          scale = Math.min(scale, maxScale);
        }

        GL11.glScalef(scale, -scale, scale);
        GL11.glDepthMask(false);

        int offsetX;
        int offsetY;
        int realHeight = (int)Math.floor(displayHeight / scale);
        int realWidth = (int)Math.floor(displayWidth / scale);

        offsetX = (realWidth - requiredWidth) / 2;
        offsetY = (realHeight - requiredHeight) / 2;

        GL11.glDisable(GL11.GL_LIGHTING);
        fontRenderer.drawString("\u00a7f" + amount, offsetX - (realWidth / 2), 1 + offsetY - (realHeight / 2), 1);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDepthMask(true);
        GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL);

        GL11.glPopMatrix();
View Full Code Here

    }

    GL11.glTranslatef(displayWidth / 2, 1F, displayHeight / 2);
    GL11.glRotatef(-90, 1, 0, 0);

    FontRenderer fontRenderer = func_147498_b();//getFontRenderer();

    int requiredWidth = Math.max(fontRenderer.getStringWidth(text), 1);
    int lineHeight = fontRenderer.FONT_HEIGHT + 2;
    int requiredHeight = lineHeight * 1;
    float scaler = 0.4F;
    float scaleX = (displayWidth / requiredWidth);
    float scale = scaleX * scaler;

    if(maxScale > 0)
    {
      scale = Math.min(scale, maxScale);
    }

    GL11.glScalef(scale, -scale, scale);
    GL11.glDepthMask(false);

    int offsetX;
    int offsetY;
    int realHeight = (int)Math.floor(displayHeight / scale);
    int realWidth = (int)Math.floor(displayWidth / scale);

    offsetX = (realWidth - requiredWidth) / 2;
    offsetY = (realHeight - requiredHeight) / 2;

    GL11.glDisable(GL11.GL_LIGHTING);
    fontRenderer.drawString("\u00a7f" + text, offsetX - (realWidth / 2), 1 + offsetY - (realHeight / 2), 1);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDepthMask(true);
    GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL);

    GL11.glPopMatrix();
View Full Code Here

      if(mc.thePlayer != null && mc.theWorld != null && !mc.isGamePaused())
      {
        EntityPlayer player = mc.thePlayer;
        World world = mc.thePlayer.worldObj;
 
        FontRenderer font = mc.fontRenderer;
 
        MovingObjectPosition pos = player.rayTrace(40.0D, 1.0F);
 
        if(pos != null)
        {
          int x = MathHelper.floor_double(pos.blockX);
          int y = MathHelper.floor_double(pos.blockY);
          int z = MathHelper.floor_double(pos.blockZ);
 
          Coord4D obj = new Coord4D(x, y, z, world.provider.dimensionId);
 
          if(Mekanism.debug && mc.currentScreen == null && !mc.gameSettings.showDebugInfo)
          {
            String tileDisplay = "";
 
            if(obj.getTileEntity(world) != null)
            {
              if(obj.getTileEntity(world).getClass() != null)
              {
                tileDisplay = obj.getTileEntity(world).getClass().getSimpleName();
              }
            }
 
            font.drawStringWithShadow("Block: " + obj.getBlock(world).getUnlocalizedName(), 1, 1, 0x404040);
            font.drawStringWithShadow("Metadata: " + obj.getMetadata(world), 1, 10, 0x404040);
            font.drawStringWithShadow("Location: " + MekanismUtils.getCoordDisplay(obj), 1, 19, 0x404040);
            font.drawStringWithShadow("TileEntity: " + tileDisplay, 1, 28, 0x404040);
            font.drawStringWithShadow("Side: " + pos.sideHit, 1, 37, 0x404040);
          }
        }
 
        if(player != null && mc.currentScreen == null && player.getEquipmentInSlot(3) != null)
        {
          ItemStack stack = player.getEquipmentInSlot(3);
 
          ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
 
          int x = scaledresolution.getScaledWidth();
          int y = scaledresolution.getScaledHeight();
 
          if(stack.getItem() instanceof ItemJetpack)
          {
            ItemJetpack jetpack = (ItemJetpack)stack.getItem();
 
            font.drawStringWithShadow("Mode: " + jetpack.getMode(stack).getName(), 1, y - 20, 0x404040);
            font.drawStringWithShadow("Hydrogen: " + jetpack.getStored(stack), 1, y - 11, 0x404040);
          }
          else if(stack.getItem() instanceof ItemScubaTank)
          {
            ItemScubaTank scubaTank = (ItemScubaTank)stack.getItem();
            String state = (scubaTank.getFlowing(stack) ? EnumColor.DARK_GREEN + "On" : EnumColor.DARK_RED + "Off");
 
            font.drawStringWithShadow("Mode: " + state, 1, y - 20, 0x404040);
            font.drawStringWithShadow("Oxygen: " + scubaTank.getStored(stack), 1, y - 11, 0x404040);
          }
        }
 
        Set<String> copy = (Set)((HashSet)Mekanism.jetpackOn).clone();
 
View Full Code Here

    public void drawButton(Minecraft minecraft, int i, int j)
    {
        if(!visible)
            return;

        FontRenderer fontrenderer = minecraft.fontRenderer;
        minecraft.renderEngine.bindTexture(guiTex);
        GL11.glColor4f(1, 1, 1, 1);
        boolean flag = i >= xPosition && j >= yPosition && i < xPosition + width && j < yPosition + height;
        int k = getHoverState(flag);
        drawTexturedModalRect(xPosition, yPosition, 0, 46 + k * 20, width / 2, height / 2);//top left
View Full Code Here

        slotClickHandlers.addFirst(handler);
    }

    public static FontRenderer getFontRenderer(ItemStack stack) {
        if (stack != null && stack.getItem() != null) {
            FontRenderer f = stack.getItem().getFontRenderer(stack);
            if (f != null)
                return f;
        }
        return fontRenderer;
    }
View Full Code Here

    {
        double d3 = par1EntityLivingBase.getDistanceSqToEntity(this.renderManager.livingPlayer);

        if (d3 <= par9 * par9)
        {
            FontRenderer fontrenderer = this.getFontRendererFromRenderManager();
            float f = 1.6F;
            float f1 = 0.016666668F * f;
            GL11.glPushMatrix();
            GL11.glTranslatef((float) par3 + 0.0F, (float) par5 + par1EntityLivingBase.height + 0.55F, (float) par7);
            GL11.glNormal3f(0.0F, 1.0F, 0.0F);
            GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
            GL11.glScalef(-f1, -f1, f1);
            GL11.glDisable(GL11.GL_LIGHTING);
            GL11.glDepthMask(false);
            GL11.glDisable(GL11.GL_DEPTH_TEST);
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
            Tessellator tessellator = Tessellator.instance;
            byte b0 = 0;

            if (par2Str.equals("deadmau5"))
            {
                b0 = -10;
            }

            GL11.glDisable(GL11.GL_TEXTURE_2D);
            tessellator.startDrawingQuads();
            int j = fontrenderer.getStringWidth(par2Str) / 2;
            tessellator.setColorRGBA_F(cR, cG, cB, 0.25F);
            tessellator.addVertex(-j - 1, -1 + b0, 0.0D);
            tessellator.addVertex(-j - 1, 8 + b0, 0.0D);
            tessellator.addVertex(j + 1, 8 + b0, 0.0D);
            tessellator.addVertex(j + 1, -1 + b0, 0.0D);
            tessellator.draw();
            GL11.glEnable(GL11.GL_TEXTURE_2D);
            fontrenderer.drawString(par2Str, -fontrenderer.getStringWidth(par2Str) / 2, b0, 553648127);
            GL11.glEnable(GL11.GL_DEPTH_TEST);
            GL11.glDepthMask(true);
            fontrenderer.drawString(par2Str, -fontrenderer.getStringWidth(par2Str) / 2, b0, -1);
            GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glDisable(GL11.GL_BLEND);
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            GL11.glPopMatrix();
        }
View Full Code Here

    @Override
    public void drawButton(Minecraft p_146112_1_, int p_146112_2_, int p_146112_3_)
    {
        if (this.visible)
        {
            FontRenderer fontrenderer = p_146112_1_.fontRenderer;
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            this.field_146123_n = p_146112_2_ >= this.xPosition && p_146112_3_ >= this.yPosition && p_146112_2_ < this.xPosition + this.width && p_146112_3_ < this.yPosition + this.height;
            int k = this.getHoverState(this.field_146123_n);
            GL11.glEnable(GL11.GL_BLEND);
            OpenGlHelper.glBlendFunc(770, 771, 1, 0);
View Full Code Here

        Gui.drawRect(this.xPosition + this.width - 2, this.sliderPos + 1, this.xPosition + this.width - 1, this.sliderPos + 14, sliderColor);
        Gui.drawRect(this.xPosition + this.width - 9, this.sliderPos, this.xPosition + this.width - 1, this.sliderPos + 1, sliderColor);
        Gui.drawRect(this.xPosition + this.width - 9, this.sliderPos + 15, this.xPosition + this.width - 1, this.sliderPos + 14, sliderColor);

        int currentDrawHeight = this.yPosition + 1 - (int) Math.floor((this.listContents.size() * GuiElementGradientList.BUTTON_HEIGHT - this.height) * this.getSliderPercentage());
        FontRenderer fontRenderer = FMLClientHandler.instance().getClient().fontRenderer;

        for (int i = 0; i < this.listContents.size(); i++)
        {
            ListElement displayButton = this.listContents.get(i);

            if (displayButton != null && displayButton.value != null && !displayButton.value.isEmpty())
            {
                int yCoord0 = currentDrawHeight;
                int yCoord1 = currentDrawHeight + GuiElementGradientList.BUTTON_HEIGHT - 1;

                if (yCoord1 > this.yPosition && yCoord0 < this.yPosition + this.height)
                {
                    yCoord0 = Math.max(this.yPosition + 1, yCoord0);
                    yCoord1 = Math.min(this.yPosition + this.height - 1, yCoord1);

                    int color = i == this.selectedIndex ? GCCoreUtil.to32BitColor(255, 35, 35, 35) : GCCoreUtil.to32BitColor(255, 25, 25, 25);

                    Gui.drawRect(this.xPosition + 1, yCoord0, this.xPosition + this.width - 10, yCoord1, color);

                    if (currentDrawHeight + GuiElementGradientList.BUTTON_HEIGHT / 2 - fontRenderer.FONT_HEIGHT / 2 > this.yPosition && currentDrawHeight + GuiElementGradientList.BUTTON_HEIGHT / 2 + fontRenderer.FONT_HEIGHT / 2 < this.yPosition + this.height)
                    {
                        fontRenderer.drawString(displayButton.value, this.xPosition + (this.width - 10) / 2 - fontRenderer.getStringWidth(displayButton.value) / 2, currentDrawHeight + GuiElementGradientList.BUTTON_HEIGHT / 2 - fontRenderer.FONT_HEIGHT / 2, displayButton.color);
                    }

                }

                currentDrawHeight += GuiElementGradientList.BUTTON_HEIGHT;
View Full Code Here

TOP

Related Classes of net.minecraft.client.gui.FontRenderer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.