/** * 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)); } }
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)); } }
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); }
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_); }
/** * 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); }
public void handleEntityEffect(S1DPacketEntityEffect packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId()); if (entity instanceof EntityLivingBase) { PotionEffect potioneffect = new PotionEffect(packetIn.getEffectId(), packetIn.getDuration(), packetIn.getAmplifier(), false, packetIn.func_179707_f()); potioneffect.setPotionDurationMax(packetIn.func_149429_c()); ((EntityLivingBase)entity).addPotionEffect(potioneffect); } }
public void handleEntityEffect(S1DPacketEntityEffect packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId()); if (entity instanceof EntityLivingBase) { PotionEffect potioneffect = new PotionEffect(packetIn.getEffectId(), packetIn.getDuration(), packetIn.getAmplifier(), false, packetIn.func_179707_f()); potioneffect.setPotionDurationMax(packetIn.func_149429_c()); ((EntityLivingBase) entity).addPotionEffect(potioneffect); } }
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); } }
public void handleEntityEffect(S1DPacketEntityEffect p_147260_1_) { Entity var2 = this.clientWorldController.getEntityByID(p_147260_1_.func_149426_d()); if (var2 instanceof EntityLivingBase) { PotionEffect var3 = new PotionEffect(p_147260_1_.func_149427_e(), p_147260_1_.func_149425_g(), p_147260_1_.func_149428_f()); var3.setPotionDurationMax(p_147260_1_.func_149429_c()); ((EntityLivingBase)var2).addPotionEffect(var3); } }
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); }
public void handleEntityEffect(S1DPacketEntityEffect p_147260_1_) { Entity entity = this.clientWorldController.getEntityByID(p_147260_1_.func_149426_d()); if (entity instanceof EntityLivingBase) { PotionEffect potioneffect = new PotionEffect(p_147260_1_.func_149427_e(), p_147260_1_.func_149425_g(), p_147260_1_.func_149428_f()); potioneffect.setPotionDurationMax(p_147260_1_.func_149429_c()); ((EntityLivingBase)entity).addPotionEffect(potioneffect); } }
protected void onNewPotionEffect(PotionEffect id) { super.onNewPotionEffect(id); this.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(this.getEntityId(), id)); }
protected void onChangedPotionEffect(PotionEffect id, boolean p_70695_2_) { super.onChangedPotionEffect(id, p_70695_2_); this.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(this.getEntityId(), id)); }
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; }
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); }
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; }
protected void onNewPotionEffect(PotionEffect par1PotionEffect) { super.onNewPotionEffect(par1PotionEffect); this.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(this.getEntityId(), par1PotionEffect)); }
protected void onChangedPotionEffect(PotionEffect par1PotionEffect, boolean par2) { super.onChangedPotionEffect(par1PotionEffect, par2); this.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(this.getEntityId(), par1PotionEffect)); }
public void initializeConnectionToPlayer(NetworkManager par1INetworkManager, EntityPlayerMP par2EntityPlayerMP) { NBTTagCompound var3 = this.readPlayerDataFromFile(par2EntityPlayerMP); par2EntityPlayerMP.setWorld(this.mcServer.worldServerForDimension(par2EntityPlayerMP.dimension)); par2EntityPlayerMP.theItemInWorldManager.setWorld((WorldServer)par2EntityPlayerMP.worldObj); String var4 = "local"; if (par1INetworkManager.getSocketAddress() != null) { var4 = par1INetworkManager.getSocketAddress().toString(); } logger.info(par2EntityPlayerMP.getCommandSenderName() + "[" + var4 + "] logged in with entity id " + par2EntityPlayerMP.getEntityId() + " at (" + par2EntityPlayerMP.posX + ", " + par2EntityPlayerMP.posY + ", " + par2EntityPlayerMP.posZ + ")"); WorldServer var5 = this.mcServer.worldServerForDimension(par2EntityPlayerMP.dimension); ChunkCoordinates var6 = var5.getSpawnPoint(); this.func_72381_a(par2EntityPlayerMP, (EntityPlayerMP)null, var5); NetHandlerPlayServer var7 = new NetHandlerPlayServer(this.mcServer, par1INetworkManager, par2EntityPlayerMP); var7.sendPacket(new S01PacketJoinGame(par2EntityPlayerMP.getEntityId(), par2EntityPlayerMP.theItemInWorldManager.getGameType(), var5.getWorldInfo().isHardcoreModeEnabled(), var5.provider.dimensionId, var5.difficultySetting, this.getMaxPlayers(), var5.getWorldInfo().getTerrainType())); var7.sendPacket(new S3FPacketCustomPayload("MC|Brand", this.getServerInstance().getServerModName().getBytes(Charsets.UTF_8))); var7.sendPacket(new S05PacketSpawnPosition(var6.posX, var6.posY, var6.posZ)); var7.sendPacket(new S39PacketPlayerAbilities(par2EntityPlayerMP.capabilities)); var7.sendPacket(new S09PacketHeldItemChange(par2EntityPlayerMP.inventory.currentItem)); par2EntityPlayerMP.func_147099_x().func_150877_d(); par2EntityPlayerMP.func_147099_x().func_150884_b(par2EntityPlayerMP); this.func_96456_a((ServerScoreboard)var5.getScoreboard(), par2EntityPlayerMP); this.mcServer.func_147132_au(); ChatComponentTranslation var8 = new ChatComponentTranslation("multiplayer.player.joined", new Object[] {par2EntityPlayerMP.func_145748_c_()}); var8.getChatStyle().setColor(EnumChatFormatting.YELLOW); this.func_148539_a(var8); this.playerLoggedIn(par2EntityPlayerMP); var7.setPlayerLocation(par2EntityPlayerMP.posX, par2EntityPlayerMP.posY, par2EntityPlayerMP.posZ, par2EntityPlayerMP.rotationYaw, par2EntityPlayerMP.rotationPitch); this.updateTimeAndWeatherForPlayer(par2EntityPlayerMP, var5); if (this.mcServer.func_147133_T().length() > 0) { par2EntityPlayerMP.func_147095_a(this.mcServer.func_147133_T()); } Iterator var9 = par2EntityPlayerMP.getActivePotionEffects().iterator(); while (var9.hasNext()) { PotionEffect var10 = (PotionEffect)var9.next(); var7.sendPacket(new S1DPacketEntityEffect(par2EntityPlayerMP.getEntityId(), var10)); } par2EntityPlayerMP.addSelfToInternalCraftingInventory(); if (var3 != null && var3.func_150297_b("Riding", 10)) { Entity var11 = EntityList.createEntityFromNBT(var3.getCompoundTag("Riding"), var5); if (var11 != null) { var11.forceSpawn = true; var5.spawnEntityInWorld(var11); par2EntityPlayerMP.mountEntity(var11); var11.forceSpawn = false; } } }
protected void onNewPotionEffect(PotionEffect p_70670_1_) { super.onNewPotionEffect(p_70670_1_); this.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(this.getEntityId(), p_70670_1_)); }
protected void onChangedPotionEffect(PotionEffect p_70695_1_, boolean p_70695_2_) { super.onChangedPotionEffect(p_70695_1_, p_70695_2_); this.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(this.getEntityId(), p_70695_1_)); }
/** * 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); }
void handleEntityEffect(S1DPacketEntityEffect packetIn);