Java Code Examples for net.minecraft.util.EnumChatFormatting

The following are top voted examples for showing how to use net.minecraft.util.EnumChatFormatting. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: minecraft-quiverbow   File: QuiverBow.java   View source code 6 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
	super.addInformation(stack, player, list, par4);

	if (player.capabilities.isCreativeMode)
	{
		list.add(EnumChatFormatting.BLUE + "Quiver: INFINITE / " + this.getMaxDamage() + " Arrows");
	}
	else
	{
		int ammo = this.getMaxDamage() - this.getDamage(stack);
		list.add(EnumChatFormatting.BLUE + "Quiver: " + ammo + " / " + this.getMaxDamage() + " Arrows");
	}

	list.add(EnumChatFormatting.GREEN + "Holds more Arrows.");

	list.add("Craft with up to 8 arrow bundles to reload.");
	list.add("A quiver has been sewn to this bow.");
}
 
Example 2
Project: minecraft-quiverbow   File: Crossbow_Double.java   View source code 6 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
	super.addInformation(stack, player, list, par4);

	if (player.capabilities.isCreativeMode)
	{
		list.add(EnumChatFormatting.BLUE + "Bolts: INFINITE / " + this.getMaxDamage());
	}
	else
	{
		int ammo = this.getMaxDamage() - this.getDamage(stack);
		list.add(EnumChatFormatting.BLUE + "Bolts: " + ammo + " / " + this.getMaxDamage());
	}

	list.add(EnumChatFormatting.BLUE + "Damage: " + this.DmgMin + " - " + this.DmgMax);
	list.add(EnumChatFormatting.GREEN + "Knockback " + this.Knockback + " on hit.");
	list.add(EnumChatFormatting.RED + "Cooldown for " + this.displayInSec(this.Cooldown) + " sec on use.");
	list.add(EnumChatFormatting.YELLOW + "Craft with 1 or 2 Arrows to reload.");
	list.add("A sticky piston powers the");
	list.add("reloading mechanism.");

	if (this.getCooldown(stack) != 0) {list.add(EnumChatFormatting.RED + "RE-TAUTING! (" + this.getCooldown(stack) + ")"); }
}
 
Example 3
Project: DecompiledMinecraft   File: NetHandlerPlayServer.java   View source code 6 votes vote down vote up
/**
 * Invoked when disconnecting, the parameter is a ChatComponent describing the reason for termination
 */
public void onDisconnect(IChatComponent reason)
{
    logger.info(this.playerEntity.getName() + " lost connection: " + reason);
    this.serverController.refreshStatusNextTick();
    ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("multiplayer.player.left", new Object[] {this.playerEntity.getDisplayName()});
    chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.YELLOW);
    this.serverController.getConfigurationManager().sendChatMsg(chatcomponenttranslation);
    this.playerEntity.mountEntityAndWakeUp();
    this.serverController.getConfigurationManager().playerLoggedOut(this.playerEntity);

    if (this.serverController.isSinglePlayer() && this.playerEntity.getName().equals(this.serverController.getServerOwner()))
    {
        logger.info("Stopping singleplayer server as player logged out");
        this.serverController.initiateShutdown();
    }
}
 
Example 4
Project: minecraft-quiverbow   File: CoinTosser.java   View source code 6 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
	super.addInformation(stack, player, list, par4);

	if (player.capabilities.isCreativeMode)
	{
		list.add(EnumChatFormatting.BLUE + "Gold Nuggets: INFINITE / " + this.getMaxDamage());
	}
	else
	{
		int ammo = this.getMaxDamage() - this.getDamage(stack);
		list.add(EnumChatFormatting.BLUE + "Gold Nuggets: " + ammo + " / " + this.getMaxDamage());
	}

	list.add(EnumChatFormatting.BLUE + "Damage: " + this.DmgMin + " - " + this.DmgMax + " per Nugget");
	list.add(EnumChatFormatting.GREEN + "Scatter 9 when firing.");
	list.add(EnumChatFormatting.RED + "Cooldown for " + this.displayInSec(this.Cooldown) + " sec on use.");
	list.add(EnumChatFormatting.YELLOW + "Crouch-use to drop the current magazine.");
	list.add(EnumChatFormatting.YELLOW + "Craft with a Gold Magazine to reload.");
	list.add("Spring-loaded. It's pretty heavy.");
}
 
Example 5
Project: minecraft-quiverbow   File: Crossbow_Blaze.java   View source code 6 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
	super.addInformation(stack, player, list, par4);

	if (player.capabilities.isCreativeMode)
	{
		list.add(EnumChatFormatting.BLUE + "Rods: INFINITE / " + this.getMaxDamage());
	}
	else
	{
		int ammo = this.getMaxDamage() - this.getDamage(stack);
		list.add(EnumChatFormatting.BLUE + "Rods: " + ammo + " / " + this.getMaxDamage());
	}

	list.add(EnumChatFormatting.BLUE + "Damage: " + this.DmgMin + " - " + this.DmgMax);
	list.add(EnumChatFormatting.GREEN + "Fire for " + this.FireDur + " sec on hit.");
	list.add(EnumChatFormatting.GREEN + "Knockback " + this.Knockback + " on hit.");
	list.add(EnumChatFormatting.YELLOW + "Craft with 1 Blaze Rod to reload.");
	list.add("Black smoke is slowly curling up from it.");
}
 
