Java 类net.minecraft.network.play.server.S07PacketRespawn 实例源码

项目:DecompiledMinecraft    文件:ServerConfigurationManager.java   
/**
 * 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));
    }
}
项目:DecompiledMinecraft    文件:NetHandlerPlayClient.java   
public void handleRespawn(S07PacketRespawn packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (packetIn.getDimensionID() != this.gameController.thePlayer.dimension)
    {
        this.doneLoadingTerrain = false;
        Scoreboard scoreboard = this.clientWorldController.getScoreboard();
        this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, this.gameController.theWorld.getWorldInfo().isHardcoreModeEnabled(), packetIn.getWorldType()), packetIn.getDimensionID(), packetIn.getDifficulty(), this.gameController.mcProfiler);
        this.clientWorldController.setWorldScoreboard(scoreboard);
        this.gameController.loadWorld(this.clientWorldController);
        this.gameController.thePlayer.dimension = packetIn.getDimensionID();
        this.gameController.displayGuiScreen(new GuiDownloadTerrain(this));
    }

    this.gameController.setDimensionAndSpawnPlayer(packetIn.getDimensionID());
    this.gameController.playerController.setGameType(packetIn.getGameType());
}
项目:DecompiledMinecraft    文件:ServerConfigurationManager.java   
/**
 * 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));
    }
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
public void handleRespawn(S07PacketRespawn packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (packetIn.getDimensionID() != this.gameController.thePlayer.dimension)
    {
        this.doneLoadingTerrain = false;
        Scoreboard scoreboard = this.clientWorldController.getScoreboard();
        this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, this.gameController.theWorld.getWorldInfo().isHardcoreModeEnabled(), packetIn.getWorldType()), packetIn.getDimensionID(), packetIn.getDifficulty(), this.gameController.mcProfiler);
        this.clientWorldController.setWorldScoreboard(scoreboard);
        this.gameController.loadWorld(this.clientWorldController);
        this.gameController.thePlayer.dimension = packetIn.getDimensionID();
        this.gameController.displayGuiScreen(new GuiDownloadTerrain(this));
    }

    this.gameController.setDimensionAndSpawnPlayer(packetIn.getDimensionID());
    this.gameController.playerController.setGameType(packetIn.getGameType());
}
项目:BaseClient    文件:ServerConfigurationManager.java   
/**
 * 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));
    }
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
public void handleRespawn(S07PacketRespawn packetIn) {
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (packetIn.getDimensionID() != this.gameController.thePlayer.dimension) {
        this.doneLoadingTerrain = false;
        Scoreboard scoreboard = this.clientWorldController.getScoreboard();
        this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false,
                this.gameController.theWorld.getWorldInfo().isHardcoreModeEnabled(), packetIn.getWorldType()),
                packetIn.getDimensionID(), packetIn.getDifficulty(), this.gameController.mcProfiler);
        this.clientWorldController.setWorldScoreboard(scoreboard);
        this.gameController.loadWorld(this.clientWorldController);
        this.gameController.thePlayer.dimension = packetIn.getDimensionID();
        this.gameController.displayGuiScreen(new GuiDownloadTerrain(this));
    }

    this.gameController.setDimensionAndSpawnPlayer(packetIn.getDimensionID());
    this.gameController.playerController.setGameType(packetIn.getGameType());
}
项目:BaseClient    文件:ServerConfigurationManager.java   
/**
 * 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));
    }
}
项目:Resilience-Client-Source    文件:NetHandlerPlayClient.java   
public void handleRespawn(S07PacketRespawn p_147280_1_)
{
    if (p_147280_1_.func_149082_c() != this.gameController.thePlayer.dimension)
    {
        this.doneLoadingTerrain = false;
        Scoreboard var2 = this.clientWorldController.getScoreboard();
        this.clientWorldController = new WorldClient(this, new WorldSettings(0L, p_147280_1_.func_149083_e(), false, this.gameController.theWorld.getWorldInfo().isHardcoreModeEnabled(), p_147280_1_.func_149080_f()), p_147280_1_.func_149082_c(), p_147280_1_.func_149081_d(), this.gameController.mcProfiler);
        this.clientWorldController.setWorldScoreboard(var2);
        this.clientWorldController.isClient = true;
        this.gameController.loadWorld(this.clientWorldController);
        this.gameController.thePlayer.dimension = p_147280_1_.func_149082_c();
        this.gameController.displayGuiScreen(new GuiDownloadTerrain(this));
    }

    this.gameController.setDimensionAndSpawnPlayer(p_147280_1_.func_149082_c());
    this.gameController.playerController.setGameType(p_147280_1_.func_149083_e());
}
项目:Resilience-Client-Source    文件:ServerConfigurationManager.java   
public void transferPlayerToDimension(EntityPlayerMP par1EntityPlayerMP, int par2)
{
    int var3 = par1EntityPlayerMP.dimension;
    WorldServer var4 = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension);
    par1EntityPlayerMP.dimension = par2;
    WorldServer var5 = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension);
    par1EntityPlayerMP.playerNetServerHandler.sendPacket(new S07PacketRespawn(par1EntityPlayerMP.dimension, par1EntityPlayerMP.worldObj.difficultySetting, par1EntityPlayerMP.worldObj.getWorldInfo().getTerrainType(), par1EntityPlayerMP.theItemInWorldManager.getGameType()));
    var4.removePlayerEntityDangerously(par1EntityPlayerMP);
    par1EntityPlayerMP.isDead = false;
    this.transferEntityToWorld(par1EntityPlayerMP, var3, var4, var5);
    this.func_72375_a(par1EntityPlayerMP, var4);
    par1EntityPlayerMP.playerNetServerHandler.setPlayerLocation(par1EntityPlayerMP.posX, par1EntityPlayerMP.posY, par1EntityPlayerMP.posZ, par1EntityPlayerMP.rotationYaw, par1EntityPlayerMP.rotationPitch);
    par1EntityPlayerMP.theItemInWorldManager.setWorld(var5);
    this.updateTimeAndWeatherForPlayer(par1EntityPlayerMP, var5);
    this.syncPlayerInventory(par1EntityPlayerMP);
    Iterator var6 = par1EntityPlayerMP.getActivePotionEffects().iterator();

    while (var6.hasNext())
    {
        PotionEffect var7 = (PotionEffect)var6.next();
        par1EntityPlayerMP.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(par1EntityPlayerMP.getEntityId(), var7));
    }
}
项目:E-Mobile    文件:TeleportUtils.java   
public static void teleportPlayerToDimension(EntityPlayerMP player, int dimension, ServerConfigurationManager manager) {
    int oldDim = player.dimension;
    WorldServer worldserver = manager.getServerInstance().worldServerForDimension(player.dimension);
    player.dimension = dimension;
    WorldServer worldserver1 = manager.getServerInstance().worldServerForDimension(player.dimension);
    player.playerNetServerHandler.sendPacket(new S07PacketRespawn(player.dimension, player.worldObj.difficultySetting, player.worldObj.getWorldInfo().getTerrainType(), player.theItemInWorldManager.getGameType()));
    worldserver.removePlayerEntityDangerously(player);
    player.isDead = false;
    teleportEntityToWorld(player, worldserver, worldserver1);
    manager.func_72375_a(player, worldserver);
    player.playerNetServerHandler.setPlayerLocation(player.posX, player.posY, player.posZ, player.rotationYaw, player.rotationPitch);
    player.theItemInWorldManager.setWorld(worldserver1);
    manager.updateTimeAndWeatherForPlayer(player, worldserver1);
    manager.syncPlayerInventory(player);
    Iterator<PotionEffect> iterator = player.getActivePotionEffects().iterator();

    while (iterator.hasNext()) {
        PotionEffect potioneffect = iterator.next();
        player.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(player.getEntityId(), potioneffect));
    }
    FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, oldDim, dimension);
}
项目:TheCorruptedSector    文件:TeleportUtils.java   
public static void teleportPlayerToDimension(EntityPlayerMP player, int dimension, ServerConfigurationManager manager) {
    int oldDim = player.dimension;
    WorldServer worldserver = manager.getServerInstance().worldServerForDimension(player.dimension);
    player.dimension = dimension;
    WorldServer worldserver1 = manager.getServerInstance().worldServerForDimension(player.dimension);
    player.playerNetServerHandler.sendPacket(new S07PacketRespawn(player.dimension, player.worldObj.difficultySetting, player.worldObj.getWorldInfo().getTerrainType(), player.theItemInWorldManager.getGameType()));
    worldserver.removePlayerEntityDangerously(player);
    player.isDead = false;
    teleportEntityToWorld(player, worldserver, worldserver1);
    manager.func_72375_a(player, worldserver);
    player.playerNetServerHandler.setPlayerLocation(player.posX, player.posY, player.posZ, player.rotationYaw, player.rotationPitch);
    player.theItemInWorldManager.setWorld(worldserver1);
    manager.updateTimeAndWeatherForPlayer(player, worldserver1);
    manager.syncPlayerInventory(player);
    Iterator<PotionEffect> iterator = player.getActivePotionEffects().iterator();

    while (iterator.hasNext()) {
        PotionEffect potioneffect = iterator.next();
        player.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(player.getEntityId(), potioneffect));
    }
    FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, oldDim, dimension);
}
项目:Cauldron    文件:NetHandlerPlayClient.java   
public void handleRespawn(S07PacketRespawn p_147280_1_)
{
    if (p_147280_1_.func_149082_c() != this.gameController.thePlayer.dimension)
    {
        this.doneLoadingTerrain = false;
        Scoreboard scoreboard = this.clientWorldController.getScoreboard();
        this.clientWorldController = new WorldClient(this, new WorldSettings(0L, p_147280_1_.func_149083_e(), false, this.gameController.theWorld.getWorldInfo().isHardcoreModeEnabled(), p_147280_1_.func_149080_f()), p_147280_1_.func_149082_c(), p_147280_1_.func_149081_d(), this.gameController.mcProfiler);
        this.clientWorldController.setWorldScoreboard(scoreboard);
        this.clientWorldController.isRemote = true;
        this.gameController.loadWorld(this.clientWorldController);
        this.gameController.thePlayer.dimension = p_147280_1_.func_149082_c();
        this.gameController.displayGuiScreen(new GuiDownloadTerrain(this));
    }

    this.gameController.setDimensionAndSpawnPlayer(p_147280_1_.func_149082_c());
    this.gameController.playerController.setGameType(p_147280_1_.func_149083_e());
}
项目:Cauldron    文件:NetHandlerPlayClient.java   
public void handleRespawn(S07PacketRespawn p_147280_1_)
{
    if (p_147280_1_.func_149082_c() != this.gameController.thePlayer.dimension)
    {
        this.doneLoadingTerrain = false;
        Scoreboard scoreboard = this.clientWorldController.getScoreboard();
        this.clientWorldController = new WorldClient(this, new WorldSettings(0L, p_147280_1_.func_149083_e(), false, this.gameController.theWorld.getWorldInfo().isHardcoreModeEnabled(), p_147280_1_.func_149080_f()), p_147280_1_.func_149082_c(), p_147280_1_.func_149081_d(), this.gameController.mcProfiler);
        this.clientWorldController.setWorldScoreboard(scoreboard);
        this.clientWorldController.isRemote = true;
        this.gameController.loadWorld(this.clientWorldController);
        this.gameController.thePlayer.dimension = p_147280_1_.func_149082_c();
        this.gameController.displayGuiScreen(new GuiDownloadTerrain(this));
    }

    this.gameController.setDimensionAndSpawnPlayer(p_147280_1_.func_149082_c());
    this.gameController.playerController.setGameType(p_147280_1_.func_149083_e());
}
项目:Cauldron    文件:ServerConfigurationManager.java   
public void transferPlayerToDimension(EntityPlayerMP p_72356_1_, int p_72356_2_, Teleporter teleporter)
{
    int j = p_72356_1_.dimension;
    WorldServer worldserver = this.mcServer.worldServerForDimension(p_72356_1_.dimension);
    p_72356_1_.dimension = p_72356_2_;
    WorldServer worldserver1 = this.mcServer.worldServerForDimension(p_72356_1_.dimension);
    p_72356_1_.playerNetServerHandler.sendPacket(new S07PacketRespawn(p_72356_1_.dimension, p_72356_1_.worldObj.difficultySetting, p_72356_1_.worldObj.getWorldInfo().getTerrainType(), p_72356_1_.theItemInWorldManager.getGameType()));
    worldserver.removePlayerEntityDangerously(p_72356_1_);
    p_72356_1_.isDead = false;
    this.transferEntityToWorld(p_72356_1_, j, worldserver, worldserver1, teleporter);
    this.func_72375_a(p_72356_1_, worldserver);
    p_72356_1_.playerNetServerHandler.setPlayerLocation(p_72356_1_.posX, p_72356_1_.posY, p_72356_1_.posZ, p_72356_1_.rotationYaw, p_72356_1_.rotationPitch);
    p_72356_1_.theItemInWorldManager.setWorld(worldserver1);
    this.updateTimeAndWeatherForPlayer(p_72356_1_, worldserver1);
    this.syncPlayerInventory(p_72356_1_);
    Iterator iterator = p_72356_1_.getActivePotionEffects().iterator();

    while (iterator.hasNext())
    {
        PotionEffect potioneffect = (PotionEffect)iterator.next();
        p_72356_1_.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(p_72356_1_.getEntityId(), potioneffect));
    }
    FMLCommonHandler.instance().firePlayerChangedDimensionEvent(p_72356_1_, j, p_72356_2_);
}
项目:MyEssentials-Core    文件:PlayerUtils.java   
/**
 * Transfers a player to a new dimension preserving potion effects and motion.
 */
