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


Java TextFormatting.RED屬性代碼示例

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


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

示例1: getResourcePackDescription

protected String getResourcePackDescription()
{
    try
    {
        PackMetadataSection packmetadatasection = (PackMetadataSection)this.resourcePack.getPackMetadata(this.mc.getResourcePackRepository().rprMetadataSerializer, "pack");

        if (packmetadatasection != null)
        {
            return packmetadatasection.getPackDescription().getFormattedText();
        }
    }
    catch (JsonParseException jsonparseexception)
    {
        LOGGER.error((String)"Couldn\'t load metadata info", (Throwable)jsonparseexception);
    }
    catch (IOException ioexception)
    {
        LOGGER.error((String)"Couldn\'t load metadata info", (Throwable)ioexception);
    }

    return TextFormatting.RED + "Missing " + "pack.mcmeta" + " :(";
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:22,代碼來源:ResourcePackListEntryServer.java

示例2: getTranslatedString

public String getTranslatedString(float value, boolean withColor) {
	String valueStr = String.valueOf(value);
	if (this.typeOfValue == Type.PERCENTAGE)
		valueStr = Integer.toString(Math.round((value - 1) * 100)) + "%";
	else if (this.typeOfValue == Type.INVERTED_PERCENTAGE)
		valueStr = Integer.toString(Math.round((1 - value) * 100)) + "%";
	else if (this.typeOfValue == Type.ADDITIVE)
		valueStr = Integer.toString(Math.round(value));

	if (withColor) {
		TextFormatting color = this.state == State.POSITIVE ? TextFormatting.AQUA
				: (this.state == State.NEGATIVE ? TextFormatting.RED : TextFormatting.WHITE);
		return color + I18n.format("weaponAttribute." + this.name, new Object[] { valueStr });
	} else
		return I18n.format("weaponAttribute." + this.name, new Object[] { valueStr });

}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:17,代碼來源:TF2Attribute.java

示例3: handleProgrammableTooltip

private void handleProgrammableTooltip(ItemTooltipEvent event) {
    IProgrammable programmable = (IProgrammable) event.getItemStack().getItem();
    if (programmable.canProgram(event.getItemStack()) && programmable.showProgramTooltip()) {
        boolean hasInvalidPrograms = false;
        List<String> addedEntries = new ArrayList<>();
        List<IProgWidget> widgets = TileEntityProgrammer.getProgWidgets(event.getItemStack());
        Map<String, Integer> widgetMap = getPuzzleSummary(widgets);
        for (Map.Entry<String, Integer> entry : widgetMap.entrySet()) {
            IProgWidget widget = ItemProgrammingPuzzle.getWidgetForName(entry.getKey());
            String prefix = "";
            GuiScreen curScreen = Minecraft.getMinecraft().currentScreen;
            if (curScreen instanceof IGuiDrone) {
                if (!((IGuiDrone) curScreen).getDrone().isProgramApplicable(widget)) {
                    prefix = TextFormatting.RED + "";
                    hasInvalidPrograms = true;
                }
            }
            addedEntries.add(prefix + "- " + entry.getValue() + "x " + I18n.format("programmingPuzzle." + entry.getKey() + ".name"));
        }
        if (hasInvalidPrograms) {
            event.getToolTip().add(TextFormatting.RED + I18n.format("gui.tooltip.programmable.invalidPieces"));
        }
        Collections.sort(addedEntries);
        event.getToolTip().addAll(addedEntries);
        if (PneumaticCraftRepressurized.proxy.isSneakingInGui() && !widgets.isEmpty()) {
            Map<Integer,Integer> widgetColorMap = TileEntityProgrammer.getPuzzleSummary(widgets);
            event.getToolTip().add(TextFormatting.WHITE + I18n.format("gui.tooltip.programmable.requiredPieces"));
            for (int color : widgetColorMap.keySet()) {
                ItemStack stack = ItemProgrammingPuzzle.getStackForColor(color);
                stack.setCount(widgetColorMap.get(color));
                event.getToolTip().add("- " + widgetColorMap.get(color) + " x " + stack.getDisplayName());
            }
        }
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:35,代碼來源:ClientEventHandler.java

示例4: tickEnd

@SubscribeEvent
public void tickEnd(TickEvent.RenderTickEvent event) {
    if (event.phase == TickEvent.Phase.END && FMLClientHandler.instance().getClient().inGameHasFocus && PneumaticCraftRepressurized.proxy.getPlayer().world != null && (ModuleRegulatorTube.inverted || !ModuleRegulatorTube.inLine)) {
        Minecraft mc = FMLClientHandler.instance().getClient();
        ScaledResolution sr = new ScaledResolution(mc);
        FontRenderer fontRenderer = FMLClientHandler.instance().getClient().fontRenderer;
        String warning = TextFormatting.RED + I18n.format("gui.regulatorTube.hudMessage." + (ModuleRegulatorTube.inverted ? "inverted" : "notInLine"));
        fontRenderer.drawStringWithShadow(warning, sr.getScaledWidth() / 2 - fontRenderer.getStringWidth(warning) / 2, sr.getScaledHeight() / 2 + 30, 0xFFFFFFFF);
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:10,代碼來源:ClientEventHandler.java

示例5: getTranslatedName

/**
 * Returns the correct traslated name of the enchantment and the level in roman numbers.
 */
public String getTranslatedName(int level)
{
    String s = I18n.translateToLocal(this.getName());

    if (this.func_190936_d())
    {
        s = TextFormatting.RED + s;
    }

    return level == 1 && this.getMaxLevel() == 1 ? s : s + " " + I18n.translateToLocal("enchantment.level." + level);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:14,代碼來源:Enchantment.java

示例6: renderItemOverlayIntoGUI

/**
 * Renders the stack size and/or damage bar for the given ItemStack.
 */
public static void renderItemOverlayIntoGUI(FontRenderer fr, ItemStack stack, int xPosition, int yPosition, @Nullable String text,
                                            int scaled) {
    if (!stack.isEmpty()) {
        if (stack.getCount() != 1 || text != null) {
            String s = text == null ? String.valueOf(stack.getCount()) : text;
            if (text == null && stack.getCount() < 1) {
                s = TextFormatting.RED + String.valueOf(stack.getCount());
            }

            GlStateManager.disableLighting();
            GlStateManager.disableDepth();
            GlStateManager.disableBlend();
            if (scaled >= 2) {
                GlStateManager.pushMatrix();
                GlStateManager.scale(.5f, .5f, .5f);
                fr.drawStringWithShadow(s, ((xPosition + 19 - 2) * 2 - 1 - fr.getStringWidth(s)), yPosition * 2 + 24, 16777215);
                GlStateManager.popMatrix();
            } else if (scaled == 1) {
                GlStateManager.pushMatrix();
                GlStateManager.scale(.75f, .75f, .75f);
                fr.drawStringWithShadow(s, ((xPosition - 2) * 1.34f + 24 - fr.getStringWidth(s)), yPosition * 1.34f + 14, 16777215);
                GlStateManager.popMatrix();
            } else {
                fr.drawStringWithShadow(s, (xPosition + 19 - 2 - fr.getStringWidth(s)), (yPosition + 6 + 3), 16777215);
            }
            GlStateManager.enableLighting();
            GlStateManager.enableDepth();
            // Fixes opaque cooldown overlay a bit lower
            // TODO: check if enabled blending still screws things up down the line.
            GlStateManager.enableBlend();
        }

        if (stack.getItem().showDurabilityBar(stack)) {
            double health = stack.getItem().getDurabilityForDisplay(stack);
            int j = (int) Math.round(13.0D - health * 13.0D);
            int i = (int) Math.round(255.0D - health * 255.0D);
            GlStateManager.disableLighting();
            GlStateManager.disableDepth();
            GlStateManager.disableTexture2D();
            GlStateManager.disableAlpha();
            GlStateManager.disableBlend();
            Tessellator tessellator = Tessellator.getInstance();
            VertexBuffer vertexbuffer = tessellator.getBuffer();
            draw(vertexbuffer, xPosition + 2, yPosition + 13, 13, 2, 0, 0, 0, 255);
            draw(vertexbuffer, xPosition + 2, yPosition + 13, 12, 1, (255 - i) / 4, 64, 0, 255);
            draw(vertexbuffer, xPosition + 2, yPosition + 13, j, 1, 255 - i, i, 0, 255);
            GlStateManager.enableBlend();
            GlStateManager.enableAlpha();
            GlStateManager.enableTexture2D();
            GlStateManager.enableLighting();
            GlStateManager.enableDepth();
        }

        EntityPlayerSP entityplayersp = Minecraft.getMinecraft().player;
        float f = entityplayersp == null ? 0.0F : entityplayersp.getCooldownTracker().getCooldown(stack.getItem(), Minecraft.getMinecraft().getRenderPartialTicks());

        if (f > 0.0F) {
            GlStateManager.disableLighting();
            GlStateManager.disableDepth();
            GlStateManager.disableTexture2D();
            Tessellator tessellator1 = Tessellator.getInstance();
            VertexBuffer vertexbuffer1 = tessellator1.getBuffer();
            draw(vertexbuffer1, xPosition, yPosition + MathHelper.floor(16.0F * (1.0F - f)), 16, MathHelper.ceil(16.0F * f), 255, 255, 255, 127);
            GlStateManager.enableTexture2D();
            GlStateManager.enableLighting();
            GlStateManager.enableDepth();
        }
    }
}
 
開發者ID:McJty,項目名稱:interactionwheel,代碼行數:72,代碼來源:RenderHelper.java

示例7: getTexturePackDescription

public String getTexturePackDescription()
{
    return this.rePackMetadataSection == null ? TextFormatting.RED + "Invalid pack.mcmeta (or missing \'pack\' section)" : this.rePackMetadataSection.getPackDescription().getFormattedText();
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:4,代碼來源:ResourcePackRepository.java

示例8: renderScoreboard

private void renderScoreboard(ScoreObjective objective, ScaledResolution scaledRes)
{
    Scoreboard scoreboard = objective.getScoreboard();
    Collection<Score> collection = scoreboard.getSortedScores(objective);
    List<Score> list = Lists.newArrayList(Iterables.filter(collection, new Predicate<Score>()
    {
        public boolean apply(@Nullable Score p_apply_1_)
        {
            return p_apply_1_.getPlayerName() != null && !p_apply_1_.getPlayerName().startsWith("#");
        }
    }));

    if (list.size() > 15)
    {
        collection = Lists.newArrayList(Iterables.skip(list, collection.size() - 15));
    }
    else
    {
        collection = list;
    }

    int i = this.getFontRenderer().getStringWidth(objective.getDisplayName());

    for (Score score : collection)
    {
        ScorePlayerTeam scoreplayerteam = scoreboard.getPlayersTeam(score.getPlayerName());
        String s = ScorePlayerTeam.formatPlayerName(scoreplayerteam, score.getPlayerName()) + ": " + TextFormatting.RED + score.getScorePoints();
        i = Math.max(i, this.getFontRenderer().getStringWidth(s));
    }

    int i1 = collection.size() * this.getFontRenderer().FONT_HEIGHT;
    int j1 = scaledRes.getScaledHeight() / 2 + i1 / 3;
    int k1 = 3;
    int l1 = scaledRes.getScaledWidth() - i - 3;
    int j = 0;

    for (Score score1 : collection)
    {
        ++j;
        ScorePlayerTeam scoreplayerteam1 = scoreboard.getPlayersTeam(score1.getPlayerName());
        String s1 = ScorePlayerTeam.formatPlayerName(scoreplayerteam1, score1.getPlayerName());
        String s2 = TextFormatting.RED + "" + score1.getScorePoints();
        int k = j1 - j * this.getFontRenderer().FONT_HEIGHT;
        int l = scaledRes.getScaledWidth() - 3 + 2;
        drawRect(l1 - 2, k, l, k + this.getFontRenderer().FONT_HEIGHT, 1342177280);
        this.getFontRenderer().drawString(s1, l1, k, 553648127);
        this.getFontRenderer().drawString(s2, l - this.getFontRenderer().getStringWidth(s2), k, 553648127);

        if (j == collection.size())
        {
            String s3 = objective.getDisplayName();
            drawRect(l1 - 2, k - this.getFontRenderer().FONT_HEIGHT - 1, l, k - 1, 1610612736);
            drawRect(l1 - 2, k - 1, l, k, 1342177280);
            this.getFontRenderer().drawString(s3, l1 + i / 2 - this.getFontRenderer().getStringWidth(s3) / 2, k - this.getFontRenderer().FONT_HEIGHT, 553648127);
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:57,代碼來源:GuiIngame.java

示例9: drawScreen

/**
 * Draws the screen and all the components in it.
 */
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
    super.drawScreen(mouseX, mouseY, partialTicks);
    boolean flag = this.mc.player.capabilities.isCreativeMode;
    int i = this.container.getLapisAmount();

    for (int j = 0; j < 3; ++j)
    {
        int k = this.container.enchantLevels[j];
        Enchantment enchantment = Enchantment.getEnchantmentByID(this.container.enchantClue[j]);
        int l = this.container.worldClue[j];
        int i1 = j + 1;

        if (this.isPointInRegion(60, 14 + 19 * j, 108, 17, mouseX, mouseY) && k > 0 && l >= 0 && enchantment != null)
        {
            List<String> list = Lists.<String>newArrayList();
            list.add("" + TextFormatting.WHITE + TextFormatting.ITALIC + I18n.format("container.enchant.clue", new Object[] {enchantment.getTranslatedName(l)}));

            if (!flag)
            {
                list.add("");

                if (this.mc.player.experienceLevel < k)
                {
                    list.add(TextFormatting.RED + "Level Requirement: " + this.container.enchantLevels[j]);
                }
                else
                {
                    String s;

                    if (i1 == 1)
                    {
                        s = I18n.format("container.enchant.lapis.one", new Object[0]);
                    }
                    else
                    {
                        s = I18n.format("container.enchant.lapis.many", new Object[] {Integer.valueOf(i1)});
                    }

                    TextFormatting textformatting = i >= i1 ? TextFormatting.GRAY : TextFormatting.RED;
                    list.add(textformatting + "" + s);

                    if (i1 == 1)
                    {
                        s = I18n.format("container.enchant.level.one", new Object[0]);
                    }
                    else
                    {
                        s = I18n.format("container.enchant.level.many", new Object[] {Integer.valueOf(i1)});
                    }

                    list.add(TextFormatting.GRAY + "" + s);
                }
            }

            this.drawHoveringText(list, mouseX, mouseY);
            break;
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:63,代碼來源:GuiEnchantment.java

示例10: renderItemOverlayIntoGUI

/**
 * Renders the stack size and/or damage bar for the given ItemStack.
 */
public void renderItemOverlayIntoGUI(FontRenderer fr, ItemStack stack, int xPosition, int yPosition, @Nullable String text)
{
    if (stack != null)
    {
        if (stack.stackSize != 1 || text != null)
        {
            String s = text == null ? String.valueOf(stack.stackSize) : text;

            if (text == null && stack.stackSize < 1)
            {
                s = TextFormatting.RED + String.valueOf(stack.stackSize);
            }

            GlStateManager.disableLighting();
            GlStateManager.disableDepth();
            GlStateManager.disableBlend();
            fr.drawStringWithShadow(s, (float)(xPosition + 19 - 2 - fr.getStringWidth(s)), (float)(yPosition + 6 + 3), 16777215);
            GlStateManager.enableLighting();
            GlStateManager.enableDepth();
            // Fixes opaque cooldown overlay a bit lower
            // TODO: check if enabled blending still screws things up down the line.
            GlStateManager.enableBlend();
        }

        if (stack.getItem().showDurabilityBar(stack))
        {
            double health = stack.getItem().getDurabilityForDisplay(stack);
            int j = (int)Math.round(13.0D - health * 13.0D);
            int i = (int)Math.round(255.0D - health * 255.0D);
            GlStateManager.disableLighting();
            GlStateManager.disableDepth();
            GlStateManager.disableTexture2D();
            GlStateManager.disableAlpha();
            GlStateManager.disableBlend();
            Tessellator tessellator = Tessellator.getInstance();
            VertexBuffer vertexbuffer = tessellator.getBuffer();
            this.draw(vertexbuffer, xPosition + 2, yPosition + 13, 13, 2, 0, 0, 0, 255);
            this.draw(vertexbuffer, xPosition + 2, yPosition + 13, 12, 1, (255 - i) / 4, 64, 0, 255);
            this.draw(vertexbuffer, xPosition + 2, yPosition + 13, j, 1, 255 - i, i, 0, 255);
            GlStateManager.enableBlend();
            GlStateManager.enableAlpha();
            GlStateManager.enableTexture2D();
            GlStateManager.enableLighting();
            GlStateManager.enableDepth();
        }

        EntityPlayerSP entityplayersp = Minecraft.getMinecraft().thePlayer;
        float f = entityplayersp == null ? 0.0F : entityplayersp.getCooldownTracker().getCooldown(stack.getItem(), Minecraft.getMinecraft().getRenderPartialTicks());

        if (f > 0.0F)
        {
            GlStateManager.disableLighting();
            GlStateManager.disableDepth();
            GlStateManager.disableTexture2D();
            Tessellator tessellator1 = Tessellator.getInstance();
            VertexBuffer vertexbuffer1 = tessellator1.getBuffer();
            this.draw(vertexbuffer1, xPosition, yPosition + MathHelper.floor_float(16.0F * (1.0F - f)), 16, MathHelper.ceiling_float_int(16.0F * f), 255, 255, 255, 127);
            GlStateManager.enableTexture2D();
            GlStateManager.enableLighting();
            GlStateManager.enableDepth();
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:66,代碼來源:RenderItem.java

示例11: renderScoreboard

protected void renderScoreboard(ScoreObjective objective, ScaledResolution scaledRes)
{
    Scoreboard scoreboard = objective.getScoreboard();
    Collection<Score> collection = scoreboard.getSortedScores(objective);
    List<Score> list = Lists.newArrayList(Iterables.filter(collection, new Predicate<Score>()
    {
        public boolean apply(@Nullable Score p_apply_1_)
        {
            return p_apply_1_.getPlayerName() != null && !p_apply_1_.getPlayerName().startsWith("#");
        }
    }));

    if (list.size() > 15)
    {
        collection = Lists.newArrayList(Iterables.skip(list, collection.size() - 15));
    }
    else
    {
        collection = list;
    }

    int i = this.getFontRenderer().getStringWidth(objective.getDisplayName());

    for (Score score : collection)
    {
        ScorePlayerTeam scoreplayerteam = scoreboard.getPlayersTeam(score.getPlayerName());
        String s = ScorePlayerTeam.formatPlayerName(scoreplayerteam, score.getPlayerName()) + ": " + TextFormatting.RED + score.getScorePoints();
        i = Math.max(i, this.getFontRenderer().getStringWidth(s));
    }

    int i1 = collection.size() * this.getFontRenderer().FONT_HEIGHT;
    int j1 = scaledRes.getScaledHeight() / 2 + i1 / 3;
    int k1 = 3;
    int l1 = scaledRes.getScaledWidth() - i - 3;
    int j = 0;

    for (Score score1 : collection)
    {
        ++j;
        ScorePlayerTeam scoreplayerteam1 = scoreboard.getPlayersTeam(score1.getPlayerName());
        String s1 = ScorePlayerTeam.formatPlayerName(scoreplayerteam1, score1.getPlayerName());
        String s2 = TextFormatting.RED + "" + score1.getScorePoints();
        int k = j1 - j * this.getFontRenderer().FONT_HEIGHT;
        int l = scaledRes.getScaledWidth() - 3 + 2;
        drawRect(l1 - 2, k, l, k + this.getFontRenderer().FONT_HEIGHT, 1342177280);
        this.getFontRenderer().drawString(s1, l1, k, 553648127);
        this.getFontRenderer().drawString(s2, l - this.getFontRenderer().getStringWidth(s2), k, 553648127);

        if (j == collection.size())
        {
            String s3 = objective.getDisplayName();
            drawRect(l1 - 2, k - this.getFontRenderer().FONT_HEIGHT - 1, l, k - 1, 1610612736);
            drawRect(l1 - 2, k - 1, l, k, 1342177280);
            this.getFontRenderer().drawString(s3, l1 + i / 2 - this.getFontRenderer().getStringWidth(s3) / 2, k - this.getFontRenderer().FONT_HEIGHT, 553648127);
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:57,代碼來源:GuiIngame.java

示例12: drawScreen

/**
 * Draws the screen and all the components in it.
 */
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
    super.drawScreen(mouseX, mouseY, partialTicks);
    boolean flag = this.mc.thePlayer.capabilities.isCreativeMode;
    int i = this.container.getLapisAmount();

    for (int j = 0; j < 3; ++j)
    {
        int k = this.container.enchantLevels[j];
        Enchantment enchantment = Enchantment.getEnchantmentByID(this.container.enchantClue[j]);
        int l = this.container.worldClue[j];
        int i1 = j + 1;

        if (this.isPointInRegion(60, 14 + 19 * j, 108, 17, mouseX, mouseY) && k > 0 && l >= 0 && enchantment != null)
        {
            List<String> list = Lists.<String>newArrayList();
            list.add("" + TextFormatting.WHITE + TextFormatting.ITALIC + I18n.format("container.enchant.clue", new Object[] {enchantment.getTranslatedName(l)}));

            if (!flag)
            {
                list.add("");

                if (this.mc.thePlayer.experienceLevel < k)
                {
                    list.add(TextFormatting.RED + "Level Requirement: " + this.container.enchantLevels[j]);
                }
                else
                {
                    String s;

                    if (i1 == 1)
                    {
                        s = I18n.format("container.enchant.lapis.one", new Object[0]);
                    }
                    else
                    {
                        s = I18n.format("container.enchant.lapis.many", new Object[] {Integer.valueOf(i1)});
                    }

                    TextFormatting textformatting = i >= i1 ? TextFormatting.GRAY : TextFormatting.RED;
                    list.add(textformatting + "" + s);

                    if (i1 == 1)
                    {
                        s = I18n.format("container.enchant.level.one", new Object[0]);
                    }
                    else
                    {
                        s = I18n.format("container.enchant.level.many", new Object[] {Integer.valueOf(i1)});
                    }

                    list.add(TextFormatting.GRAY + "" + s);
                }
            }

            this.drawHoveringText(list, mouseX, mouseY);
            break;
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:63,代碼來源:GuiEnchantment.java

示例13: getDebugInfoRight

protected <T extends Comparable<T>> List<String> getDebugInfoRight()
{
    long i = Runtime.getRuntime().maxMemory();
    long j = Runtime.getRuntime().totalMemory();
    long k = Runtime.getRuntime().freeMemory();
    long l = j - k;
    List<String> list = Lists.newArrayList(new String[] {String.format("Java: %s %dbit", new Object[]{System.getProperty("java.version"), Integer.valueOf(this.mc.isJava64bit() ? 64 : 32)}), String.format("Mem: % 2d%% %03d/%03dMB", new Object[]{Long.valueOf(l * 100L / i), Long.valueOf(bytesToMb(l)), Long.valueOf(bytesToMb(i))}), String.format("Allocated: % 2d%% %03dMB", new Object[]{Long.valueOf(j * 100L / i), Long.valueOf(bytesToMb(j))}), "", String.format("CPU: %s", new Object[]{OpenGlHelper.getCpu()}), "", String.format("Display: %dx%d (%s)", new Object[]{Integer.valueOf(Display.getWidth()), Integer.valueOf(Display.getHeight()), GlStateManager.glGetString(7936)}), GlStateManager.glGetString(7937), GlStateManager.glGetString(7938)});

    list.add("");
    list.addAll(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(false));

    if (this.mc.isReducedDebug())
    {
        return list;
    }
    else
    {
        if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK && this.mc.objectMouseOver.getBlockPos() != null)
        {
            BlockPos blockpos = this.mc.objectMouseOver.getBlockPos();
            IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos);

            if (this.mc.theWorld.getWorldType() != WorldType.DEBUG_WORLD)
            {
                iblockstate = iblockstate.getActualState(this.mc.theWorld, blockpos);
            }

            list.add("");
            list.add(String.valueOf(Block.REGISTRY.getNameForObject(iblockstate.getBlock())));

            for (Entry < IProperty<?>, Comparable<? >> entry : iblockstate.getProperties().entrySet())
            {
                IProperty<T> iproperty = (IProperty)entry.getKey();
                T t = (T)entry.getValue();
                String s = iproperty.getName(t);

                if (Boolean.TRUE.equals(t))
                {
                    s = TextFormatting.GREEN + s;
                }
                else if (Boolean.FALSE.equals(t))
                {
                    s = TextFormatting.RED + s;
                }

                list.add(iproperty.getName() + ": " + s);
            }
        }

        return list;
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:52,代碼來源:GuiOverlayDebug.java


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