Example 6
Project: minecraft-quiverbow   File: Crossbow_Compact.java   View source code 6 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
	super.addInformation(stack, player, list, par4);

	if (player.capabilities.isCreativeMode)
	{
		list.add(EnumChatFormatting.BLUE + "Bolts: INFINITE / " + this.getMaxDamage());
	}
	else
	{
		int ammo = this.getMaxDamage() - this.getDamage(stack);
		list.add(EnumChatFormatting.BLUE + "Bolts: " + ammo + " / " + this.getMaxDamage());
	}

	list.add(EnumChatFormatting.BLUE + "Damage: " + this.DmgMin + " - " + this.DmgMax);
	list.add(EnumChatFormatting.GREEN + "Knockback " + this.Knockback + " on hit.");
	list.add(EnumChatFormatting.YELLOW + "Craft with 1 Arrow to reload.");
	list.add("A simple yet effective design.");
}
 
Example 7
Project: minecraft-quiverbow   File: Crossbow_AutoImp.java   View source code 6 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
	super.addInformation(stack, player, list, par4);

	if (player.capabilities.isCreativeMode)
	{
		list.add(EnumChatFormatting.BLUE + "Bolts: INFINITE / " + this.getMaxDamage());
	}
	else
	{
		int ammo = this.getMaxDamage() - this.getDamage(stack);
		list.add(EnumChatFormatting.BLUE + "Bolts: " + ammo + " / " + this.getMaxDamage());
	}

	list.add(EnumChatFormatting.BLUE + "Damage: " + this.DmgMin + " - " + this.DmgMax);
	list.add(EnumChatFormatting.GREEN + "Knockback " + this.Knockback + " on hit.");
	list.add(EnumChatFormatting.YELLOW + "Craft with up to 2 Arrow");
	list.add(EnumChatFormatting.YELLOW + "Bundles to reload.");
	list.add("Features a new and");
	list.add("improved bolt feeder.");
}
 
Example 8
Project: DecompiledMinecraft   File: TwitchStream.java   View source code 6 votes vote down vote up
public void func_152892_c(ErrorCode p_152892_1_)
{
    if (p_152892_1_ == ErrorCode.TTV_EC_SOUNDFLOWER_NOT_INSTALLED)
    {
        IChatComponent ichatcomponent = new ChatComponentTranslation("stream.unavailable.soundflower.chat.link", new Object[0]);
        ichatcomponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://help.mojang.com/customer/portal/articles/1374877-configuring-soundflower-for-streaming-on-apple-computers"));
        ichatcomponent.getChatStyle().setUnderlined(Boolean.valueOf(true));
        IChatComponent ichatcomponent1 = new ChatComponentTranslation("stream.unavailable.soundflower.chat", new Object[] {ichatcomponent});
        ichatcomponent1.getChatStyle().setColor(EnumChatFormatting.DARK_RED);
        this.mc.ingameGUI.getChatGUI().printChatMessage(ichatcomponent1);
    }
    else
    {
        IChatComponent ichatcomponent2 = new ChatComponentTranslation("stream.unavailable.unknown.chat", new Object[] {ErrorCode.getString(p_152892_1_)});
        ichatcomponent2.getChatStyle().setColor(EnumChatFormatting.DARK_RED);
        this.mc.ingameGUI.getChatGUI().printChatMessage(ichatcomponent2);
    }
}
 
Example 9
Project: BaseClient   File: CommandScoreboard.java   View source code 6 votes vote down vote up
protected void listObjectives(ICommandSender p_147196_1_) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard();
    Collection<ScoreObjective> collection = scoreboard.getScoreObjectives();

    if (collection.size() <= 0)
    {
        throw new CommandException("commands.scoreboard.objectives.list.empty", new Object[0]);
    }
    else
    {
        ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.scoreboard.objectives.list.count", new Object[] {Integer.valueOf(collection.size())});
        chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN);
        p_147196_1_.addChatMessage(chatcomponenttranslation);

        for (ScoreObjective scoreobjective : collection)
        {
            p_147196_1_.addChatMessage(new ChatComponentTranslation("commands.scoreboard.objectives.list.entry", new Object[] {scoreobjective.getName(), scoreobjective.getDisplayName(), scoreobjective.getCriteria().getName()}));
        }
    }
}
 
Example 10
Project: DecompiledMinecraft   File: GuiScreen.java   View source code 6 votes vote down vote up
protected void renderToolTip(ItemStack stack, int x, int y)
{
    List<String> list = stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);

    for (int i = 0; i < list.size(); ++i)
    {
        if (i == 0)
        {
            list.set(i, stack.getRarity().rarityColor + (String)list.get(i));
        }
        else
        {
            list.set(i, EnumChatFormatting.GRAY + (String)list.get(i));
        }
    }

    this.drawHoveringText(list, x, y);
}
 
Example 11
Project: DecompiledMinecraft   File: GuiGameOver.java   View source code 6 votes vote down vote up
/**
 * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
 */
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
    this.drawGradientRect(0, 0, this.width, this.height, 1615855616, -1602211792);
    GlStateManager.pushMatrix();
    GlStateManager.scale(2.0F, 2.0F, 2.0F);
    boolean flag = this.mc.theWorld.getWorldInfo().isHardcoreModeEnabled();
    String s = flag ? I18n.format("deathScreen.title.hardcore", new Object[0]) : I18n.format("deathScreen.title", new Object[0]);
    this.drawCenteredString(this.fontRendererObj, s, this.width / 2 / 2, 30, 16777215);
    GlStateManager.popMatrix();

    if (flag)
    {
        this.drawCenteredString(this.fontRendererObj, I18n.format("deathScreen.hardcoreInfo", new Object[0]), this.width / 2, 144, 16777215);
    }

    this.drawCenteredString(this.fontRendererObj, I18n.format("deathScreen.score", new Object[0]) + ": " + EnumChatFormatting.YELLOW + this.mc.thePlayer.getScore(), this.width / 2, 100, 16777215);
    super.drawScreen(mouseX, mouseY, partialTicks);
}
 
