本文整理汇总了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());
}
}
}
}
}
示例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());
}
}
}
}
}