当前位置: 首页>>代码示例>>Java>>正文


Java ChatComponentText类代码示例

本文整理汇总了Java中net.minecraft.util.ChatComponentText的典型用法代码示例。如果您正苦于以下问题:Java ChatComponentText类的具体用法?Java ChatComponentText怎么用?Java ChatComponentText使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ChatComponentText类属于net.minecraft.util包,在下文中一共展示了ChatComponentText类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCommandUsage

import net.minecraft.util.ChatComponentText; //导入依赖的package包/类
@Override
public String getCommandUsage(ICommandSender sender)
{
    ChatComponentText chatcomponenttranslation1 = new ChatComponentText("creeperhostserver.command.pregen.usage1");
    chatcomponenttranslation1.getChatStyle().setColor(EnumChatFormatting.RED);
    sender.addChatMessage(chatcomponenttranslation1);
    ChatComponentText chatcomponenttranslation2 = new ChatComponentText("creeperhostserver.command.pregen.usage2");
    chatcomponenttranslation2.getChatStyle().setColor(EnumChatFormatting.RED);
    sender.addChatMessage(chatcomponenttranslation2);
    ChatComponentText chatcomponenttranslation3 = new ChatComponentText("creeperhostserver.command.pregen.usage3");
    chatcomponenttranslation3.getChatStyle().setColor(EnumChatFormatting.RED);
    sender.addChatMessage(chatcomponenttranslation3);
    ChatComponentText chatcomponenttranslation4 = new ChatComponentText("creeperhostserver.command.pregen.usage4");
    chatcomponenttranslation4.getChatStyle().setColor(EnumChatFormatting.RED);
    sender.addChatMessage(chatcomponenttranslation4);
    return "creeperhostserver.command.pregen.usage5";
}
 
开发者ID:CreeperHost,项目名称:CreeperHostGui,代码行数:18,代码来源:CommandPregen.java

示例2: tellOwnerAboutAmmo

import net.minecraft.util.ChatComponentText; //导入依赖的package包/类
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."));
	}
}
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:21,代码来源:AI_Communication.java

示例3: handleUpdateSign

import net.minecraft.util.ChatComponentText; //导入依赖的package包/类
/**
 * Updates a specified sign with the specified text lines
 */