Example 12
Project: minecraft-quiverbow   File: EnderBow.java   View source code 6 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
    super.addInformation(stack, player, list, par4);
    
    int ammo = this.getMaxDamage() - this.getDamage(stack);
    
    list.add(EnumChatFormatting.BLUE + "Durability: " + ammo + " / " + this.getMaxDamage());
    
    list.add(EnumChatFormatting.GREEN + "Zoom on use.");
    list.add(EnumChatFormatting.GREEN + "Predictive arrow on use.");
    
    list.add("An ender-eye scope is attached.");
    list.add("It's staring at you.");
   }
 
Example 13
Project: BaseClient   File: TwitchStream.java   View source code 6 votes vote down vote up
public void func_152892_c(ErrorCode p_152892_1_)
{
    if (p_152892_1_ == ErrorCode.TTV_EC_SOUNDFLOWER_NOT_INSTALLED)
    {
        IChatComponent ichatcomponent = new ChatComponentTranslation("stream.unavailable.soundflower.chat.link", new Object[0]);
        ichatcomponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://help.mojang.com/customer/portal/articles/1374877-configuring-soundflower-for-streaming-on-apple-computers"));
        ichatcomponent.getChatStyle().setUnderlined(Boolean.valueOf(true));
        IChatComponent ichatcomponent1 = new ChatComponentTranslation("stream.unavailable.soundflower.chat", new Object[] {ichatcomponent});
        ichatcomponent1.getChatStyle().setColor(EnumChatFormatting.DARK_RED);
        this.mc.ingameGUI.getChatGUI().printChatMessage(ichatcomponent1);
    }
    else
    {
        IChatComponent ichatcomponent2 = new ChatComponentTranslation("stream.unavailable.unknown.chat", new Object[] {ErrorCode.getString(p_152892_1_)});
        ichatcomponent2.getChatStyle().setColor(EnumChatFormatting.DARK_RED);
        this.mc.ingameGUI.getChatGUI().printChatMessage(ichatcomponent2);
    }
}
 
Example 14
Project: BaseClient   File: NetHandlerPlayServer.java   View source code 6 votes vote down vote up
/**
 * Invoked when disconnecting, the parameter is a ChatComponent describing the reason for termination
 */
public void onDisconnect(IChatComponent reason)
{
    logger.info(this.playerEntity.getName() + " lost connection: " + reason);
    this.serverController.refreshStatusNextTick();
    ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("multiplayer.player.left", new Object[] {this.playerEntity.getDisplayName()});
    chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.YELLOW);
    this.serverController.getConfigurationManager().sendChatMsg(chatcomponenttranslation);
    this.playerEntity.mountEntityAndWakeUp();
    this.serverController.getConfigurationManager().playerLoggedOut(this.playerEntity);

    if (this.serverController.isSinglePlayer() && this.playerEntity.getName().equals(this.serverController.getServerOwner()))
    {
        logger.info("Stopping singleplayer server as player logged out");
        this.serverController.initiateShutdown();
    }
}
 
Example 15
Project: BaseClient   File: ItemEditableBook.java   View source code 6 votes vote down vote up
/**
 * allows items to add custom lines of information to the mouseover description
 */
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
{
    if (stack.hasTagCompound())
    {
        NBTTagCompound nbttagcompound = stack.getTagCompound();
        String s = nbttagcompound.getString("author");

        if (!StringUtils.isNullOrEmpty(s))
        {
            tooltip.add(EnumChatFormatting.GRAY + StatCollector.translateToLocalFormatted("book.byAuthor", new Object[] {s}));
        }

        tooltip.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("book.generation." + nbttagcompound.getInteger("generation")));
    }
}
 
Example 16
Project: minecraft-quiverbow   File: AI_Communication.java   View source code 6 votes vote down vote up
public static void tellOwnerAboutAmmo(Entity_AA turret, boolean secondRail)
{
	// Is empty, so telling the owner about this
	EntityPlayer owner = turret.worldObj.getPlayerEntityByName(turret.ownerName);

	if (owner == null) { return; }	// Might not be online right now
	
	// My name
	String turretName = "[ARMS ASSISTANT " + turret.getEntityId() + "]";
	if (turret.getCustomNameTag() != null && !turret.getCustomNameTag().isEmpty()) { turretName = "[" + turret.getCustomNameTag() + "]"; }

	if (secondRail)
	{
		owner.addChatMessage(new ChatComponentText(EnumChatFormatting.GRAY + turretName + ": Second rail is out of ammunition."));
	}
	else
	{
		owner.addChatMessage(new ChatComponentText(EnumChatFormatting.GRAY + turretName + ": First rail is out of ammunition."));
	}
}
 
