本文整理汇总了Java中net.minecraft.entity.player.EntityPlayerMP.getServerForPlayer方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayerMP.getServerForPlayer方法的具体用法?Java EntityPlayerMP.getServerForPlayer怎么用?Java EntityPlayerMP.getServerForPlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.player.EntityPlayerMP
的用法示例。
在下文中一共展示了EntityPlayerMP.getServerForPlayer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: preparePlayer
import net.minecraft.entity.player.EntityPlayerMP; //导入方法依赖的package包/类
public void preparePlayer(EntityPlayerMP playerIn, WorldServer worldIn)
{
WorldServer worldserver = playerIn.getServerForPlayer();
if (worldIn != null)
{
worldIn.getPlayerManager().removePlayer(playerIn);
}
worldserver.getPlayerManager().addPlayer(playerIn);
worldserver.theChunkProviderServer.loadChunk((int)playerIn.posX >> 4, (int)playerIn.posZ >> 4);
}
示例2: playerLoggedOut
import net.minecraft.entity.player.EntityPlayerMP; //导入方法依赖的package包/类
/**
* Called when a player disconnects from the game. Writes player data to disk and removes them from the world.
*/
public void playerLoggedOut(EntityPlayerMP playerIn)
{
playerIn.triggerAchievement(StatList.leaveGameStat);
this.writePlayerData(playerIn);
WorldServer worldserver = playerIn.getServerForPlayer();
if (playerIn.ridingEntity != null)
{
worldserver.removePlayerEntityDangerously(playerIn.ridingEntity);
logger.debug("removing player mount");
}
worldserver.removeEntity(playerIn);
worldserver.getPlayerManager().removePlayer(playerIn);
this.playerEntityList.remove(playerIn);
UUID uuid = playerIn.getUniqueID();
EntityPlayerMP entityplayermp = (EntityPlayerMP)this.uuidToPlayerMap.get(uuid);
if (entityplayermp == playerIn)
{
this.uuidToPlayerMap.remove(uuid);
this.playerStatFiles.remove(uuid);
}
this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {playerIn}));
}