public static void transferPlayerToDimension(EntityPlayerMP player, int dim) {
    ServerConfigurationManager configManager = player.mcServer.getConfigurationManager();
    int oldDimension = player.dimension;

    WorldServer oldWorldServer = configManager.getServerInstance().worldServerForDimension(oldDimension);
    WorldServer newWorldServer = configManager.getServerInstance().worldServerForDimension(dim);

    player.dimension = dim;
    player.playerNetServerHandler.sendPacket(new S07PacketRespawn(player.dimension, player.worldObj.difficultySetting, player.worldObj.getWorldInfo().getTerrainType(), player.theItemInWorldManager.getGameType()));
    oldWorldServer.removePlayerEntityDangerously(player);
    player.isDead = false;

    transferPlayerToWorld(player, oldWorldServer, newWorldServer);
    configManager.func_72375_a(player, oldWorldServer);
    player.playerNetServerHandler.setPlayerLocation(player.posX, player.posY, player.posZ, player.rotationYaw, player.rotationPitch);
    player.theItemInWorldManager.setWorld(newWorldServer);
    configManager.updateTimeAndWeatherForPlayer(player, newWorldServer);
    configManager.syncPlayerInventory(player);
    for (PotionEffect potioneffect : (Iterable<PotionEffect>) player.getActivePotionEffects()) {
        player.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(player.getEntityId(), potioneffect));
    }
    FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, oldDimension, dim);
}
项目:4Space-5    文件:WorldUtil.java   
@SideOnly(Side.CLIENT)
  public static EntityPlayer forceRespawnClient(int dimID, int par2, String par3, int par4)
  {
      S07PacketRespawn fakePacket = new S07PacketRespawn(dimID, EnumDifficulty.getDifficultyEnum(par2), WorldType.parseWorldType(par3), WorldSettings.GameType.getByID(par4));
      Minecraft.getMinecraft().getNetHandler().handleRespawn(fakePacket);
return FMLClientHandler.instance().getClientPlayerEntity();
  }