Example 17
Project: BaseClient   File: TwitchStream.java   View source code 6 votes vote down vote up
public void func_152892_c(ErrorCode p_152892_1_)
{
    if (p_152892_1_ == ErrorCode.TTV_EC_SOUNDFLOWER_NOT_INSTALLED)
    {
        IChatComponent ichatcomponent = new ChatComponentTranslation("stream.unavailable.soundflower.chat.link", new Object[0]);
        ichatcomponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://help.mojang.com/customer/portal/articles/1374877-configuring-soundflower-for-streaming-on-apple-computers"));
        ichatcomponent.getChatStyle().setUnderlined(Boolean.valueOf(true));
        IChatComponent ichatcomponent1 = new ChatComponentTranslation("stream.unavailable.soundflower.chat", new Object[] {ichatcomponent});
        ichatcomponent1.getChatStyle().setColor(EnumChatFormatting.DARK_RED);
        this.mc.ingameGUI.getChatGUI().printChatMessage(ichatcomponent1);
    }
    else
    {
        IChatComponent ichatcomponent2 = new ChatComponentTranslation("stream.unavailable.unknown.chat", new Object[] {ErrorCode.getString(p_152892_1_)});
        ichatcomponent2.getChatStyle().setColor(EnumChatFormatting.DARK_RED);
        this.mc.ingameGUI.getChatGUI().printChatMessage(ichatcomponent2);
    }
}
 
Example 18
Project: BaseClient   File: RendererLivingEntity.java   View source code 5 votes vote down vote up
protected void rotateCorpse(T bat, float p_77043_2_, float p_77043_3_, float partialTicks)
{
    GlStateManager.rotate(180.0F - p_77043_3_, 0.0F, 1.0F, 0.0F);

    if (bat.deathTime > 0)
    {
        float f = ((float)bat.deathTime + partialTicks - 1.0F) / 20.0F * 1.6F;
        f = MathHelper.sqrt_float(f);

        if (f > 1.0F)
        {
            f = 1.0F;
        }

        GlStateManager.rotate(f * this.getDeathMaxRotation(bat), 0.0F, 0.0F, 1.0F);
    }
    else
    {
        String s = EnumChatFormatting.getTextWithoutFormattingCodes(bat.getName());

        if (s != null && (s.equals("Dinnerbone") || s.equals("Grumm")) && (!(bat instanceof EntityPlayer) || ((EntityPlayer)bat).isWearing(EnumPlayerModelParts.CAPE)))
        {
            GlStateManager.translate(0.0F, bat.height + 0.1F, 0.0F);
            GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
        }
    }
}
 
Example 19
Project: nei-lotr   File: ModVersion.java   View source code 5 votes vote down vote up
public IChatComponent getFormattedChatText() {
	String text = StatCollector.translateToLocal("neiLotr.versionChecker.notification.chat");
	String[] parts = text.split("7");
	String text1 = parts[0];
	String text2 = parts[1];
	String text3 = parts[2];
	String text4 = parts[3];

	ChatComponentText chat1 = (ChatComponentText) new ChatComponentText("[NEI LOTR]: ")
			.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GREEN));
	ChatComponentText chat2 = (ChatComponentText) new ChatComponentText(text1 + " ")
			.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.WHITE));
	ChatComponentText chat3 = (ChatComponentText) new ChatComponentText(text2)
			.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.BLUE).setUnderlined(true)
					.setChatClickEvent(
							new ClickEvent(Action.OPEN_URL, "https://goo.gl/EkxFlC"))
					.setChatHoverEvent(
							new HoverEvent(net.minecraft.event.HoverEvent.Action.SHOW_TEXT,
									new ChatComponentText(StatCollector
											.translateToLocal("neiLotr.versionChecker.notification.changelog")
											.replace("/", "\n")))));
	ChatComponentText chat4 = (ChatComponentText) new ChatComponentText(" " + text3 + " ")
			.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.WHITE));
	ChatComponentText chat5 = (ChatComponentText) new ChatComponentText(state.toString() + " " + version)
			.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW).setUnderlined(true)
					.setChatClickEvent(
							new ClickEvent(Action.OPEN_URL, url))
					.setChatHoverEvent(
							new HoverEvent(net.minecraft.event.HoverEvent.Action.SHOW_TEXT,
									new ChatComponentText(StatCollector
											.translateToLocal("neiLotr.versionChecker.notification.newVersion")
											.replace("/", "\n")))));
	ChatComponentText chat6 = (ChatComponentText) new ChatComponentText(" " + text4 + " ")
			.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.WHITE));
	ChatComponentText chat7 = (ChatComponentText) new ChatComponentText(mcVersion)
			.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.WHITE));

	return chat1.appendSibling(chat2).appendSibling(chat3).appendSibling(chat4).appendSibling(chat5)
			.appendSibling(chat6).appendSibling(chat7);
}
 
Example 20
Project: BaseClient   File: TwitchStream.java   View source code 5 votes vote down vote up
public void func_180605_a(String p_180605_1_, ChatRawMessage[] p_180605_2_)
{
    for (ChatRawMessage chatrawmessage : p_180605_2_)
    {
        this.func_176027_a(chatrawmessage.userName, chatrawmessage);

        if (this.func_176028_a(chatrawmessage.modes, chatrawmessage.subscriptions, this.mc.gameSettings.streamChatUserFilter))
        {
            IChatComponent ichatcomponent = new ChatComponentText(chatrawmessage.userName);
            IChatComponent ichatcomponent1 = new ChatComponentTranslation("chat.stream." + (chatrawmessage.action ? "emote" : "text"), new Object[] {this.twitchComponent, ichatcomponent, EnumChatFormatting.getTextWithoutFormattingCodes(chatrawmessage.message)});

            if (chatrawmessage.action)
            {
                ichatcomponent1.getChatStyle().setItalic(Boolean.valueOf(true));
            }

            IChatComponent ichatcomponent2 = new ChatComponentText("");
            ichatcomponent2.appendSibling(new ChatComponentTranslation("stream.userinfo.chatTooltip", new Object[0]));

            for (IChatComponent ichatcomponent3 : GuiTwitchUserMode.func_152328_a(chatrawmessage.modes, chatrawmessage.subscriptions, (IStream)null))
            {
                ichatcomponent2.appendText("\n");
                ichatcomponent2.appendSibling(ichatcomponent3);
            }

            ichatcomponent.getChatStyle().setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, ichatcomponent2));
            ichatcomponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.TWITCH_USER_INFO, chatrawmessage.userName));
            this.mc.ingameGUI.getChatGUI().printChatMessage(ichatcomponent1);
        }
    }
}
 