public void handleUpdateSign(S33PacketUpdateSign packetIn) {
	PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
	boolean flag = false;

	if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos())) {
		TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos());

		if (tileentity instanceof TileEntitySign) {
			TileEntitySign tileentitysign = (TileEntitySign) tileentity;

			if (tileentitysign.getIsEditable()) {
				System.arraycopy(packetIn.getLines(), 0, tileentitysign.signText, 0, 4);
				tileentitysign.markDirty();
			}

			flag = true;
		}
	}

	if (!flag && this.gameController.thePlayer != null) {
		this.gameController.thePlayer.addChatMessage(new ChatComponentText("Unable to locate sign at "
				+ packetIn.getPos().getX() + ", " + packetIn.getPos().getY() + ", " + packetIn.getPos().getZ()));
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:28,代码来源:NetHandlerPlayClient.java

示例4: getDisplayName

import net.minecraft.util.ChatComponentText; //导入依赖的package包/类
/**
 * Get the formatted ChatComponent that will be used for the sender's username in chat
 */
public IChatComponent getDisplayName()
{
    if (this.hasCustomName())
    {
        ChatComponentText chatcomponenttext = new ChatComponentText(this.entityName);
        chatcomponenttext.getChatStyle().setChatHoverEvent(this.getHoverEvent());
        chatcomponenttext.getChatStyle().setInsertion(this.getUniqueID().toString());
        return chatcomponenttext;
    }
    else
    {
        ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation(this.getName(), new Object[0]);
        chatcomponenttranslation.getChatStyle().setChatHoverEvent(this.getHoverEvent());
        chatcomponenttranslation.getChatStyle().setInsertion(this.getUniqueID().toString());
        return chatcomponenttranslation;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:21,代码来源:EntityMinecart.java

示例5: removeAll

import net.minecraft.util.ChatComponentText; //导入依赖的package包/类
public void removeAll()
{
    synchronized (this.connections)
    {
        Iterator<NetworkManager> iterator = this.connections.iterator();

        while (iterator.hasNext())
        {
            NetworkManager networkmanager = (NetworkManager)iterator.next();

            if (networkmanager.isChannelOpen())
            {
                iterator.remove();
                networkmanager.closeChannel(new ChatComponentText("Cancelled"));
            }
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:19,代码来源:RealmsServerStatusPinger.java

示例6: checkDisconnected

import net.minecraft.util.ChatComponentText; //导入依赖的package包/类
public void checkDisconnected()
{
    if (this.channel != null && !this.channel.isOpen())
    {
        if (!this.disconnected)
        {
            this.disconnected = true;

            if (this.getExitMessage() != null)
            {
                this.getNetHandler().onDisconnect(this.getExitMessage());
            }
            else if (this.getNetHandler() != null)
            {
                this.getNetHandler().onDisconnect(new ChatComponentText("Disconnected"));
            }
        }
        else
        {
            logger.warn("handleDisconnection() called twice");
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:24,代码来源:NetworkManager.java

示例7: clearPendingNetworks

import net.minecraft.util.ChatComponentText; //导入依赖的package包/类
public void clearPendingNetworks()
{
    synchronized (this.pingDestinations)
    {
        Iterator<NetworkManager> iterator = this.pingDestinations.iterator();

        while (iterator.hasNext())
        {
            NetworkManager networkmanager = (NetworkManager)iterator.next();

            if (networkmanager.isChannelOpen())
            {
                iterator.remove();
                networkmanager.closeChannel(new ChatComponentText("Cancelled"));
            }
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:19,代码来源:OldServerPinger.java

示例8: getChatComponent

import net.minecraft.util.ChatComponentText; //导入依赖的package包/类
/**
 * Get a ChatComponent for this Item's display name that shows this Item on hover
 */
public IChatComponent getChatComponent()
{
    ChatComponentText chatcomponenttext = new ChatComponentText(this.getDisplayName());

    if (this.hasDisplayName())
    {
        chatcomponenttext.getChatStyle().setItalic(Boolean.valueOf(true));
    }

    IChatComponent ichatcomponent = (new ChatComponentText("[")).appendSibling(chatcomponenttext).appendText("]");

    if (this.item != null)
    {
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        this.writeToNBT(nbttagcompound);
        ichatcomponent.getChatStyle().setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_ITEM, new ChatComponentText(nbttagcompound.toString())));
        ichatcomponent.getChatStyle().setColor(this.getRarity().rarityColor);
    }

    return ichatcomponent;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:25,代码来源:ItemStack.java

示例9: join

import net.minecraft.util.ChatComponentText; //导入依赖的package包/类
public static IChatComponent join(List<IChatComponent> components)
{
    IChatComponent ichatcomponent = new ChatComponentText("");

    for (int i = 0; i < components.size(); ++i)
    {
        if (i > 0)
        {
            if (i == components.size() - 1)
            {
                ichatcomponent.appendText(" and ");
            }
            else if (i > 0)
            {
                ichatcomponent.appendText(", ");
            }
        }

        ichatcomponent.appendSibling((IChatComponent)components.get(i));
    }

    return ichatcomponent;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:24,代码来源:CommandBase.java

示例10: getFormattedChatText

import net.minecraft.util.ChatComponentText; //导入依赖的package包/类
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);
}
 
开发者ID:CraftedMods,项目名称:nei-lotr,代码行数:41,代码来源:ModVersion.java

示例11: actionPerformed

import net.minecraft.util.ChatComponentText; //导入依赖的package包/类
@Override
protected void actionPerformed(GuiButton button)
{
    if (button.id == 0)
    {
        if (captiveConnecting != null)
        {
            if (lastNetworkManager != null)
            {
                lastNetworkManager.closeChannel(new ChatComponentText("Aborted"));
            }

            try
            {
                if (cancelField == null)
                {
                    cancelField = ReflectionHelper.findField(GuiConnecting.class, "field_146373_h", "cancel");
                }
                cancelField.set(captiveConnecting, true);
            }
            catch (Throwable e)
            {

            }
        }
    }
    super.actionPerformed(button);
}
 
开发者ID:CreeperHost,项目名称:CreeperHostGui,代码行数:29,代码来源:GuiProgressDisconnected.java

示例12: getHoverEvent

import net.minecraft.util.ChatComponentText; //导入依赖的package包/类
protected HoverEvent getHoverEvent()
{
    NBTTagCompound nbttagcompound = new NBTTagCompound();
    String s = EntityList.getEntityString(this);
    nbttagcompound.setString("id", this.getUniqueID().toString());

    if (s != null)
    {
        nbttagcompound.setString("type", s);
    }

    nbttagcompound.setString("name", this.getName());
    return new HoverEvent(HoverEvent.Action.SHOW_ENTITY, new ChatComponentText(nbttagcompound.toString()));
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:15,代码来源:Entity.java

示例13: func_175355_a

import net.minecraft.util.ChatComponentText; //导入依赖的package包/类
public String func_175355_a(EnumDifficulty p_175355_1_)
{
    IChatComponent ichatcomponent = new ChatComponentText("");
    ichatcomponent.appendSibling(new ChatComponentTranslation("options.difficulty", new Object[0]));
    ichatcomponent.appendText(": ");
    ichatcomponent.appendSibling(new ChatComponentTranslation(p_175355_1_.getDifficultyResourceKey(), new Object[0]));
    return ichatcomponent.getFormattedText();
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:9,代码来源:GuiOptions.java

示例14: processCommand

import net.minecraft.util.ChatComponentText; //导入依赖的package包/类
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    int i = MinecraftServer.getServer().getCurrentPlayerCount();
    sender.addChatMessage(new ChatComponentTranslation("commands.players.list", new Object[] {Integer.valueOf(i), Integer.valueOf(MinecraftServer.getServer().getMaxPlayers())}));
    sender.addChatMessage(new ChatComponentText(MinecraftServer.getServer().getConfigurationManager().func_181058_b(args.length > 0 && "uuids".equalsIgnoreCase(args[0]))));
    sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, i);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:11,代码来源:CommandListPlayers.java

示例15: getChatComponentFromNthArg

import net.minecraft.util.ChatComponentText; //导入依赖的package包/类
public static IChatComponent getChatComponentFromNthArg(ICommandSender sender, String[] args, int index, boolean p_147176_3_) throws PlayerNotFoundException
{
    IChatComponent ichatcomponent = new ChatComponentText("");

    for (int i = index; i < args.length; ++i)
    {
        if (i > index)
        {
            ichatcomponent.appendText(" ");
        }

        IChatComponent ichatcomponent1 = new ChatComponentText(args[i]);

        if (p_147176_3_)
        {
            IChatComponent ichatcomponent2 = PlayerSelector.matchEntitiesToChatComponent(sender, args[i]);

            if (ichatcomponent2 == null)
            {
                if (PlayerSelector.hasArguments(args[i]))
                {
                    throw new PlayerNotFoundException();
                }
            }
            else
            {
                ichatcomponent1 = ichatcomponent2;
            }
        }

        ichatcomponent.appendSibling(ichatcomponent1);
    }

    return ichatcomponent;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:36,代码来源:CommandBase.java


注:本文中的net.minecraft.util.ChatComponentText类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。