项目:vsminecraft    文件:TileEntityTeleporter.java   
public static void teleportPlayerTo(EntityPlayerMP player, Coord4D coord, TileEntityTeleporter teleporter)
{
    if(player.dimension != coord.dimensionId)
    {
        int id = player.dimension;
        WorldServer oldWorld = player.mcServer.worldServerForDimension(player.dimension);
        player.dimension = coord.dimensionId;
        WorldServer newWorld = player.mcServer.worldServerForDimension(player.dimension);
        player.playerNetServerHandler.sendPacket(new S07PacketRespawn(player.dimension, player.worldObj.difficultySetting, newWorld.getWorldInfo().getTerrainType(), player.theItemInWorldManager.getGameType()));
        oldWorld.removePlayerEntityDangerously(player);
        player.isDead = false;

        if(player.isEntityAlive())
        {
            newWorld.spawnEntityInWorld(player);
            player.setLocationAndAngles(coord.xCoord+0.5, coord.yCoord+1, coord.zCoord+0.5, player.rotationYaw, player.rotationPitch);
            newWorld.updateEntityWithOptionalForce(player, false);
            player.setWorld(newWorld);
        }

        player.mcServer.getConfigurationManager().func_72375_a(player, oldWorld);
        player.playerNetServerHandler.setPlayerLocation(coord.xCoord+0.5, coord.yCoord+1, coord.zCoord+0.5, player.rotationYaw, player.rotationPitch);
        player.theItemInWorldManager.setWorld(newWorld);
        player.mcServer.getConfigurationManager().updateTimeAndWeatherForPlayer(player, newWorld);
        player.mcServer.getConfigurationManager().syncPlayerInventory(player);

        Iterator iterator = player.getActivePotionEffects().iterator();

        while(iterator.hasNext())
        {
            PotionEffect potioneffect = (PotionEffect)iterator.next();
            player.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(player.getEntityId(), potioneffect));
        }

        FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, id, coord.dimensionId);
    }
    else {
        player.playerNetServerHandler.setPlayerLocation(coord.xCoord+0.5, coord.yCoord+1, coord.zCoord+0.5, player.rotationYaw, player.rotationPitch);
    }
}
项目:NeptuneCommon    文件:MixinNetHandlerPlayServer.java   
@Override
public void handleRespawn(Packet respawnPacket) {
    if (!(((NeptunePacket) respawnPacket).getHandle() instanceof S07PacketRespawn)) {
        return;
    }

    sendPacket(respawnPacket);
}
项目:NeptuneMod    文件:MixinNetHandlerPlayServer.java   
@Override
public void handleRespawn(Packet respawnPacket) {
    if (!(respawnPacket instanceof S07PacketRespawn)) {
        return;
    }

    this.sendPacket(respawnPacket);
}
项目:RecallResurrection    文件:RecallTransporter.java   
public static void transferPlayerToDimension(EntityPlayerMP player, int newDim, Coord6D dest)
{
    int j = player.dimension;
    ServerConfigurationManager manager = MinecraftServer.getServer().getConfigurationManager();
    WorldServer oldServer = MinecraftServer.getServer().worldServerForDimension(player.dimension);
    player.dimension = newDim;
    WorldServer newServer = MinecraftServer.getServer().worldServerForDimension(player.dimension);

    // Let's load the chunk for the player. That would probably be swell.
    Chunk c = newServer.getChunkFromBlockCoords((int)Math.floor(dest.x), (int)Math.floor(dest.y));
    int cX = c.xPosition;
    int cZ = c.zPosition;
    newServer.getChunkProvider().loadChunk(cX, cZ);

    player.playerNetServerHandler.sendPacket(new S07PacketRespawn(player.dimension, player.worldObj.difficultySetting, player.worldObj.getWorldInfo().getTerrainType(), player.theItemInWorldManager.getGameType()));
    oldServer.removePlayerEntityDangerously(player);
    player.isDead = false;
    transferEntityToWorld(player, j, oldServer, newServer, dest);
    manager.func_72375_a(player, oldServer);
    player.playerNetServerHandler.setPlayerLocation(player.posX, player.posY, player.posZ, player.rotationYaw, player.rotationPitch);
    player.theItemInWorldManager.setWorld(newServer);
    manager.updateTimeAndWeatherForPlayer(player, newServer);
    manager.syncPlayerInventory(player);
    Iterator iterator = player.getActivePotionEffects().iterator();

    while (iterator.hasNext())
    {
        PotionEffect potioneffect = (PotionEffect)iterator.next();
        player.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(player.getEntityId(), potioneffect));
    }
    FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, j, newDim);
}
项目:DecompiledMinecraft    文件:NetHandlerPlayServer.java   
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);
            }
        }
    }
}
项目:DecompiledMinecraft    文件:NetHandlerPlayServer.java   
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);
            }
        }
    }
}
项目:BaseClient    文件:NetHandlerPlayServer.java   
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);
            }
        }
    }
}
项目:BaseClient    文件:NetHandlerPlayServer.java   
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);
            }
        }
    }
}
项目:TeleComponents    文件:TeleportHelper.java   
public static Entity teleportPlayerToDim(World oldWorld, int newWorldID, double d, double e, double f, Entity entity) {
    if (entity != null) {
        if (entity.timeUntilPortal <= 0) {
            WorldServer oldWorldServer = MinecraftServer.getServer().worldServerForDimension(entity.dimension);
            WorldServer newWorldServer = MinecraftServer.getServer().worldServerForDimension(newWorldID);
            if (entity instanceof EntityPlayer) {
                EntityPlayerMP player = (EntityPlayerMP) entity;
                if (!player.worldObj.isRemote) {
                    player.worldObj.theProfiler.startSection("portal");
                    player.worldObj.theProfiler.startSection("changeDimension");
                    ServerConfigurationManager config = player.mcServer.getConfigurationManager();
                    player.closeScreen();
                    player.dimension = newWorldServer.provider.dimensionId;
                    player.playerNetServerHandler.sendPacket(new S07PacketRespawn(player.dimension, player.worldObj.difficultySetting, newWorldServer.getWorldInfo().getTerrainType(), player.theItemInWorldManager.getGameType()));
                    oldWorldServer.removeEntity(player);
                    player.isDead = false;
                    player.setLocationAndAngles(d, e, f, player.rotationYaw, player.rotationPitch);
                    newWorldServer.spawnEntityInWorld(player);
                    player.setWorld(newWorldServer);
                    config.func_72375_a(player, oldWorldServer);
                    player.playerNetServerHandler.setPlayerLocation(d, e, f, entity.rotationYaw, entity.rotationPitch);
                    player.theItemInWorldManager.setWorld(newWorldServer);
                    config.updateTimeAndWeatherForPlayer(player, newWorldServer);
                    config.syncPlayerInventory(player);
                    player.worldObj.theProfiler.endSection();
                    oldWorldServer.resetUpdateEntityTick();
                    newWorldServer.resetUpdateEntityTick();
                    player.worldObj.theProfiler.endSection();
                    for (Iterator<PotionEffect> potion = player.getActivePotionEffects().iterator(); potion.hasNext(); ) {
                        player.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(player.getEntityId(), potion.next()));
                    }
                    player.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel));
                    FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, oldWorldServer.provider.dimensionId, player.dimension);
                    player.timeUntilPortal = 150;
                }
                player.worldObj.theProfiler.endSection();
                return player;
            }
        }
    }
    return null;
}
项目:Thermos    文件:ThermiteTeleportationHandler.java   
public static void transferPlayerToDimension(EntityPlayerMP player, int dim, ServerConfigurationManager manager, Environment environ) {

        int oldDim = player.dimension;
        WorldServer worldserver = manager.getServerInstance().worldServerForDimension(player.dimension);
        player.dimension = dim;
        WorldServer worldserver1 = manager.getServerInstance().worldServerForDimension(player.dimension);
        // Cauldron dont crash the client, let 'em know there's a new dimension in town
        if (DimensionManager.isBukkitDimension(dim))
        {
            FMLEmbeddedChannel serverChannel = ForgeNetworkHandler.getServerChannel();
            serverChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
            serverChannel.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
            serverChannel.writeOutbound(new ForgeMessage.DimensionRegisterMessage(dim, environ.getId()));
        }
        // Cauldron end
        player.playerNetServerHandler.sendPacket(new S07PacketRespawn(dim, worldserver1.difficultySetting, worldserver1.getWorldInfo()
                .getTerrainType(), player.theItemInWorldManager.getGameType()));
        player.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel));

        worldserver.removePlayerEntityDangerously(player);
        if (player.riddenByEntity != null) {
            player.riddenByEntity.mountEntity(null);
        }
        if (player.ridingEntity != null) {
            player.mountEntity(null);
        }
        player.isDead = false;
        transferEntityToWorld(player, worldserver, worldserver1);
        manager.func_72375_a(player, worldserver);
        player.playerNetServerHandler.setPlayerLocation(player.posX, player.posY, player.posZ, player.rotationYaw, player.rotationPitch);
        player.theItemInWorldManager.setWorld(worldserver1);
        manager.updateTimeAndWeatherForPlayer(player, worldserver1);
        manager.syncPlayerInventory(player);
        Iterator<PotionEffect> iterator = player.getActivePotionEffects().iterator();

        while (iterator.hasNext()) {
            PotionEffect potioneffect = iterator.next();
            player.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(player.getEntityId(), potioneffect));
        }
        FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, oldDim, dim);
    }
