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


Java SPacketTitle.Type方法代码示例

本文整理汇总了Java中net.minecraft.network.play.server.SPacketTitle.Type方法的典型用法代码示例。如果您正苦于以下问题:Java SPacketTitle.Type方法的具体用法?Java SPacketTitle.Type怎么用?Java SPacketTitle.Type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.network.play.server.SPacketTitle的用法示例。


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

示例1: handleTitle

import net.minecraft.network.play.server.SPacketTitle; //导入方法依赖的package包/类
@SuppressWarnings("incomplete-switch")
public void handleTitle(SPacketTitle packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    SPacketTitle.Type spackettitle$type = packetIn.getType();
    String s = null;
    String s1 = null;
    String s2 = packetIn.getMessage() != null ? packetIn.getMessage().getFormattedText() : "";

    switch (spackettitle$type)
    {
        case TITLE:
            s = s2;
            break;
        case SUBTITLE:
            s1 = s2;
            break;
        case RESET:
            this.gameController.ingameGUI.displayTitle("", "", -1, -1, -1);
            this.gameController.ingameGUI.setDefaultTitlesTimes();
            return;
    }

    this.gameController.ingameGUI.displayTitle(s, s1, packetIn.getFadeInTime(), packetIn.getDisplayTime(), packetIn.getFadeOutTime());
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:26,代码来源:NetHandlerPlayClient.java

示例2: handleTitle

import net.minecraft.network.play.server.SPacketTitle; //导入方法依赖的package包/类
@SuppressWarnings("incomplete-switch")
public void handleTitle(SPacketTitle packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    SPacketTitle.Type spackettitle$type = packetIn.getType();
    String s = null;
    String s1 = null;
    String s2 = packetIn.getMessage() != null ? packetIn.getMessage().getFormattedText() : "";

    switch (spackettitle$type)
    {
        case TITLE:
            s = s2;
            break;

        case SUBTITLE:
            s1 = s2;
            break;

        case ACTIONBAR:
            this.gameController.ingameGUI.setRecordPlaying(s2, false);
            return;

        case RESET:
            this.gameController.ingameGUI.displayTitle("", "", -1, -1, -1);
            this.gameController.ingameGUI.setDefaultTitlesTimes();
            return;
    }

    this.gameController.ingameGUI.displayTitle(s, s1, packetIn.getFadeInTime(), packetIn.getDisplayTime(), packetIn.getFadeOutTime());
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:32,代码来源:NetHandlerPlayClient.java

示例3: execute

import net.minecraft.network.play.server.SPacketTitle; //导入方法依赖的package包/类
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 2)
    {
        throw new WrongUsageException("commands.title.usage", new Object[0]);
    }
    else
    {
        if (args.length < 3)
        {
            if ("title".equals(args[1]) || "subtitle".equals(args[1]) || "actionbar".equals(args[1]))
            {
                throw new WrongUsageException("commands.title.usage.title", new Object[0]);
            }

            if ("times".equals(args[1]))
            {
                throw new WrongUsageException("commands.title.usage.times", new Object[0]);
            }
        }

        EntityPlayerMP entityplayermp = getPlayer(server, sender, args[0]);
        SPacketTitle.Type spackettitle$type = SPacketTitle.Type.byName(args[1]);

        if (spackettitle$type != SPacketTitle.Type.CLEAR && spackettitle$type != SPacketTitle.Type.RESET)
        {
            if (spackettitle$type == SPacketTitle.Type.TIMES)
            {
                if (args.length != 5)
                {
                    throw new WrongUsageException("commands.title.usage", new Object[0]);
                }
                else
                {
                    int i = parseInt(args[2]);
                    int j = parseInt(args[3]);
                    int k = parseInt(args[4]);
                    SPacketTitle spackettitle2 = new SPacketTitle(i, j, k);
                    entityplayermp.connection.sendPacket(spackettitle2);
                    notifyCommandListener(sender, this, "commands.title.success", new Object[0]);
                }
            }
            else if (args.length < 3)
            {
                throw new WrongUsageException("commands.title.usage", new Object[0]);
            }
            else
            {
                String s = buildString(args, 2);
                ITextComponent itextcomponent;

                try
                {
                    itextcomponent = ITextComponent.Serializer.jsonToComponent(s);
                }
                catch (JsonParseException jsonparseexception)
                {
                    throw toSyntaxException(jsonparseexception);
                }

                SPacketTitle spackettitle1 = new SPacketTitle(spackettitle$type, TextComponentUtils.processComponent(sender, itextcomponent, entityplayermp));
                entityplayermp.connection.sendPacket(spackettitle1);
                notifyCommandListener(sender, this, "commands.title.success", new Object[0]);
            }
        }
        else if (args.length != 2)
        {
            throw new WrongUsageException("commands.title.usage", new Object[0]);
        }
        else
        {
            SPacketTitle spackettitle = new SPacketTitle(spackettitle$type, (ITextComponent)null);
            entityplayermp.connection.sendPacket(spackettitle);
            notifyCommandListener(sender, this, "commands.title.success", new Object[0]);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:81,代码来源:CommandTitle.java


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