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


Java WorldServer.removePlayerEntityDangerously方法代码示例

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


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

示例1: transferPlayerToDimension

import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
/**
 * moves provided player from overworld to nether or vice versa
 */
public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension)
{
    int i = playerIn.dimension;
    WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension);
    playerIn.dimension = dimension;
    WorldServer worldserver1 = this.mcServer.worldServerForDimension(playerIn.dimension);
    playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, playerIn.worldObj.getDifficulty(), playerIn.worldObj.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType()));
    worldserver.removePlayerEntityDangerously(playerIn);
    playerIn.isDead = false;
    this.transferEntityToWorld(playerIn, i, worldserver, worldserver1);
    this.preparePlayer(playerIn, worldserver);
    playerIn.playerNetServerHandler.setPlayerLocation(playerIn.posX, playerIn.posY, playerIn.posZ, playerIn.rotationYaw, playerIn.rotationPitch);
    playerIn.theItemInWorldManager.setWorld(worldserver1);
    this.updateTimeAndWeatherForPlayer(playerIn, worldserver1);
    this.syncPlayerInventory(playerIn);

    for (PotionEffect potioneffect : playerIn.getActivePotionEffects())
    {
        playerIn.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(playerIn.getEntityId(), potioneffect));
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:25,代码来源:ServerConfigurationManager.java

示例2: playerLoggedOut

import net.minecraft.world.WorldServer; //导入方法依赖的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}));
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:30,代码来源:ServerConfigurationManager.java

示例3: handleSpectate

import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
public void handleSpectate(C18PacketSpectate packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer());

    if (this.playerEntity.isSpectator())
    {
        Entity entity = null;

        for (WorldServer worldserver : this.serverController.worldServers)
        {
            if (worldserver != null)
            {
                entity = packetIn.getEntity(worldserver);

                if (entity != null)
                {
                    break;
                }
            }
        }

        if (entity != null)
        {
            this.playerEntity.setSpectatingEntity(this.playerEntity);
            this.playerEntity.mountEntity((Entity)null);

            if (entity.worldObj != this.playerEntity.worldObj)
            {
                WorldServer worldserver1 = this.playerEntity.getServerForPlayer();
                WorldServer worldserver2 = (WorldServer)entity.worldObj;
                this.playerEntity.dimension = entity.dimension;
                this.sendPacket(new S07PacketRespawn(this.playerEntity.dimension, worldserver1.getDifficulty(), worldserver1.getWorldInfo().getTerrainType(), this.playerEntity.theItemInWorldManager.getGameType()));
                worldserver1.removePlayerEntityDangerously(this.playerEntity);
                this.playerEntity.isDead = false;
                this.playerEntity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);

                if (this.playerEntity.isEntityAlive())
                {
                    worldserver1.updateEntityWithOptionalForce(this.playerEntity, false);
                    worldserver2.spawnEntityInWorld(this.playerEntity);
                    worldserver2.updateEntityWithOptionalForce(this.playerEntity, false);
                }

                this.playerEntity.setWorld(worldserver2);
                this.serverController.getConfigurationManager().preparePlayer(this.playerEntity, worldserver1);
                this.playerEntity.setPositionAndUpdate(entity.posX, entity.posY, entity.posZ);
                this.playerEntity.theItemInWorldManager.setWorld(worldserver2);
                this.serverController.getConfigurationManager().updateTimeAndWeatherForPlayer(this.playerEntity, worldserver2);
                this.serverController.getConfigurationManager().syncPlayerInventory(this.playerEntity);
            }
            else
            {
                this.playerEntity.setPositionAndUpdate(entity.posX, entity.posY, entity.posZ);
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:58,代码来源:NetHandlerPlayServer.java


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