项目:enhancedportals    文件:EntityManager.java   
static Entity teleportPlayerEntity(Entity entity, TileController start, TileController end, boolean keepMomentum, BlockPos exitLoc, float yaw) {
    WorldServer startWorld = (WorldServer) start.getWorldObj(), endWorld = (WorldServer) end.getWorldObj();
    boolean dimensionalTransport = startWorld.provider.dimensionId != endWorld.provider.dimensionId;
    EntityPlayerMP player = (EntityPlayerMP) entity;
    ServerConfigurationManager config = null;
    double exitX = exitLoc.getX() + (end.portalType == 1 || end.portalType == 3 ? entity.width < 1 ? 0.5 : entity.width / 2 : 0.5);
    double exitY = exitLoc.getY();
    double exitZ = exitLoc.getZ() + (end.portalType == 2 || end.portalType == 3 ? entity.width < 1 ? 0.5 : entity.width / 2 : 0.5);

    player.closeScreen();

    if (dimensionalTransport) {
        config = player.mcServer.getConfigurationManager();
        player.dimension = endWorld.provider.dimensionId;
        player.playerNetServerHandler.sendPacket(new S07PacketRespawn(player.dimension, player.worldObj.difficultySetting, endWorld.getWorldInfo().getTerrainType(), player.theItemInWorldManager.getGameType()));

        startWorld.removeEntity(player);
        player.isDead = false;
        player.setLocationAndAngles(exitX, exitY, exitZ, yaw, player.rotationPitch);
        handleMomentum(player, start.portalType, end.portalType, yaw, keepMomentum);
        endWorld.spawnEntityInWorld(player);
        player.setWorld(endWorld);

        config.func_72375_a(player, startWorld);
        player.playerNetServerHandler.setPlayerLocation(exitX, exitY, exitZ, yaw, entity.rotationPitch);
        player.theItemInWorldManager.setWorld(endWorld);

        config.updateTimeAndWeatherForPlayer(player, endWorld);
        config.syncPlayerInventory(player);

        player.worldObj.theProfiler.endSection();
        startWorld.resetUpdateEntityTick();
        endWorld.resetUpdateEntityTick();
        player.worldObj.theProfiler.endSection();

        for (Iterator<PotionEffect> potion = player.getActivePotionEffects().iterator(); potion.hasNext();)
            player.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(player.getEntityId(), potion.next()));

        player.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel));

        FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, startWorld.provider.dimensionId, player.dimension);
    } else {
        player.rotationYaw = yaw;
        player.setPositionAndUpdate(exitX, exitY, exitZ);
        handleMomentum(player, start.portalType, end.portalType, yaw, keepMomentum);
        player.worldObj.updateEntityWithOptionalForce(player, false);
    }

    return player;
}
项目:TeleComponents    文件:TeleportHelper.java   
public static Entity teleportPlayerToDim(World oldWorld, int newWorldID, double d, double e, double f, Entity entity) {
    if (entity != null) {
        if (entity.timeUntilPortal <= 0) {
            WorldServer oldWorldServer = MinecraftServer.getServer().worldServerForDimension(entity.dimension);
            WorldServer newWorldServer = MinecraftServer.getServer().worldServerForDimension(newWorldID);
            if (entity instanceof EntityPlayer) {
                EntityPlayerMP player = (EntityPlayerMP) entity;
                if (!player.worldObj.isRemote) {
                    player.worldObj.theProfiler.startSection("portal");
                    player.worldObj.theProfiler.startSection("changeDimension");
                    ServerConfigurationManager config = player.mcServer.getConfigurationManager();
                    player.closeScreen();
                    player.dimension = newWorldServer.provider.dimensionId;
                    player.playerNetServerHandler.sendPacket(new S07PacketRespawn(player.dimension, player.worldObj.difficultySetting, newWorldServer.getWorldInfo().getTerrainType(), player.theItemInWorldManager.getGameType()));
                    oldWorldServer.removeEntity(player);
                    player.isDead = false;
                    player.setLocationAndAngles(d, e, f, player.rotationYaw, player.rotationPitch);
                    newWorldServer.spawnEntityInWorld(player);
                    player.setWorld(newWorldServer);
                    config.func_72375_a(player, oldWorldServer);
                    player.playerNetServerHandler.setPlayerLocation(d, e, f, entity.rotationYaw, entity.rotationPitch);
                    player.theItemInWorldManager.setWorld(newWorldServer);
                    config.updateTimeAndWeatherForPlayer(player, newWorldServer);
                    config.syncPlayerInventory(player);
                    player.worldObj.theProfiler.endSection();
                    oldWorldServer.resetUpdateEntityTick();
                    newWorldServer.resetUpdateEntityTick();
                    player.worldObj.theProfiler.endSection();
                    for (Iterator<PotionEffect> potion = player.getActivePotionEffects().iterator(); potion.hasNext(); ) {
                        player.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(player.getEntityId(), potion.next()));
                    }
                    player.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel));
                    FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, oldWorldServer.provider.dimensionId, player.dimension);
                    player.timeUntilPortal = 150;
                }
                player.worldObj.theProfiler.endSection();
                return player;
            }
        }
    }
    return null;
}
项目:nailed    文件:NailedEventFactory.java   
public static void onPlayerRespawn(EntityPlayerMP ent){
    MinecraftServer server = MinecraftServer.getServer();
    NailedPlayer player = ((NailedPlayer) NailedPlatform.instance().getPlayerFromEntity(ent));
    NailedWorld destWorld = NailedDimensionManager.instance().getWorld(ent.dimension);
    NailedWorld currentWorld = NailedDimensionManager.instance().getWorld(ent.dimension);
    Map destMap = destWorld.getMap();

    currentWorld.getWrapped().getEntityTracker().removePlayerFromTrackers(ent); //Remove from EntityTracker
    currentWorld.getWrapped().getEntityTracker().untrackEntity(ent); //Notify other players of entity death
    currentWorld.getWrapped().getPlayerManager().removePlayer(ent); //Remove player's ChunkLoader
    server.getConfigurationManager().playerEntityList.remove(ent); //Remove from the global player list
    currentWorld.getWrapped().removePlayerEntityDangerously(ent); //Force the entity to be removed from it's current world

    Mappack mappack = destMap != null ? destMap.mappack() : null;
    Location pos = mappack == null ? new Location(destWorld, 0, 64, 0) : Location.builder().copy(destWorld.getConfig().spawnPoint()).setWorld(destWorld).build();

    if(destMap != null && destMap.getGameManager().isGameRunning()){
        if(destMap.getPlayerTeam(player) == null){
            //TODO: random spawnpoints
            /*if(mappack != null && mappack.getMetadata.isChoosingRandomSpawnpointAtRespawn()){
              List<Location> spawnpoints = mappack.getMappackMetadata().getRandomSpawnpoints();
              pos = spawnpoints.get(NailedAPI.getMapLoader().getRandomSpawnpointSelector().nextInt(spawnpoints.size()));
            }*/
        }else{
            Location p = destMap.getPlayerTeam(player).getSpawnPoint();
            if(p != null) pos = p;
        }
    }

    ent.dimension = destWorld.getDimensionId();

    ItemInWorldManager worldManager = new ItemInWorldManager(destWorld.getWrapped());

    EntityPlayerMP newPlayer = new EntityPlayerMP(server, destWorld.getWrapped(), ent.getGameProfile(), worldManager);
    newPlayer.playerNetServerHandler = ent.playerNetServerHandler;
    newPlayer.clonePlayer(ent, false);
    newPlayer.dimension = destWorld.getDimensionId();
    newPlayer.setEntityId(ent.getEntityId());

    worldManager.setGameType(ent.theItemInWorldManager.getGameType());

    newPlayer.setLocationAndAngles(pos.getX(), pos.getY(), pos.getZ(), pos.getYaw(), pos.getPitch());
    destWorld.getWrapped().theChunkProviderServer.loadChunk((int)(newPlayer.posX) >> 4, (int)(newPlayer.posZ) >> 4);

    player.sendPacket(new S07PacketRespawn(destWorld.getConfig().dimension().getId(), destWorld.getWrapped().getDifficulty(), destWorld.getWrapped().getWorldInfo().getTerrainType(), worldManager.getGameType()));
    player.netHandler.setPlayerLocation(pos.getX(), pos.getY(), pos.getZ(), pos.getYaw(), pos.getPitch());
    player.sendPacket(new S05PacketSpawnPosition(new BlockPos(pos.getX(), pos.getY(), pos.getZ())));
    player.sendPacket(new S1FPacketSetExperience(newPlayer.experience, newPlayer.experienceTotal, newPlayer.experienceLevel));
    server.getConfigurationManager().updateTimeAndWeatherForPlayer(newPlayer, destWorld.getWrapped());
    destWorld.getWrapped().getPlayerManager().addPlayer(newPlayer);
    destWorld.getWrapped().spawnEntityInWorld(newPlayer);
    //noinspection unchecked
    ((List<EntityPlayer>) server.getConfigurationManager().playerEntityList).add(newPlayer);
    newPlayer.addSelfToInternalCraftingInventory();
    newPlayer.setHealth(newPlayer.getHealth());

    player.netHandler.playerEntity = newPlayer;
    player.entity = newPlayer;

    //TODO: respawn event
}
项目:ServerTools-CORE    文件:PlayerUtils.java   
/**
 * Transfer a player to another dimension
 *
 * @param player The player to transfer
 * @param dimId  The target dimension Id
 */
