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

The following examples show how to use net.minecraft.util.text.TextFormatting#GREEN . 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: 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 2
Source File: ServerStateMachine.java    From malmo with MIT License 6 votes vote down vote up
protected void onReceiveMissionInit(MissionInit missionInit)
{
	MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
    System.out.println("Mission received: " + missionInit.getMission().getAbout().getSummary());
    TextComponentString txtMission = new TextComponentString("Received mission: " + TextFormatting.BLUE + missionInit.getMission().getAbout().getSummary());
    TextComponentString txtSource = new TextComponentString("Source: " + TextFormatting.GREEN + missionInit.getClientAgentConnection().getAgentIPAddress());
    server.getPlayerList().sendMessage(txtMission);
    server.getPlayerList().sendMessage(txtSource);

    ServerStateMachine.this.currentMissionInit = missionInit;
    // Create the Mission Handlers
    try
    {
        this.ssmachine.initialiseHandlers(missionInit);
    }
    catch (Exception e)
    {
        // TODO: What?
    }
    // Move on to next state:
    episodeHasCompleted(ServerState.BUILDING_WORLD);
}
 
Example 3
Source File: BaseEntryList.java    From WearableBackpacks with MIT License 6 votes vote down vote up
public BaseEntryList(int width, List<T> defaultValue, List<T> previousValue) {
	super(Direction.VERTICAL);
	setCenteredHorizontal(width);

	this.defaultValue  = defaultValue;
	this.previousValue = previousValue;

	layoutList = new GuiLayout(Direction.VERTICAL);
	layoutList.setFillHorizontal();

	buttonAdd = new GuiButton(0, DEFAULT_ENTRY_HEIGHT, TextFormatting.GREEN + "+");
	buttonAdd.setFill();
	buttonAdd.setAction(this::addButtonPressed);

	addFixed(layoutList);
	addFixed(buttonAdd);

	setValue(previousValue);
}
 
Example 4
Source File: ItemMobHarness.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public String getItemStackDisplayName(ItemStack stack)
{
    if (stack.getTagCompound() == null || this.hasTarget(stack) == false)
    {
        return super.getItemStackDisplayName(stack);
    }

    String target = stack.getTagCompound().getString("TargetName");
    return super.getItemStackDisplayName(stack) + " " + TextFormatting.GREEN + target + TextFormatting.RESET + TextFormatting.WHITE;
}
 
Example 5
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 6
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"));
    }
}