Java Code Examples for net.minecraft.util.text.TextFormatting#RED

The following examples show how to use net.minecraft.util.text.TextFormatting#RED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GuiCommunityConfig.java    From CommunityMod with GNU Lesser General Public License v2.1 6 votes vote down vote up
@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);
}
 
Example 2
Source File: AddressHelper.java    From malmo with MIT License 6 votes vote down vote up
/** 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());
	}
}
 
Example 3
Source File: TickHandler.java    From IGW-mod with GNU General Public License v2.0 6 votes vote down vote up
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>";
    }

}
 
Example 4
Source File: ServerQuitFromTimeUpImplementation.java    From malmo with MIT License 5 votes vote down vote up
@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);
}
 
Example 5
Source File: BaseEntryList.java    From WearableBackpacks with MIT License 5 votes vote down vote up
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));
}
 
Example 6
Source File: SubModListEntry.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
@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);
    }
 
Example 7
Source File: LexWand.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
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;
}
 
Example 8
Source File: ItemLivingManipulator.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
@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"));
    }
}
 
Example 9
Source File: GuiContainerLargeStacks.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
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();
    }
}