private Entity teleportPlayerToDim(World oldWorld, int newWorldID, double d, double e, double f, Entity entity) { MinecraftServer server = entity.getServer(); WorldServer oldWorldServer = server.worldServerForDimension(entity.dimension); WorldServer newWorldServer = server.worldServerForDimension(newWorldID); if (entity instanceof EntityPlayer) { EntityPlayerMP player = (EntityPlayerMP) entity; if (!player.worldObj.isRemote) { player.worldObj.theProfiler.startSection("portal"); player.worldObj.theProfiler.startSection("changeDimension"); PlayerList config = player.mcServer.getPlayerList(); player.closeScreen(); player.dimension = newWorldServer.provider.getDimension(); player.playerNetServerHandler.sendPacket(new SPacketRespawn(player.dimension, player.worldObj.getDifficulty(), newWorldServer.getWorldInfo().getTerrainType(), player.interactionManager.getGameType())); oldWorldServer.removeEntity(player); player.isDead = false; player.setLocationAndAngles(d, e, f, player.rotationYaw, player.rotationPitch); newWorldServer.spawnEntityInWorld(player); player.setWorld(newWorldServer); config.preparePlayer(player, oldWorldServer); player.playerNetServerHandler.setPlayerLocation(d, e, f, entity.rotationYaw, entity.rotationPitch); player.interactionManager.setWorld(newWorldServer); config.updateTimeAndWeatherForPlayer(player, newWorldServer); config.syncPlayerInventory(player); player.worldObj.theProfiler.endSection(); oldWorldServer.resetUpdateEntityTick(); newWorldServer.resetUpdateEntityTick(); player.worldObj.theProfiler.endSection(); for (PotionEffect potionEffect : player.getActivePotionEffects()) { player.playerNetServerHandler.sendPacket(new SPacketEntityEffect(player.getEntityId(), potionEffect)); } player.playerNetServerHandler.sendPacket(new SPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel)); FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, oldWorldServer.provider.getDimension(), player.dimension); } player.worldObj.theProfiler.endSection(); return player; } return null; }
public void handleSetExperience(SPacketSetExperience packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); this.gameController.player.setXPStats(packetIn.getExperienceBar(), packetIn.getTotalExperience(), packetIn.getLevel()); }
public void handleSetExperience(SPacketSetExperience packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); this.gameController.thePlayer.setXPStats(packetIn.getExperienceBar(), packetIn.getTotalExperience(), packetIn.getLevel()); }
void handleSetExperience(SPacketSetExperience packetIn);