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


Java SPacketPlayerListItem.getAction方法代码示例

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


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

示例1: handlePlayerListItem

import net.minecraft.network.play.server.SPacketPlayerListItem; //导入方法依赖的package包/类
@SuppressWarnings("incomplete-switch")
public void handlePlayerListItem(SPacketPlayerListItem packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    for (SPacketPlayerListItem.AddPlayerData spacketplayerlistitem$addplayerdata : packetIn.getEntries())
    {
        if (packetIn.getAction() == SPacketPlayerListItem.Action.REMOVE_PLAYER)
        {
            this.playerInfoMap.remove(spacketplayerlistitem$addplayerdata.getProfile().getId());
        }
        else
        {
            NetworkPlayerInfo networkplayerinfo = (NetworkPlayerInfo)this.playerInfoMap.get(spacketplayerlistitem$addplayerdata.getProfile().getId());

            if (packetIn.getAction() == SPacketPlayerListItem.Action.ADD_PLAYER)
            {
                networkplayerinfo = new NetworkPlayerInfo(spacketplayerlistitem$addplayerdata);
                this.playerInfoMap.put(networkplayerinfo.getGameProfile().getId(), networkplayerinfo);
            }

            if (networkplayerinfo != null)
            {
                switch (packetIn.getAction())
                {
                    case ADD_PLAYER:
                        networkplayerinfo.setGameType(spacketplayerlistitem$addplayerdata.getGameMode());
                        networkplayerinfo.setResponseTime(spacketplayerlistitem$addplayerdata.getPing());
                        break;

                    case UPDATE_GAME_MODE:
                        networkplayerinfo.setGameType(spacketplayerlistitem$addplayerdata.getGameMode());
                        break;

                    case UPDATE_LATENCY:
                        networkplayerinfo.setResponseTime(spacketplayerlistitem$addplayerdata.getPing());
                        break;

                    case UPDATE_DISPLAY_NAME:
                        networkplayerinfo.setDisplayName(spacketplayerlistitem$addplayerdata.getDisplayName());
                }
            }
        }
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:46,代码来源:NetHandlerPlayClient.java

示例2: handlePlayerListItem

import net.minecraft.network.play.server.SPacketPlayerListItem; //导入方法依赖的package包/类
@SuppressWarnings("incomplete-switch")
public void handlePlayerListItem(SPacketPlayerListItem packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    for (SPacketPlayerListItem.AddPlayerData spacketplayerlistitem$addplayerdata : packetIn.getEntries())
    {
        if (packetIn.getAction() == SPacketPlayerListItem.Action.REMOVE_PLAYER)
        {
            this.playerInfoMap.remove(spacketplayerlistitem$addplayerdata.getProfile().getId());
        }
        else
        {
            NetworkPlayerInfo networkplayerinfo = (NetworkPlayerInfo)this.playerInfoMap.get(spacketplayerlistitem$addplayerdata.getProfile().getId());

            if (packetIn.getAction() == SPacketPlayerListItem.Action.ADD_PLAYER)
            {
                networkplayerinfo = new NetworkPlayerInfo(spacketplayerlistitem$addplayerdata);
                this.playerInfoMap.put(networkplayerinfo.getGameProfile().getId(), networkplayerinfo);
            }

            if (networkplayerinfo != null)
            {
                switch (packetIn.getAction())
                {
                    case ADD_PLAYER:
                        networkplayerinfo.setGameType(spacketplayerlistitem$addplayerdata.getGameMode());
                        networkplayerinfo.setResponseTime(spacketplayerlistitem$addplayerdata.getPing());
                        break;
                    case UPDATE_GAME_MODE:
                        networkplayerinfo.setGameType(spacketplayerlistitem$addplayerdata.getGameMode());
                        break;
                    case UPDATE_LATENCY:
                        networkplayerinfo.setResponseTime(spacketplayerlistitem$addplayerdata.getPing());
                        break;
                    case UPDATE_DISPLAY_NAME:
                        networkplayerinfo.setDisplayName(spacketplayerlistitem$addplayerdata.getDisplayName());
                }
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:43,代码来源:NetHandlerPlayClient.java


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