public static void transferToDimension(final EntityPlayerMP player, final int dimId) {
    requireNonNull(player, "player");

    final ServerConfigurationManager configurationManager = player.mcServer.getConfigurationManager();
    final WorldServer oldWorld = player.getServerForPlayer();
    final int oldDimId = oldWorld.provider.getDimensionId();
    @Nullable WorldServer newWorld = DimensionManager.getWorld(dimId);
    if (newWorld == null) {
        DimensionManager.initDimension(dimId);
        newWorld = DimensionManager.getWorld(dimId);
        if (newWorld == null) {
            throw new IllegalArgumentException("Dimension " + dimId + " could not be found or loaded");
        }
    }

    player.dimension = dimId;
    player.playerNetServerHandler.sendPacket(new S07PacketRespawn(player.dimension, newWorld.getDifficulty(), newWorld.getWorldInfo().getTerrainType(), player.theItemInWorldManager.getGameType()));
    oldWorld.removePlayerEntityDangerously(player);
    player.isDead = false;
    WorldProvider oldProvider = oldWorld.provider;
    WorldProvider newProvider = newWorld.provider;
    double moveFactor = oldProvider.getMovementFactor() / newProvider.getMovementFactor();
    double x = player.posX * moveFactor;
    double z = player.posZ * moveFactor;

    oldWorld.theProfiler.startSection("placing");

    x = (double) MathHelper.clamp_int((int) x, -29999872, 29999872);
    z = (double) MathHelper.clamp_int((int) z, -29999872, 29999872);

    if (player.isEntityAlive()) {
        player.setLocationAndAngles(x, player.posY, z, player.rotationYaw, player.rotationPitch);
        newWorld.spawnEntityInWorld(player);
        newWorld.updateEntityWithOptionalForce(player, false);
    }

    oldWorld.theProfiler.endSection();
    player.setWorld(newWorld);
    configurationManager.preparePlayer(player, oldWorld);
    player.playerNetServerHandler.setPlayerLocation(player.posX, player.posY, player.posZ, player.rotationYaw, player.rotationPitch);
    player.theItemInWorldManager.setWorld(newWorld);
    configurationManager.updateTimeAndWeatherForPlayer(player, newWorld);
    configurationManager.syncPlayerInventory(player);

    for (PotionEffect effect : player.getActivePotionEffects()) {
        player.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(player.getEntityId(), effect));
    }

    FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, oldDimId, dimId);
}
项目:DecompiledMinecraft    文件:INetHandlerPlayClient.java   
void handleRespawn(S07PacketRespawn packetIn);
项目:DecompiledMinecraft    文件:INetHandlerPlayClient.java   
void handleRespawn(S07PacketRespawn packetIn);
项目:BaseClient    文件:INetHandlerPlayClient.java   
void handleRespawn(S07PacketRespawn packetIn);
项目:BaseClient    文件:INetHandlerPlayClient.java   
void handleRespawn(S07PacketRespawn packetIn);
项目:Resilience-Client-Source    文件:INetHandlerPlayClient.java   
void handleRespawn(S07PacketRespawn var1);
项目:Cauldron    文件:INetHandlerPlayClient.java   
void handleRespawn(S07PacketRespawn p_147280_1_);
项目:Cauldron    文件:INetHandlerPlayClient.java   
void handleRespawn(S07PacketRespawn p_147280_1_);