当前位置: 首页>>代码示例>>Java>>正文


Java FontRenderer类代码示例

本文整理汇总了Java中net.minecraft.client.gui.FontRenderer的典型用法代码示例。如果您正苦于以下问题:Java FontRenderer类的具体用法?Java FontRenderer怎么用?Java FontRenderer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FontRenderer类属于net.minecraft.client.gui包,在下文中一共展示了FontRenderer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: GuiUnitProgrammer

import net.minecraft.client.gui.FontRenderer; //导入依赖的package包/类
public GuiUnitProgrammer(List<IProgWidget> progWidgets, FontRenderer fontRenderer, int guiLeft, int guiTop,
                         int width, int height, int xSize, int startX, int startY, int areaWidth, int areaHeight, int translatedX,
                         int translatedY, int lastZoom) {
    this.fontRenderer = fontRenderer;
    this.progWidgets = progWidgets;
    this.guiLeft = guiLeft;
    this.guiTop = guiTop;
    setWorldAndResolution(Minecraft.getMinecraft(), width, height);
    this.xSize = xSize;
    this.startX = startX;
    this.startY = startY;
    this.areaWidth = areaWidth;
    this.areaHeight = areaHeight;
    this.translatedX = translatedX;
    this.translatedY = translatedY;
    this.lastZoom = lastZoom;

    scaleScroll = new WidgetVerticalScrollbar(guiLeft + 302, guiTop + 40, 129).setStates(9).setCurrentState(lastZoom).setListening(true);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:20,代码来源:GuiUnitProgrammer.java

示例2: cacheActiveRenderInfo

import net.minecraft.client.gui.FontRenderer; //导入依赖的package包/类
public void cacheActiveRenderInfo(World worldIn, TextureManager textureManagerIn, FontRenderer fontrendererIn, Entity entityIn, float partialTicks)
{
    if (this.worldObj != worldIn)
    {
        this.setWorld(worldIn);
    }

    this.renderEngine = textureManagerIn;
    this.entity = entityIn;
    this.fontRenderer = fontrendererIn;
    this.entityYaw = entityIn.prevRotationYaw + (entityIn.rotationYaw - entityIn.prevRotationYaw) * partialTicks;
    this.entityPitch = entityIn.prevRotationPitch + (entityIn.rotationPitch - entityIn.prevRotationPitch) * partialTicks;
    this.entityX = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks;
    this.entityY = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks;
    this.entityZ = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:17,代码来源:TileEntityRendererDispatcher.java

示例3: func_178663_a

import net.minecraft.client.gui.FontRenderer; //导入依赖的package包/类
public void func_178663_a(float p_178663_1_, int alpha)
{
    int i = -1;
    String s = FontRenderer.getFormatFromString(this.field_178676_b.getColorPrefix());

    if (s.length() >= 2)
    {
        i = Minecraft.getMinecraft().fontRendererObj.getColorCode(s.charAt(1));
    }

    if (i >= 0)
    {
        float f = (float)(i >> 16 & 255) / 255.0F;
        float f1 = (float)(i >> 8 & 255) / 255.0F;
        float f2 = (float)(i & 255) / 255.0F;
        Gui.drawRect(1, 1, 15, 15, MathHelper.func_180183_b(f * p_178663_1_, f1 * p_178663_1_, f2 * p_178663_1_) | alpha << 24);
    }

    Minecraft.getMinecraft().getTextureManager().bindTexture(this.field_178677_c);
    GlStateManager.color(p_178663_1_, p_178663_1_, p_178663_1_, (float)alpha / 255.0F);
    Gui.drawScaledCustomSizeModalRect(2, 2, 8.0F, 8.0F, 8, 8, 12, 12, 64.0F, 64.0F);
    Gui.drawScaledCustomSizeModalRect(2, 2, 40.0F, 8.0F, 8, 8, 12, 12, 64.0F, 64.0F);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:24,代码来源:TeleportToTeam.java

示例4: renderExtraInfo

import net.minecraft.client.gui.FontRenderer; //导入依赖的package包/类
@Override
public void renderExtraInfo() {
    if (getExtraStringInfo() != null) {
        GL11.glPushMatrix();
        GL11.glScaled(0.5, 0.5, 0.5);
        FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
        String[] splittedInfo = WordUtils.wrap(getExtraStringInfo(), 40).split(System.getProperty("line.separator"));
        for (int i = 0; i < splittedInfo.length; i++) {
            int stringLength = fr.getStringWidth(splittedInfo[i]);
            int startX = getWidth() / 2 - stringLength / 4;
            int startY = getHeight() / 2 - (fr.FONT_HEIGHT + 1) * (splittedInfo.length - 1) / 4 + (fr.FONT_HEIGHT + 1) * i / 2 - fr.FONT_HEIGHT / 4;
            Gui.drawRect(startX * 2 - 1, startY * 2 - 1, startX * 2 + stringLength + 1, startY * 2 + fr.FONT_HEIGHT + 1, 0xFFFFFFFF);
            fr.drawString(splittedInfo[i], startX * 2, startY * 2, 0xFF000000);
        }
        GL11.glPopMatrix();
        GL11.glColor4d(1, 1, 1, 1);
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:19,代码来源:ProgWidget.java

示例5: drawButton

import net.minecraft.client.gui.FontRenderer; //导入依赖的package包/类
/**
 * Draws this button to the screen.
 */
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
	if (this.visible) {
		FontRenderer fontrenderer = mc.fontRenderer;
		this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
		int j = 14737632;

		if (packedFGColour != 0) {
			j = packedFGColour;
		}

		if (this.displayString.equals("\u2718")) {
			j = 0xFF0000;
		} else if (this.displayString.equals("\u2714")) {
			j = 0x00FF00;
		}

		this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, j);
	}
}
 
开发者ID:Zundrel,项目名称:Never-Enough-Currency,代码行数:23,代码来源:GuiClearButton.java

示例6: generateNewRandomName

import net.minecraft.client.gui.FontRenderer; //导入依赖的package包/类
/**
 * Randomly generates a new name built up of 3 or 4 randomly selected words.
 */
public String generateNewRandomName(FontRenderer p_148334_1_, int p_148334_2_)
{
    int i = this.rand.nextInt(2) + 3;
    String s = "";

    for (int j = 0; j < i; ++j)
    {
        if (j > 0)
        {
            s = s + " ";
        }

        s = s + this.namePartsArray[this.rand.nextInt(this.namePartsArray.length)];
    }

    List<String> list = p_148334_1_.listFormattedStringToWidth(s, p_148334_2_);
    return org.apache.commons.lang3.StringUtils.join((Iterable)(list.size() >= 2 ? list.subList(0, 2) : list), " ");
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:22,代码来源:EnchantmentNameParts.java

示例7: prepare

import net.minecraft.client.gui.FontRenderer; //导入依赖的package包/类
public void prepare(World p_190056_1_, TextureManager p_190056_2_, FontRenderer p_190056_3_, Entity p_190056_4_, RayTraceResult p_190056_5_, float p_190056_6_)
{
    if (this.worldObj != p_190056_1_)
    {
        this.setWorld(p_190056_1_);
    }

    this.renderEngine = p_190056_2_;
    this.entity = p_190056_4_;
    this.fontRenderer = p_190056_3_;
    this.cameraHitResult = p_190056_5_;
    this.entityYaw = p_190056_4_.prevRotationYaw + (p_190056_4_.rotationYaw - p_190056_4_.prevRotationYaw) * p_190056_6_;
    this.entityPitch = p_190056_4_.prevRotationPitch + (p_190056_4_.rotationPitch - p_190056_4_.prevRotationPitch) * p_190056_6_;
    this.entityX = p_190056_4_.lastTickPosX + (p_190056_4_.posX - p_190056_4_.lastTickPosX) * (double)p_190056_6_;
    this.entityY = p_190056_4_.lastTickPosY + (p_190056_4_.posY - p_190056_4_.lastTickPosY) * (double)p_190056_6_;
    this.entityZ = p_190056_4_.lastTickPosZ + (p_190056_4_.posZ - p_190056_4_.lastTickPosZ) * (double)p_190056_6_;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:TileEntityRendererDispatcher.java

示例8: getButtonText

import net.minecraft.client.gui.FontRenderer; //导入依赖的package包/类
private String getButtonText(ShaderOption so, int btnWidth)
{
    String s = so.getNameText();

    if (so instanceof ShaderOptionScreen)
    {
        ShaderOptionScreen shaderoptionscreen = (ShaderOptionScreen)so;
        return s + "...";
    }
    else
    {
        FontRenderer fontrenderer = Config.getMinecraft().fontRendererObj;

        for (int i = fontrenderer.getStringWidth(": " + Lang.getOff()) + 5; fontrenderer.getStringWidth(s) + i >= btnWidth && s.length() > 0; s = s.substring(0, s.length() - 1))
        {
            ;
        }

        String s1 = so.isChanged() ? so.getValueColor(so.getValue()) : "";
        String s2 = so.getValueText(so.getValue());
        return s + ": " + s1 + s2;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:24,代码来源:GuiShaderOptions.java

示例9: drawForegroundLayer

import net.minecraft.client.gui.FontRenderer; //导入依赖的package包/类
@Override
public void drawForegroundLayer(BasicTeslaGuiContainer container, int guiX, int guiY, int mouseX, int mouseY) {
    super.drawForegroundLayer(container, guiX, guiY, mouseX, mouseY);
    if (this.tile != null) {
        long timeLeft = 0;
        long generatingRate = 0;
        if (this.tile.getGeneratedPowerStored() > 0) {
            timeLeft = ((this.tile.getGeneratedPowerStored() / 2) / this.tile.getGeneratedPowerReleaseRate()) / 20;
            generatingRate = this.tile.getGeneratedPowerReleaseRate();
        }
        FontRenderer renderer = Minecraft.getMinecraft().fontRenderer;
        GlStateManager.pushMatrix();
        GlStateManager.translate(this.getLeft() + 2, this.getTop() + 2, 0);
        GlStateManager.scale(1, 1, 1);
        renderer.drawString(TextFormatting.DARK_GRAY + new TextComponentTranslation("text.industrialforegoing.display.burning").getFormattedText(), 4, 4, 0xFFFFFF);
        renderer.drawString(TextFormatting.DARK_GRAY + getFormatedTime(timeLeft * 1000), 8, (renderer.FONT_HEIGHT) + 5, 0xFFFFFF);
        renderer.drawString(TextFormatting.DARK_GRAY + new TextComponentTranslation("text.industrialforegoing.display.producing").getFormattedText(), 4, 2 * (renderer.FONT_HEIGHT) + 9, 0xFFFFFF);
        renderer.drawString(TextFormatting.DARK_GRAY + "" + generatingRate + " RF/tick", 8, 3 * (renderer.FONT_HEIGHT) + 10, 0xFFFFFF);
        GlStateManager.popMatrix();
    }
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:22,代码来源:PetrifiedFuelInfoPiece.java

示例10: drawForegroundLayer

import net.minecraft.client.gui.FontRenderer; //导入依赖的package包/类
@Override
public void drawForegroundLayer(BasicTeslaGuiContainer container, int guiX, int guiY, int mouseX, int mouseY) {
    super.drawForegroundLayer(container, guiX, guiY, mouseX, mouseY);
    if (this.tile != null) {
        FontRenderer renderer = Minecraft.getMinecraft().fontRenderer;
        GlStateManager.pushMatrix();
        GlStateManager.translate(this.getLeft() + 2, this.getTop() + 8, 0);
        GlStateManager.scale(1, 1, 1);
        if (!tile.getItemStack().isEmpty()) {
            ItemStackUtils.renderItemIntoGUI(tile.getItemStack(), 1, 0, 7);
            String display = new TextComponentTranslation(tile.getDisplayNameUnlocalized()).getUnformattedText();
            renderer.drawString(TextFormatting.DARK_GRAY + display.substring(0, Math.min(display.length(), 21)) + (display.length() > 21 ? "." : ""), 20, 4, 0xFFFFFF);
            renderer.drawString(TextFormatting.DARK_GRAY + new TextComponentTranslation("text.industrialforegoing.display.amount").getUnformattedText() + " " + new DecimalFormat().format(tile.getAmount()), 4, (renderer.FONT_HEIGHT) * 3, 0xFFFFFF);
        } else {
            renderer.drawString(TextFormatting.DARK_GRAY + new TextComponentTranslation("text.industrialforegoing.display.empty").getFormattedText(), 4, 4, 0xFFFFFF);
        }
        GlStateManager.popMatrix();
    }
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:20,代码来源:BlackHoleInfoPiece.java

示例11: drawButton

import net.minecraft.client.gui.FontRenderer; //导入依赖的package包/类
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks)
{
	if (this.visible)
	{
		int x = this.x + this.parentGui.getGuiLeft();
		FontRenderer fontrenderer = mc.fontRenderer;
		int k = this.getHoverState(this.hovered);
		mc.getTextureManager().bindTexture(GuiPlayerInventoryExtended.background);
		GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
		this.hovered = mouseX >= x && mouseY >= this.y && mouseX < x + this.width && mouseY < this.y + this.height;
		GlStateManager.enableBlend();
		GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
		GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
		GlStateManager.pushMatrix();
		GlStateManager.translate(0, 0, 200);
		HarshenClientUtils.drawTexture(x, this.y, 16.9f, (k  - 1) * 7f, 7f, 7f,  24, 24, 24, 24);
		if (k!=1)
			this.drawCenteredString(fontrenderer, I18n.translateToLocalFormatted(this.displayString), x + 5, this.y + this.height, 0xffffff);
		GlStateManager.popMatrix();

		this.mouseDragged(mc, mouseX, mouseY);
	}
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:25,代码来源:GuiHarshenButton.java

示例12: drawSlot

import net.minecraft.client.gui.FontRenderer; //导入依赖的package包/类
@Override
protected void drawSlot(int idx, int right, int top, int height, Tessellator tess)
{
    if(idx >= 0 && idx < channels.size())
    {
        FontRenderer font = this.parent.getFontRenderer();
        String channel = channels.get(idx);
        GlStateManager.pushMatrix();
        GlStateManager.scale(0.5F, 0.5F, 1F);
        String name = font.trimStringToWidth(channel.substring(channel.indexOf(":") + 1), (listWidth - 10) * 2);
        if(channel.startsWith("public:"))
        {
            name = I18n.translateToLocal("glass.gui.public") + " " + name;
        }
        font.drawString(name, (this.left + 2) * 2, top * 2, idx % 2 == 0 ? 0xFFFFFF : 0xAAAAAA);
        GlStateManager.popMatrix();
    }
}
 
开发者ID:iChun,项目名称:GeneralLaymansAestheticSpyingScreen,代码行数:19,代码来源:GuiChannelList.java

示例13: renderFreq

import net.minecraft.client.gui.FontRenderer; //导入依赖的package包/类
private static void renderFreq(int freq) {
    float scale = 1 / 64F;

    GlStateManager.pushMatrix();
    GlStateManager.rotate(90, 0, 1, 0);
    GlStateManager.rotate(90, 1, 0, 0);
    GlStateManager.translate(0, -5 / 16D, 0.374);
    GlStateManager.scale(scale, scale, scale);

    FontRenderer font = Minecraft.getMinecraft().fontRendererObj;
    String s = Integer.toString(freq);
    GlStateManager.depthMask(false);
    font.drawString(s, -font.getStringWidth(s) / 2, 0, 0);
    GlStateManager.depthMask(true);

    GlStateManager.popMatrix();
}
 
开发者ID:TheCBProject,项目名称:WirelessRedstone,代码行数:18,代码来源:RenderWireless.java

示例14: getTeamColor

import net.minecraft.client.gui.FontRenderer; //导入依赖的package包/类
protected int getTeamColor(T entityIn)
{
    int i = 16777215;
    ScorePlayerTeam scoreplayerteam = (ScorePlayerTeam)entityIn.getTeam();

    if (scoreplayerteam != null)
    {
        String s = FontRenderer.getFormatFromString(scoreplayerteam.getColorPrefix());

        if (s.length() >= 2)
        {
            i = this.getFontRendererFromRenderManager().getColorCode(s.charAt(1));
        }
    }

    return i;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:18,代码来源:Render.java

示例15: renderIcon

import net.minecraft.client.gui.FontRenderer; //导入依赖的package包/类
public void renderIcon(float p_178663_1_, int alpha)
{
    int i = -1;
    String s = FontRenderer.getFormatFromString(this.team.getColorPrefix());

    if (s.length() >= 2)
    {
        i = Minecraft.getMinecraft().fontRendererObj.getColorCode(s.charAt(1));
    }

    if (i >= 0)
    {
        float f = (float)(i >> 16 & 255) / 255.0F;
        float f1 = (float)(i >> 8 & 255) / 255.0F;
        float f2 = (float)(i & 255) / 255.0F;
        Gui.drawRect(1, 1, 15, 15, MathHelper.rgb(f * p_178663_1_, f1 * p_178663_1_, f2 * p_178663_1_) | alpha << 24);
    }

    Minecraft.getMinecraft().getTextureManager().bindTexture(this.location);
    GlStateManager.color(p_178663_1_, p_178663_1_, p_178663_1_, (float)alpha / 255.0F);
    Gui.drawScaledCustomSizeModalRect(2, 2, 8.0F, 8.0F, 8, 8, 12, 12, 64.0F, 64.0F);
    Gui.drawScaledCustomSizeModalRect(2, 2, 40.0F, 8.0F, 8, 8, 12, 12, 64.0F, 64.0F);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:24,代码来源:TeleportToTeam.java


注:本文中的net.minecraft.client.gui.FontRenderer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。