Java 类net.minecraft.util.text.TextComponentBase 实例源码

项目:DiscordCE    文件:DiscordEventHandler.java   
@Override
public void onPrivateMessageReceived(PrivateMessageReceivedEvent e)
{
    if (Minecraft.getMinecraft().thePlayer == null
            || VolatileSettings.isBlocked(e.getAuthor().getId()))
        return;

    String message;
    EntityPlayer player = Minecraft.getMinecraft().thePlayer;

    // Highlighting mentions
    message = MCHelper.buildInteractiveMessage(
            e.getAuthor().getUsername()
            , null
            , e.getAuthor().getId()
            , null
            , null
            , DiscordUtil.resolveMentions(e.getMessage().getRawContent())
            , Config.directLayout
            , e.getMessage());

    Minecraft
            .getMinecraft()
            .thePlayer
            .addChatComponentMessage(TextComponentBase.Serializer.jsonToComponent(message));
}
项目:DiscordCE    文件:MinecraftEventHandler.java   
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onPlayerDeathImage(GuiOpenEvent e)
{
    EntityPlayer player = Minecraft.getMinecraft().thePlayer;

    if (!(e.getGui() instanceof GuiGameOver)
            || !Config.demiseImage
            || player == null
            || player.getHealth() <= 0F)
        return;

    // Getting discord and minecraft user
    try
    {
        User me = DiscordCE.client.getUserById(DiscordCE.client.getSelfInfo().getId());
        Minecraft mc = Minecraft.getMinecraft();
        ITextComponent t = ScreenShotHelper.saveScreenshot(mc.mcDataDir,
                mc.displayWidth,
                mc.displayHeight,
                mc.getFramebuffer());
        String fileName = new JSONObject(TextComponentBase.Serializer.componentToJson(t)).getJSONArray("with")
                .getJSONObject(0).getJSONObject("clickEvent").getString("value");
        File file = new File(fileName);
        TextChannel c = DiscordCE.client.getTextChannelById(Preferences.i.usingChannel);

        // Doing checks
        if (c == null || !c.checkPermission(me, Permission.MESSAGE_ATTACH_FILES))
            return;

        //Sending file
        c.sendFileAsync(file, null, m -> file.delete());
    }

    catch (Exception e1)
    {
        e1.printStackTrace();
    }
}
项目:DiscordCE    文件:DiscordEventHandler.java   
@Override
public void onGuildMessageReceived(GuildMessageReceivedEvent e)
{
    if (Minecraft.getMinecraft().thePlayer == null
            || VolatileSettings.isBlocked(e.getAuthor().getId())
            || Preferences.i.mutedChannels.contains(e.getChannel().getId())
            || Preferences.i.mutedGuilds.contains(e.getGuild().getId())
            || (Preferences.i.focus
                && !Preferences.i.usingChannel.equals(e.getChannel().getId())))
        return;

    String message;
    EntityPlayer player = Minecraft.getMinecraft().thePlayer;

    // Formatting message
    message = MCHelper.buildInteractiveMessage(
            e.getAuthor().getUsername()
            , e.getAuthorNick()
            , e.getAuthor().getId()
            , e.getGuild()
            , e.getChannel()
            , DiscordUtil.resolveMentions(e.getMessage().getRawContent())
            , Config.serverLayout
            , e.getMessage());

    Minecraft
            .getMinecraft()
            .thePlayer
            .addChatComponentMessage(TextComponentBase.Serializer.jsonToComponent(message));
}
项目:DiscordCE    文件:MCHelper.java   
/**
 * Sends an interactive message to the user
 *
 * @param message The message to set the user
 */
public static void sendRawMessage(JSONArray message)
{
    if (Minecraft.getMinecraft() == null
            || Minecraft.getMinecraft().thePlayer == null)
        return;

    ITextComponent component = TextComponentBase.Serializer.jsonToComponent(message.toString());
    Minecraft.getMinecraft().thePlayer.addChatMessage(component);
}
项目:FastAsyncWorldedit    文件:ForgePlayer.java   
@Override
public void sendMessage(String msg) {
    for (String part : msg.split("\n")) {
        part = BBC.color(part);
        TextComponentBase text = new TextComponentString(part);
        this.parent.addChatMessage(text);
    }
}
项目:PowerAdvantageAPI    文件:TileEntityConveyor.java   
@Override
public TextComponentBase getDisplayName() {
    if (this.hasCustomName()) {
        return new TextComponentString(this.getName());
    }
    return new TextComponentTranslation(this.getName(), new Object[0]);
}
项目:ClockworkPhase2    文件:InventoryUpdated.java   
@Override
public TextComponentBase getDisplayName() {
    return null;
}
项目:ClockworkPhase2    文件:InventorySimple.java   
@Override
public TextComponentBase getDisplayName() {
    return null;
}