net.minecraft.util.text.TextFormatting#RED源码实例Demo

下面列出了net.minecraft.util.text.TextFormatting#RED 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: CommunityMod   文件: GuiCommunityConfig.java
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
    drawBackground(0);
    availableSubModsList.drawScreen(mouseX, mouseY, partialTicks);
    selectedSubModsList.drawScreen(mouseX, mouseY, partialTicks);
    drawCenteredString(fontRenderer, "Select Submods", width / 2, 16, 16777215);

    if (!requiresRestart.isEmpty())
    {
        String s = TextFormatting.RED + "Restart needed *";
        drawString(fontRenderer, s, width / 2 - 14 - fontRenderer.getStringWidth(s), height - 44, -1);
    }

    super.drawScreen(mouseX, mouseY, partialTicks);
}
 
源代码2 项目: malmo   文件: AddressHelper.java
/** Set the actual port used for mission control - not persisted, could be different each time the Mod is run.
 * @param port the port currently in use for mission control.
 */
static public void setMissionControlPort(int port)
{
	if (port != AddressHelper.missionControlPort)
	{
		AddressHelper.missionControlPort = port;
		// Also update our metadata, for displaying to the user:
		ModMetadata md = Loader.instance().activeModContainer().getMetadata();
		if (port != -1)
			md.description = "Talk to this Mod using port " + TextFormatting.GREEN + port;
		else
			md.description = TextFormatting.RED + "ERROR: No mission control port - check configuration";

		// See if changing the port should lead to changing the login details:
		//AuthenticationHelper.update(MalmoMod.instance.getModPermanentConfigFile());
	}
}
 
源代码3 项目: IGW-mod   文件: TickHandler.java
public static String getCurrentObjectName(){
    if(lastEntityHovered != null) {
        return lastEntityHovered.getName();
    } else {
        try {
            World world = FMLClientHandler.instance().getClient().world;
            IBlockState blockState = world.getBlockState(coordHovered);
            if(blockState != null) {
                ItemStack idPicked = blockState.getBlock().getPickBlock(blockState, FMLClientHandler.instance().getClient().objectMouseOver, world, coordHovered, FMLClientHandler.instance().getClientPlayerEntity());
                return (!idPicked.isEmpty() ? idPicked : new ItemStack(blockState.getBlock(), 1, blockState.getBlock().getMetaFromState(blockState))).getDisplayName(); //TODO test blockState.getBlock().getDamage()
            }
        } catch(Throwable e) {}
        return TextFormatting.RED + "<ERROR>";
    }

}
 
@Override
protected void drawCountDown(int secondsRemaining)
{
	Map<String, String> data = new HashMap<String, String>();
	
       String text = TextFormatting.BOLD + "" + secondsRemaining + "...";
       if (secondsRemaining <= 5)
           text = TextFormatting.RED + text;

	data.put("chat", text);
	MalmoMod.safeSendToAll(MalmoMessageType.SERVER_TEXT, data);
}
 
源代码5 项目: WearableBackpacks   文件: BaseEntryList.java
public Entry(BaseEntryList<T> owningList) {
	super(Direction.HORIZONTAL);
	setFillHorizontal();

	buttonMove = new MoveButton();

	buttonRemove = new GuiButton(DEFAULT_ENTRY_HEIGHT, DEFAULT_ENTRY_HEIGHT, TextFormatting.RED + "x");
	buttonRemove.setAction(() -> owningList.layoutList.remove(this));
}
 
源代码6 项目: CommunityMod   文件: SubModListEntry.java
@Override
    public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected, float partialTicks)
    {
        if (parentScreen.requiresRestart.contains(this))
        {
            GlStateManager.color(1, 1, 1, 1);
            Gui.drawRect(x - 1, y - 1, x + listWidth - 9, y + slotHeight + 1, -8978432);
            mc.fontRenderer.drawStringWithShadow(TextFormatting.RED + "*", x + listWidth - 13, y - 2, -1);
        }

        // TODO: Custom icons
        // bindResourcePackIcon();
        // GlStateManager.color(1, 1, 1, 1);
        // Gui.drawModalRectWithCustomSizedTexture(x, y, 0, 0, 24, 24, 24, 24);

        if (showHoverOverlay() && (mc.gameSettings.touchscreen || isSelected))
        {
            mc.getTextureManager().bindTexture(RESOURCE_PACKS_TEXTURE);
            Gui.drawRect(x, y, x + 24, y + 24, -1601138544);
            GlStateManager.color(1, 1, 1, 1);

            String s = "";

            if (canMoveRight())
            {
                s = "+";

                if (mouseX - x < 24)
                {
                    s = TextFormatting.GREEN + s;
                }
            }
            else if (canMoveLeft())
            {
                s = "-";

                if (mouseX - x < 24)
                {
                    s = TextFormatting.RED + s;
                }
            }

            float scale = 2;
            GlStateManager.pushMatrix();
            GlStateManager.scale(scale, scale, scale);
            mc.fontRenderer.drawStringWithShadow(s, (x + 12) / scale - mc.fontRenderer.getStringWidth(s) / 2F, (y + 12) / scale - mc.fontRenderer.FONT_HEIGHT / 2F, 8421504);
            GlStateManager.popMatrix();
        }

//        if (isSelected)
//        {
//            List<String> list = new ArrayList<>();
//            list.add(subModEntry.getName());
//            list.addAll(mc.fontRenderer.listFormattedStringToWidth(subModEntry.getDescription(), 157));
//            parentScreen.drawHoveringText(list, mouseX, mouseY);
//        }

        mc.fontRenderer.drawStringWithShadow(trimStringToWidth(subModEntry.getName(), 157), x + 24 + 2, y + 1, 16777215);
        mc.fontRenderer.drawStringWithShadow(trimStringToWidth(subModEntry.getAttribution(), 157), x + 24 + 2, y + 1 + 10, 8421504);
    }
 
