當前位置: 首頁>>代碼示例>>Java>>正文


Java TextFormatting.ITALIC屬性代碼示例

本文整理匯總了Java中net.minecraft.util.text.TextFormatting.ITALIC屬性的典型用法代碼示例。如果您正苦於以下問題:Java TextFormatting.ITALIC屬性的具體用法?Java TextFormatting.ITALIC怎麽用?Java TextFormatting.ITALIC使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在net.minecraft.util.text.TextFormatting的用法示例。


在下文中一共展示了TextFormatting.ITALIC屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleFluidContainerTooltip

private void handleFluidContainerTooltip(ItemTooltipEvent event) {
    FluidStack fluidStack = FluidUtil.getFluidContained(event.getItemStack());
    if (fluidStack != null && fluidStack.amount > 0) {
        String key = "gui.tooltip.item." + fluidStack.getFluid().getName() + "_bucket";
        if (I18n.hasKey(key)) {
            if (event.getToolTip().get(event.getToolTip().size() - 1).contains("Minecraft Forge")) {
                // bit of a kludge!  otherwise the blue "Minecraft Forge" string gets shown twice
                event.getToolTip().remove(event.getToolTip().size() - 1);
            }
            String prefix = "";
            if (!FluidRegistry.getDefaultFluidName(fluidStack.getFluid()).startsWith(Names.MOD_ID)) {
                // fluid is owned by another mod; let's make it clear that this tooltip applies to PneumaticCraft
                prefix = TextFormatting.DARK_AQUA + "" + TextFormatting.ITALIC + "[" + Names.MOD_NAME + "] ";
            }
            if (PneumaticCraftRepressurized.proxy.isSneakingInGui()) {
                String translatedInfo = TextFormatting.AQUA + I18n.format(key);
                event.getToolTip().addAll(PneumaticCraftUtils.convertStringIntoList(prefix + translatedInfo, 40));
            } else {
                event.getToolTip().add(TextFormatting.AQUA + I18n.format("gui.tooltip.sneakForInfo"));
            }
        }
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:23,代碼來源:ClientEventHandler.java

示例2: renderSelectedItem

public void renderSelectedItem(ScaledResolution scaledRes)
{
    this.mc.mcProfiler.startSection("selectedItemName");

    if (this.remainingHighlightTicks > 0 && !this.highlightingItemStack.func_190926_b())
    {
        String s = this.highlightingItemStack.getDisplayName();

        if (this.highlightingItemStack.hasDisplayName())
        {
            s = TextFormatting.ITALIC + s;
        }

        int i = (scaledRes.getScaledWidth() - this.getFontRenderer().getStringWidth(s)) / 2;
        int j = scaledRes.getScaledHeight() - 59;

        if (!this.mc.playerController.shouldDrawHUD())
        {
            j += 14;
        }

        int k = (int)((float)this.remainingHighlightTicks * 256.0F / 10.0F);

        if (k > 255)
        {
            k = 255;
        }

        if (k > 0)
        {
            GlStateManager.pushMatrix();
            GlStateManager.enableBlend();
            GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
            this.getFontRenderer().drawStringWithShadow(s, (float)i, (float)j, 16777215 + (k << 24));
            GlStateManager.disableBlend();
            GlStateManager.popMatrix();
        }
    }

    this.mc.mcProfiler.endSection();
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:41,代碼來源:GuiIngame.java

示例3: renderSelectedItem

public void renderSelectedItem(ScaledResolution scaledRes)
{
    this.mc.mcProfiler.startSection("selectedItemName");

    if (this.remainingHighlightTicks > 0 && this.highlightingItemStack != null)
    {
        String s = this.highlightingItemStack.getDisplayName();

        if (this.highlightingItemStack.hasDisplayName())
        {
            s = TextFormatting.ITALIC + s;
        }

        int i = (scaledRes.getScaledWidth() - this.getFontRenderer().getStringWidth(s)) / 2;
        int j = scaledRes.getScaledHeight() - 59;

        if (!this.mc.playerController.shouldDrawHUD())
        {
            j += 14;
        }

        int k = (int)((float)this.remainingHighlightTicks * 256.0F / 10.0F);

        if (k > 255)
        {
            k = 255;
        }

        if (k > 0)
        {
            GlStateManager.pushMatrix();
            GlStateManager.enableBlend();
            GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
            this.getFontRenderer().drawStringWithShadow(s, (float)i, (float)j, 16777215 + (k << 24));
            GlStateManager.disableBlend();
            GlStateManager.popMatrix();
        }
    }

    this.mc.mcProfiler.endSection();
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:41,代碼來源:GuiIngame.java


注:本文中的net.minecraft.util.text.TextFormatting.ITALIC屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。