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


Java IChatComponent类代码示例

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


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

示例1: getDisplayName

import net.minecraft.util.IChatComponent; //导入依赖的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:SkidJava,项目名称:BaseClient,代码行数:21,代码来源:EntityMinecart.java

示例2: readEntityFromNBT

import net.minecraft.util.IChatComponent; //导入依赖的package包/类
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
protected void readEntityFromNBT(NBTTagCompound tagCompund)
{
    super.readEntityFromNBT(tagCompund);
    this.commandBlockLogic.readDataFromNBT(tagCompund);
    this.getDataWatcher().updateObject(23, this.getCommandBlockLogic().getCommand());
    this.getDataWatcher().updateObject(24, IChatComponent.Serializer.componentToJson(this.getCommandBlockLogic().getLastOutput()));
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:11,代码来源:EntityMinecartCommandBlock.java

示例3: writePacketData

import net.minecraft.util.IChatComponent; //导入依赖的package包/类
/**
 * Writes the raw packet data to the data stream.
 */
public void writePacketData(PacketBuffer buf) throws IOException
{
    buf.writeBlockPos(this.pos);

    for (int i = 0; i < 4; ++i)
    {
        IChatComponent ichatcomponent = this.lines[i];
        String s = IChatComponent.Serializer.componentToJson(ichatcomponent);
        buf.writeString(s);
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:15,代码来源:C12PacketUpdateSign.java

示例4: setChatLine

import net.minecraft.util.IChatComponent; //导入依赖的package包/类
private void setChatLine(IChatComponent p_146237_1_, int p_146237_2_, int p_146237_3_, boolean p_146237_4_)
{
    if (p_146237_2_ != 0)
    {
        this.deleteChatLine(p_146237_2_);
    }

    int i = MathHelper.floor_float((float)this.getChatWidth() / this.getChatScale());
    List<IChatComponent> list = GuiUtilRenderComponents.func_178908_a(p_146237_1_, i, this.mc.fontRendererObj, false, false);
    boolean flag = this.getChatOpen();

    for (IChatComponent ichatcomponent : list)
    {
        if (flag && this.scrollPos > 0)
        {
            this.isScrolled = true;
            this.scroll(1);
        }

        this.field_146253_i.add(0, new ChatLine(p_146237_3_, ichatcomponent, p_146237_2_));
    }

    while (this.field_146253_i.size() > 100)
    {
        this.field_146253_i.remove(this.field_146253_i.size() - 1);
    }

    if (!p_146237_4_)
    {
        this.chatLines.add(0, new ChatLine(p_146237_3_, p_146237_1_, p_146237_2_));

        while (this.chatLines.size() > 100)
        {
            this.chatLines.remove(this.chatLines.size() - 1);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:38,代码来源:GuiNewChat.java

示例5: sendMessageToAllTeamMembers

import net.minecraft.util.IChatComponent; //导入依赖的package包/类
public void sendMessageToAllTeamMembers(EntityPlayer player, IChatComponent message)
{
    Team team = player.getTeam();

    if (team != null)
    {
        for (String s : team.getMembershipCollection())
        {
            EntityPlayerMP entityplayermp = this.getPlayerByUsername(s);

            if (entityplayermp != null && entityplayermp != player)
            {
                entityplayermp.addChatMessage(message);
            }
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:18,代码来源:ServerConfigurationManager.java

示例6: getChatComponent

import net.minecraft.util.IChatComponent; //导入依赖的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:SkidJava,项目名称:BaseClient,代码行数:25,代码来源:ItemStack.java

示例7: AddPlayerData

import net.minecraft.util.IChatComponent; //导入依赖的package包/类
public AddPlayerData(GameProfile profile, int pingIn, WorldSettings.GameType gamemodeIn, IChatComponent displayNameIn)
{
    this.profile = profile;
    this.ping = pingIn;
    this.gamemode = gamemodeIn;
    this.displayName = displayNameIn;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:8,代码来源:S38PacketPlayerListItem.java

示例8: StatBase

import net.minecraft.util.IChatComponent; //导入依赖的package包/类
public StatBase(String statIdIn, IChatComponent statNameIn, IStatType typeIn)
{
    this.statId = statIdIn;
    this.statName = statNameIn;
    this.type = typeIn;
    this.field_150957_c = new ObjectiveStat(this);
    IScoreObjectiveCriteria.INSTANCES.put(this.field_150957_c.getName(), this.field_150957_c);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:9,代码来源:StatBase.java

示例9: processCommand

import net.minecraft.util.IChatComponent; //导入依赖的package包/类
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length <= 0)
    {
        throw new WrongUsageException("commands.gamemode.usage", new Object[0]);
    }
    else
    {
        WorldSettings.GameType worldsettings$gametype = this.getGameModeFromCommand(sender, args[0]);
        EntityPlayer entityplayer = args.length >= 2 ? getPlayer(sender, args[1]) : getCommandSenderAsPlayer(sender);
        entityplayer.setGameType(worldsettings$gametype);
        entityplayer.fallDistance = 0.0F;

        if (sender.getEntityWorld().getGameRules().getBoolean("sendCommandFeedback"))
        {
            entityplayer.addChatMessage(new ChatComponentTranslation("gameMode.changed", new Object[0]));
        }

        IChatComponent ichatcomponent = new ChatComponentTranslation("gameMode." + worldsettings$gametype.getName(), new Object[0]);

        if (entityplayer != sender)
        {
            notifyOperators(sender, this, 1, "commands.gamemode.success.other", new Object[] {entityplayer.getName(), ichatcomponent});
        }
        else
        {
            notifyOperators(sender, this, 1, "commands.gamemode.success.self", new Object[] {ichatcomponent});
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:34,代码来源:CommandGameMode.java

示例10: processCommand

import net.minecraft.util.IChatComponent; //导入依赖的package包/类
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length > 0 && args[0].length() > 0)
    {
        IChatComponent ichatcomponent = getChatComponentFromNthArg(sender, args, 0, true);
        MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentTranslation("chat.type.announcement", new Object[] {sender.getDisplayName(), ichatcomponent}));
    }
    else
    {
        throw new WrongUsageException("commands.say.usage", new Object[0]);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:16,代码来源:CommandBroadcast.java

示例11: addChatMessage

import net.minecraft.util.IChatComponent; //导入依赖的package包/类
/**
 * Send a chat message to the CommandSender
 */
public void addChatMessage(IChatComponent component)
{
    if (this.trackOutput && this.getEntityWorld() != null && !this.getEntityWorld().isRemote)
    {
        this.lastOutput = (new ChatComponentText("[" + timestampFormat.format(new Date()) + "] ")).appendSibling(component);
        this.updateCommand();
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:12,代码来源:CommandBlockLogic.java

示例12: chatClient

import net.minecraft.util.IChatComponent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public static void chatClient(final @Nonnull ChatBuilder chat) {
	final Minecraft mc = FMLClientHandler.instance().getClient();
	if (mc.thePlayer!=null) {
		final IChatComponent msg = chat.build();
		if (chat.useId)
			mc.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(msg, chat.id);
		else
			mc.thePlayer.addChatComponentMessage(msg);
	}
}
 
开发者ID:Team-Fruit,项目名称:McHeliPrivacyShield,代码行数:12,代码来源:ChatBuilder.java

示例13: drawScreen

import net.minecraft.util.IChatComponent; //导入依赖的package包/类
/**
 * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
 */
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
    this.drawDefaultBackground();
    this.drawCenteredString(this.fontRendererObj, this.field_152338_i.getUnformattedText(), this.width / 2, 70, 16777215);
    int i = 80;

    for (IChatComponent ichatcomponent : this.field_152332_r)
    {
        this.drawString(this.fontRendererObj, ichatcomponent.getFormattedText(), this.field_152334_t, i, 16777215);
        i += this.fontRendererObj.FONT_HEIGHT;
    }

    super.drawScreen(mouseX, mouseY, partialTicks);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:18,代码来源:GuiTwitchUserMode.java

示例14: S45PacketTitle

import net.minecraft.util.IChatComponent; //导入依赖的package包/类
public S45PacketTitle(S45PacketTitle.Type type, IChatComponent message, int fadeInTime, int displayTime, int fadeOutTime)
{
    this.type = type;
    this.message = message;
    this.fadeInTime = fadeInTime;
    this.displayTime = displayTime;
    this.fadeOutTime = fadeOutTime;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:9,代码来源:S45PacketTitle.java

示例15: processUpdateSign

import net.minecraft.util.IChatComponent; //导入依赖的package包/类
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);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:36,代码来源:NetHandlerPlayServer.java


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