源代码7 项目: CommunityMod   文件: LexWand.java
private static String getBanMsg(Entity entity, Random rand) {
	String ban_header = "<Lex> BANNED " + TextFormatting.RED + entity.getName();
	String ban_reason =  TextFormatting.WHITE + " " + BAN_MSG[rand.nextInt(BAN_MSG.length)];
	return ban_header + ban_reason;
}
 
源代码8 项目: enderutilities   文件: ItemLivingManipulator.java
@Override
public void addTooltipLines(ItemStack stack, EntityPlayer player, List<String> list, boolean verbose)
{
    if (stack.getTagCompound() == null)
    {
        list.add(I18n.format("enderutilities.tooltip.item.usetoolworkstation"));
        return;
    }

    ItemStack memoryCardStack = this.getSelectedModuleStack(stack, ModuleType.TYPE_MEMORY_CARD_MISC);

    String preDGreen = TextFormatting.DARK_GREEN.toString();
    String preBlue = TextFormatting.BLUE.toString();
    String preWhiteIta = TextFormatting.WHITE.toString() + TextFormatting.ITALIC.toString();
    String rst = TextFormatting.RESET.toString() + TextFormatting.GRAY.toString();

    list.add(I18n.format("enderutilities.tooltip.item.mode") + ": " + preDGreen + Mode.getMode(stack).getDisplayName() + rst);

    if (verbose)
    {
        // Item supports Jailer modules, show if one is installed
        if (this.getMaxModules(stack, ModuleType.TYPE_MOBPERSISTENCE) > 0)
        {
            String s;
            if (this.getInstalledModuleCount(stack, ModuleType.TYPE_MOBPERSISTENCE) > 0)
            {
                s = I18n.format("enderutilities.tooltip.item.jailer") + ": " +
                        TextFormatting.GREEN + I18n.format("enderutilities.tooltip.item.yes") + rst;
            }
            else
            {
                s = I18n.format("enderutilities.tooltip.item.jailer") + ": " +
                        TextFormatting.RED + I18n.format("enderutilities.tooltip.item.no") + rst;
            }

            list.add(s);
        }
    }

    // Memory Cards installed
    if (memoryCardStack.isEmpty() == false)
    {
        if (verbose)
        {
            int num = UtilItemModular.getInstalledModuleCount(stack, ModuleType.TYPE_MEMORY_CARD_MISC);
            int sel = UtilItemModular.getClampedModuleSelection(stack, ModuleType.TYPE_MEMORY_CARD_MISC) + 1;
            String dName = (memoryCardStack.hasDisplayName() ? preWhiteIta + memoryCardStack.getDisplayName() + rst + " " : "");

            list.add(I18n.format("enderutilities.tooltip.item.selectedmemorycard.short") +
                     String.format(" %s(%s%d%s / %s%d%s)", dName, preBlue, sel, rst, preBlue, num, rst));

            NBTTagList tagList = NBTUtils.getTagList(memoryCardStack, WRAPPER_TAG_NAME, "Entities", Constants.NBT.TAG_COMPOUND, false);

            if (tagList == null)
            {
                return;
            }

            int current = this.getCurrentIndex(stack);

            for (int i = 0; i < tagList.tagCount(); i++)
            {
                NBTTagCompound tag = tagList.getCompoundTagAt(i);

                if (tag != null)
                {
                    String name = this.getNameForEntityFromTag(tag, false);
                    name = (i == current) ? "=> " + name : "   " + name;
                    list.add(name);
                }
            }
        }
    }
    else
    {
        list.add(I18n.format("enderutilities.tooltip.item.nomemorycards"));
    }
}
 
源代码9 项目: enderutilities   文件: GuiContainerLargeStacks.java
public void renderLargeStackItemOverlayIntoGUI(FontRenderer fontRenderer, ItemStack stack, int xPosition, int yPosition)
{
    if (stack.isEmpty())
    {
        return;
    }

    if (stack.getCount() != 1)
    {
        String str = EUStringUtils.getStackSizeString(stack, 4);

        if (stack.getCount() < 1)
        {
            str = TextFormatting.RED + str;
        }

        GlStateManager.disableLighting();
        GlStateManager.disableDepth();
        GlStateManager.disableBlend();

        GlStateManager.pushMatrix();
        GlStateManager.translate(xPosition, yPosition, 0.0d);
        GlStateManager.scale(0.5d, 0.5d, 0.5d);

        fontRenderer.drawStringWithShadow(str, (31 - fontRenderer.getStringWidth(str)), 23, 0xFFFFFF);

        GlStateManager.popMatrix();

        GlStateManager.enableLighting();
        GlStateManager.enableDepth();
    }

    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();
        BufferBuilder vertexBuffer = tessellator.getBuffer();

        this.drawQuad(vertexBuffer, xPosition + 2, yPosition + 13, 13, 2, 0, 0, 0, 255);
        this.drawQuad(vertexBuffer, xPosition + 2, yPosition + 13, 12, 1, (255 - i) / 4, 64, 0, 255);
        this.drawQuad(vertexBuffer, xPosition + 2, yPosition + 13, j, 1, 255 - i, i, 0, 255);

        GlStateManager.enableAlpha();
        GlStateManager.enableTexture2D();
        GlStateManager.enableLighting();
        GlStateManager.enableDepth();
    }
}