Example 21
Project: BaseClient   File: GuiScreenBook.java   View source code 5 votes vote down vote up
/**
 * Processes any text getting inserted into the current page, enforcing the page size limit
 */
private void pageInsertIntoCurrent(String p_146459_1_)
{
    String s = this.pageGetCurrent();
    String s1 = s + p_146459_1_;
    int i = this.fontRendererObj.splitStringWidth(s1 + "" + EnumChatFormatting.BLACK + "_", 118);

    if (i <= 128 && s1.length() < 256)
    {
        this.pageSetCurrent(s1);
    }
}
 
Example 22
Project: SerenityCE   File: Module.java   View source code 5 votes vote down vote up
public void setActiveMode(int modeIndex) {
    if (moduleModes.size() <= modeIndex)
        throw new IllegalArgumentException();

    int oldActiveModeIndex = activeModeIndex;
    activeModeIndex = modeIndex;
    setDisplay(String.format("%s %s[%s]", this.getName(), EnumChatFormatting.GRAY, getActiveMode().getName()));

    if (this.isEnabled()) {
        getModuleModes().get(oldActiveModeIndex).getListeners().forEach(EventManager::unregister);
        getModuleModes().get(oldActiveModeIndex).onDisable();
        getModuleModes().get(activeModeIndex).getListeners().forEach(EventManager::register);
        getModuleModes().get(activeModeIndex).onEnable();
    }
}
 
Example 23
Project: BaseClient   File: StatBase.java   View source code 5 votes vote down vote up
public IChatComponent getStatName()
{
    IChatComponent ichatcomponent = this.statName.createCopy();
    ichatcomponent.getChatStyle().setColor(EnumChatFormatting.GRAY);
    ichatcomponent.getChatStyle().setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_ACHIEVEMENT, new ChatComponentText(this.statId)));
    return ichatcomponent;
}
 
Example 24
Project: DecompiledMinecraft   File: Scoreboard.java   View source code 5 votes vote down vote up
/**
 * Returns 'list' for 0, 'sidebar' for 1, 'belowName for 2, otherwise null.
 */
public static String getObjectiveDisplaySlot(int p_96517_0_)
{
    switch (p_96517_0_)
    {
        case 0:
            return "list";

        case 1:
            return "sidebar";

        case 2:
            return "belowName";

        default:
            if (p_96517_0_ >= 3 && p_96517_0_ <= 18)
            {
                EnumChatFormatting enumchatformatting = EnumChatFormatting.func_175744_a(p_96517_0_ - 3);

                if (enumchatformatting != null && enumchatformatting != EnumChatFormatting.RESET)
                {
                    return "sidebar.team." + enumchatformatting.getFriendlyName();
                }
            }

            return null;
    }
}
 
Example 25
Project: DecompiledMinecraft   File: Scoreboard.java   View source code 5 votes vote down vote up
/**
 * Returns 0 for (case-insensitive) 'list', 1 for 'sidebar', 2 for 'belowName', otherwise -1.
 */
public static int getObjectiveDisplaySlotNumber(String p_96537_0_)
{
    if (p_96537_0_.equalsIgnoreCase("list"))
    {
        return 0;
    }
    else if (p_96537_0_.equalsIgnoreCase("sidebar"))
    {
        return 1;
    }
    else if (p_96537_0_.equalsIgnoreCase("belowName"))
    {
        return 2;
    }
    else
    {
        if (p_96537_0_.startsWith("sidebar.team."))
        {
            String s = p_96537_0_.substring("sidebar.team.".length());
            EnumChatFormatting enumchatformatting = EnumChatFormatting.getValueByName(s);

            if (enumchatformatting != null && enumchatformatting.getColorIndex() >= 0)
            {
                return enumchatformatting.getColorIndex() + 3;
            }
        }

        return -1;
    }
}
 
Example 26
Project: DecompiledMinecraft   File: CommandHandler.java   View source code 5 votes vote down vote up
protected boolean tryExecute(ICommandSender sender, String[] args, ICommand command, String input)
{
    try
    {
        command.processCommand(sender, args);
        return true;
    }
    catch (WrongUsageException wrongusageexception)
    {
        ChatComponentTranslation chatcomponenttranslation2 = new ChatComponentTranslation("commands.generic.usage", new Object[] {new ChatComponentTranslation(wrongusageexception.getMessage(), wrongusageexception.getErrorObjects())});
        chatcomponenttranslation2.getChatStyle().setColor(EnumChatFormatting.RED);
        sender.addChatMessage(chatcomponenttranslation2);
    }
    catch (CommandException commandexception)
    {
        ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation(commandexception.getMessage(), commandexception.getErrorObjects());
        chatcomponenttranslation1.getChatStyle().setColor(EnumChatFormatting.RED);
        sender.addChatMessage(chatcomponenttranslation1);
    }
    catch (Throwable var9)
    {
        ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.generic.exception", new Object[0]);
        chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED);
        sender.addChatMessage(chatcomponenttranslation);
        logger.warn("Couldn\'t process command: \'" + input + "\'");
    }

    return false;
}
 
Example 27
Project: DecompiledMinecraft   File: CommandMessage.java   View source code 5 votes vote down vote up
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 2)
    {
        throw new WrongUsageException("commands.message.usage", new Object[0]);
    }
    else
    {
        EntityPlayer entityplayer = getPlayer(sender, args[0]);

        if (entityplayer == sender)
        {
            throw new PlayerNotFoundException("commands.message.sameTarget", new Object[0]);
        }
        else
        {
            IChatComponent ichatcomponent = getChatComponentFromNthArg(sender, args, 1, !(sender instanceof EntityPlayer));
            ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.message.display.incoming", new Object[] {sender.getDisplayName(), ichatcomponent.createCopy()});
            ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("commands.message.display.outgoing", new Object[] {entityplayer.getDisplayName(), ichatcomponent.createCopy()});
            chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.GRAY).setItalic(Boolean.valueOf(true));
            chatcomponenttranslation1.getChatStyle().setColor(EnumChatFormatting.GRAY).setItalic(Boolean.valueOf(true));
            entityplayer.addChatMessage(chatcomponenttranslation);
            sender.addChatMessage(chatcomponenttranslation1);
        }
    }
}
 
Example 28
Project: Proyecto-DASI   File: ServerQuitFromTimeUpImplementation.java   View source code 5 votes vote down vote up
@Override
protected void drawCountDown(int secondsRemaining)
{
	Map<String, String> data = new HashMap<String, String>();
	
       String text = EnumChatFormatting.BOLD + "" + secondsRemaining + "...";
       if (secondsRemaining <= 5)
           text = EnumChatFormatting.RED + text;

	data.put("chat", text);
	MalmoMod.safeSendToAll(MalmoMessageType.SERVER_TEXT, data);
}
 
Example 29
Project: BaseClient   File: GuiSelectWorld.java   View source code 5 votes vote down vote up
protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int mouseXIn, int mouseYIn)
{
    SaveFormatComparator saveformatcomparator = (SaveFormatComparator)GuiSelectWorld.this.field_146639_s.get(entryID);
    String s = saveformatcomparator.getDisplayName();

    if (StringUtils.isEmpty(s))
    {
        s = GuiSelectWorld.this.field_146637_u + " " + (entryID + 1);
    }

    String s1 = saveformatcomparator.getFileName();
    s1 = s1 + " (" + GuiSelectWorld.this.field_146633_h.format(new Date(saveformatcomparator.getLastTimePlayed()));
    s1 = s1 + ")";
    String s2 = "";

    if (saveformatcomparator.requiresConversion())
    {
        s2 = GuiSelectWorld.this.field_146636_v + " " + s2;
    }
    else
    {
        s2 = GuiSelectWorld.this.field_146635_w[saveformatcomparator.getEnumGameType().getID()];

        if (saveformatcomparator.isHardcoreModeEnabled())
        {
            s2 = EnumChatFormatting.DARK_RED + I18n.format("gameMode.hardcore", new Object[0]) + EnumChatFormatting.RESET;
        }

        if (saveformatcomparator.getCheatsEnabled())
        {
            s2 = s2 + ", " + I18n.format("selectWorld.cheats", new Object[0]);
        }
    }

    GuiSelectWorld.this.drawString(GuiSelectWorld.this.fontRendererObj, s, p_180791_2_ + 2, p_180791_3_ + 1, 16777215);
    GuiSelectWorld.this.drawString(GuiSelectWorld.this.fontRendererObj, s1, p_180791_2_ + 2, p_180791_3_ + 12, 8421504);
    GuiSelectWorld.this.drawString(GuiSelectWorld.this.fontRendererObj, s2, p_180791_2_ + 2, p_180791_3_ + 12 + 10, 8421504);
}
 
Example 30
Project: DecompiledMinecraft   File: RendererLivingEntity.java   View source code 5 votes vote down vote up
protected void rotateCorpse(T bat, float p_77043_2_, float p_77043_3_, float partialTicks)
{
    GlStateManager.rotate(180.0F - p_77043_3_, 0.0F, 1.0F, 0.0F);

    if (bat.deathTime > 0)
    {
        float f = ((float)bat.deathTime + partialTicks - 1.0F) / 20.0F * 1.6F;
        f = MathHelper.sqrt_float(f);

        if (f > 1.0F)
        {
            f = 1.0F;
        }

        GlStateManager.rotate(f * this.getDeathMaxRotation(bat), 0.0F, 0.0F, 1.0F);
    }
    else
    {
        String s = EnumChatFormatting.getTextWithoutFormattingCodes(bat.getName());

        if (s != null && (s.equals("Dinnerbone") || s.equals("Grumm")) && (!(bat instanceof EntityPlayer) || ((EntityPlayer)bat).isWearing(EnumPlayerModelParts.CAPE)))
        {
            GlStateManager.translate(0.0F, bat.height + 0.1F, 0.0F);
            GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
        }
    }
}
 
Example 31
Project: BaseClient   File: NetHandlerPlayServer.java   View source code 5 votes vote down vote up
public void processUpdateSign(C12PacketUpdateSign packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer());
    this.playerEntity.markPlayerActive();
    WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension);
    BlockPos blockpos = packetIn.getPosition();

    if (worldserver.isBlockLoaded(blockpos))
    {
        TileEntity tileentity = worldserver.getTileEntity(blockpos);

        if (!(tileentity instanceof TileEntitySign))
        {
            return;
        }

        TileEntitySign tileentitysign = (TileEntitySign)tileentity;

        if (!tileentitysign.getIsEditable() || tileentitysign.getPlayer() != this.playerEntity)
        {
            this.serverController.logWarning("Player " + this.playerEntity.getName() + " just tried to change non-editable sign");
            return;
        }

        IChatComponent[] aichatcomponent = packetIn.getLines();

        for (int i = 0; i < aichatcomponent.length; ++i)
        {
            tileentitysign.signText[i] = new ChatComponentText(EnumChatFormatting.getTextWithoutFormattingCodes(aichatcomponent[i].getUnformattedText()));
        }

        tileentitysign.markDirty();
        worldserver.markBlockForUpdate(blockpos);
    }
}
 
Example 32
Project: DecompiledMinecraft   File: GuiScreenBook.java   View source code 5 votes vote down vote up
/**
 * Processes any text getting inserted into the current page, enforcing the page size limit
 */
private void pageInsertIntoCurrent(String p_146459_1_)
{
    String s = this.pageGetCurrent();
    String s1 = s + p_146459_1_;
    int i = this.fontRendererObj.splitStringWidth(s1 + "" + EnumChatFormatting.BLACK + "_", 118);

    if (i <= 128 && s1.length() < 256)
    {
        this.pageSetCurrent(s1);
    }
}
 
Example 33
Project: minecraft-quiverbow   File: FlintDuster.java   View source code 5 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
	super.addInformation(stack, player, list, par4);

	if (player.capabilities.isCreativeMode)
	{
		list.add(EnumChatFormatting.BLUE + "Flint Dust: INFINITE / " + this.getMaxDamage());
	}
	else
	{
		int ammo = this.getMaxDamage() - this.getDamage(stack);
		list.add(EnumChatFormatting.BLUE + "Flint Dust: " + ammo + " / " + this.getMaxDamage());
	}

	list.add(EnumChatFormatting.BLUE + "Damage: " + this.Dmg);
	list.add(EnumChatFormatting.BLUE + "Range: Roughly " + this.MaxBlocks + " Blocks.");

	list.add(EnumChatFormatting.GREEN + "A mining tool.");

	list.add(EnumChatFormatting.YELLOW + "Craft with up to 8 Boxes of");
	list.add(EnumChatFormatting.YELLOW + "Flint Dust to reload.");

	list.add("The quartz is barely visible");
	list.add("beneath the dust coating.");
}
 
Example 34
Project: minecraft-quiverbow   File: SeedSweeper.java   View source code 5 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
	super.addInformation(stack, player, list, par4);

	if (player.capabilities.isCreativeMode)
	{
		list.add(EnumChatFormatting.BLUE + "Seeds: INFINITE / " + this.getMaxDamage());
	}
	else
	{
		int ammo = this.getMaxDamage() - this.getDamage(stack);
		list.add(EnumChatFormatting.BLUE + "Seeds: " + ammo + " / " + this.getMaxDamage());
	}

	list.add(EnumChatFormatting.BLUE + "Damage: " + this.Dmg + " per seed.");

	list.add(EnumChatFormatting.GREEN + "Scatter 8 when firing.");

	list.add(EnumChatFormatting.RED + "Cooldown for " + this.displayInSec(this.Cooldown) + " sec on use.");

	list.add(EnumChatFormatting.YELLOW + "Crouch-use to drop the current jar.");
	list.add(EnumChatFormatting.YELLOW + "Craft with 1 Seed Jar to reload");
	list.add(EnumChatFormatting.YELLOW + "when empty.");

	list.add("Git off my farm!");
}
 
Example 35
Project: minecraft-quiverbow   File: FrostLancer.java   View source code 5 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
	super.addInformation(stack, player, list, par4);

	if (player.capabilities.isCreativeMode)
	{
		list.add(EnumChatFormatting.BLUE + "Cold Iron: INFINITE / " + this.getMaxDamage());
	}
	else
	{
		int ammo = this.getMaxDamage() - this.getDamage(stack);
		list.add(EnumChatFormatting.BLUE + "Cold Iron: " + ammo + " / " + this.getMaxDamage());
	}

	list.add(EnumChatFormatting.BLUE + "Damage: " + this.DmgMin + " - " + this.DmgMax);

	list.add(EnumChatFormatting.GREEN + "Slowness " + this.Slowness_Str + " for " + this.displayInSec(this.Slowness_Dur) + " sec on hit.");
	list.add(EnumChatFormatting.GREEN + "Nausea 1 for " + this.displayInSec(this.Nausea_Dur) + " sec on hit.");

	list.add(EnumChatFormatting.RED + "Cooldown for " + this.displayInSec(this.Cooldown) + " sec on use.");

	list.add(EnumChatFormatting.YELLOW + "Craft with 1 Cold Iron Clip to reload.");
	list.add(EnumChatFormatting.YELLOW + "Crouch to zoom.");

	list.add("A quartz ender-eye scope is attached.");
	list.add("It's staring past you with aloof disdain.");

	if (this.getCooldown(stack) > 0)
	{
		list.add(EnumChatFormatting.RED + "COOLING DOWN! (" + this.getCooldown(stack) + ")");
	}
}
 
Example 36
Project: BaseClient   File: Scoreboard.java   View source code 5 votes vote down vote up
/**
 * Returns 'list' for 0, 'sidebar' for 1, 'belowName for 2, otherwise null.
 */
public static String getObjectiveDisplaySlot(int p_96517_0_)
{
    switch (p_96517_0_)
    {
        case 0:
            return "list";

        case 1:
            return "sidebar";

        case 2:
            return "belowName";

        default:
            if (p_96517_0_ >= 3 && p_96517_0_ <= 18)
            {
                EnumChatFormatting enumchatformatting = EnumChatFormatting.func_175744_a(p_96517_0_ - 3);

                if (enumchatformatting != null && enumchatformatting != EnumChatFormatting.RESET)
                {
                    return "sidebar.team." + enumchatformatting.getFriendlyName();
                }
            }

            return null;
    }
}
 
Example 37
Project: BaseClient   File: CommandScoreboard.java   View source code 5 votes vote down vote up
protected void listPlayers(ICommandSender p_147195_1_, String[] p_147195_2_, int p_147195_3_) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard();

    if (p_147195_2_.length > p_147195_3_)
    {
        String s = getEntityName(p_147195_1_, p_147195_2_[p_147195_3_]);
        Map<ScoreObjective, Score> map = scoreboard.getObjectivesForEntity(s);
        p_147195_1_.setCommandStat(CommandResultStats.Type.QUERY_RESULT, map.size());

        if (map.size() <= 0)
        {
            throw new CommandException("commands.scoreboard.players.list.player.empty", new Object[] {s});
        }

        ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.scoreboard.players.list.player.count", new Object[] {Integer.valueOf(map.size()), s});
        chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN);
        p_147195_1_.addChatMessage(chatcomponenttranslation);

        for (Score score : map.values())
        {
            p_147195_1_.addChatMessage(new ChatComponentTranslation("commands.scoreboard.players.list.player.entry", new Object[] {Integer.valueOf(score.getScorePoints()), score.getObjective().getDisplayName(), score.getObjective().getName()}));
        }
    }
    else
    {
        Collection<String> collection = scoreboard.getObjectiveNames();
        p_147195_1_.setCommandStat(CommandResultStats.Type.QUERY_RESULT, collection.size());

        if (collection.size() <= 0)
        {
            throw new CommandException("commands.scoreboard.players.list.empty", new Object[0]);
        }

        ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("commands.scoreboard.players.list.count", new Object[] {Integer.valueOf(collection.size())});
        chatcomponenttranslation1.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN);
        p_147195_1_.addChatMessage(chatcomponenttranslation1);
        p_147195_1_.addChatMessage(new ChatComponentText(joinNiceString(collection.toArray())));
    }
}
 
Example 38
Project: Ye-Olde-Chat   File: CommandGetRoleplayMode.java   View source code 5 votes vote down vote up
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public String getCommandUsage(ICommandSender par1ICommandSender) {
	String[] str = { "/getroleplaymode" };
	List l = new ArrayList();
	for (int i = 0; i < str.length; i++) {
		l.add(EnumChatFormatting.RED);
		l.add(str[i]);
	}
	StringBuilder finalStr = new StringBuilder();
	for (int i = 0; i < l.size(); i++) {
		finalStr.append(l.get(i));
	}
	return finalStr.toString();
}
 
Example 39
Project: BaseClient   File: Scoreboard.java   View source code 5 votes vote down vote up
/**
 * Returns 0 for (case-insensitive) 'list', 1 for 'sidebar', 2 for 'belowName', otherwise -1.
 */
public static int getObjectiveDisplaySlotNumber(String p_96537_0_)
{
    if (p_96537_0_.equalsIgnoreCase("list"))
    {
        return 0;
    }
    else if (p_96537_0_.equalsIgnoreCase("sidebar"))
    {
        return 1;
    }
    else if (p_96537_0_.equalsIgnoreCase("belowName"))
    {
        return 2;
    }
    else
    {
        if (p_96537_0_.startsWith("sidebar.team."))
        {
            String s = p_96537_0_.substring("sidebar.team.".length());
            EnumChatFormatting enumchatformatting = EnumChatFormatting.getValueByName(s);

            if (enumchatformatting != null && enumchatformatting.getColorIndex() >= 0)
            {
                return enumchatformatting.getColorIndex() + 3;
            }
        }

        return -1;
    }
}
 
Example 40
Project: DecompiledMinecraft   File: Scoreboard.java   View source code 5 votes vote down vote up
/**
 * Returns 0 for (case-insensitive) 'list', 1 for 'sidebar', 2 for 'belowName', otherwise -1.
 */
public static int getObjectiveDisplaySlotNumber(String p_96537_0_)
{
    if (p_96537_0_.equalsIgnoreCase("list"))
    {
        return 0;
    }
    else if (p_96537_0_.equalsIgnoreCase("sidebar"))
    {
        return 1;
    }
    else if (p_96537_0_.equalsIgnoreCase("belowName"))
    {
        return 2;
    }
    else
    {
        if (p_96537_0_.startsWith("sidebar.team."))
        {
            String s = p_96537_0_.substring("sidebar.team.".length());
            EnumChatFormatting enumchatformatting = EnumChatFormatting.getValueByName(s);

            if (enumchatformatting != null && enumchatformatting.getColorIndex() >= 0)
            {
                return enumchatformatting.getColorIndex() + 3;
            }
        }

        return -1;
    }
}