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

项目:NBTEdit    文件:EntityNBTPacket.java   
@Override
public void handleServerSide(EntityPlayerMP player) {
    Entity e = player.worldObj.getEntityByID(entityID);
    if (e != null) {
        try {
            GameType preGameType = player.theItemInWorldManager.getGameType();
            e.readFromNBT(tag);
            NBTEdit.log(Level.FINE, player.getCommandSenderName() + " edited a tag -- Entity ID #" + entityID);
            NBTEdit.logTag(tag);
            if (e == player) { //Update player info
                player.sendContainerToPlayer(player.inventoryContainer);
                GameType type = player.theItemInWorldManager.getGameType();
                if (preGameType != type)
                    player.setGameType(type);
                player.playerNetServerHandler.sendPacket(new S06PacketUpdateHealth(player.getHealth(), player.getFoodStats().getFoodLevel(), player.getFoodStats().getSaturationLevel()));
                player.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel));
                player.sendPlayerAbilities();
            }
            sendMessageToPlayer(player, "Your changes have been saved");
        } 
        catch(Throwable t) {
            sendMessageToPlayer(player, SECTION_SIGN + "cSave Failed - Invalid NBT format for Entity");
            NBTEdit.log(Level.WARNING, player.getCommandSenderName() + " edited a tag and caused an exception");
            NBTEdit.logTag(tag);
            NBTEdit.throwing("EntityNBTPacket", "handleServerSide", t);
        }
    }
}
项目:DecompiledMinecraft    文件:EntityPlayerMP.java   
public void onUpdateEntity()
{
    try
    {
        super.onUpdate();

        for (int i = 0; i < this.inventory.getSizeInventory(); ++i)
        {
            ItemStack itemstack = this.inventory.getStackInSlot(i);

            if (itemstack != null && itemstack.getItem().isMap())
            {
                Packet packet = ((ItemMapBase)itemstack.getItem()).createMapDataPacket(itemstack, this.worldObj, this);

                if (packet != null)
                {
                    this.playerNetServerHandler.sendPacket(packet);
                }
            }
        }

        if (this.getHealth() != this.lastHealth || this.lastFoodLevel != this.foodStats.getFoodLevel() || this.foodStats.getSaturationLevel() == 0.0F != this.wasHungry)
        {
            this.playerNetServerHandler.sendPacket(new S06PacketUpdateHealth(this.getHealth(), this.foodStats.getFoodLevel(), this.foodStats.getSaturationLevel()));
            this.lastHealth = this.getHealth();
            this.lastFoodLevel = this.foodStats.getFoodLevel();
            this.wasHungry = this.foodStats.getSaturationLevel() == 0.0F;
        }

        if (this.getHealth() + this.getAbsorptionAmount() != this.combinedHealth)
        {
            this.combinedHealth = this.getHealth() + this.getAbsorptionAmount();

            for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.health))
            {
                this.getWorldScoreboard().getValueFromObjective(this.getName(), scoreobjective).func_96651_a(Arrays.<EntityPlayer>asList(new EntityPlayer[] {this}));
            }
        }

        if (this.experienceTotal != this.lastExperience)
        {
            this.lastExperience = this.experienceTotal;
            this.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(this.experience, this.experienceTotal, this.experienceLevel));
        }

        if (this.ticksExisted % 20 * 5 == 0 && !this.getStatFile().hasAchievementUnlocked(AchievementList.exploreAllBiomes))
        {
            this.updateBiomesExplored();
        }
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Ticking player");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("Player being ticked");
        this.addEntityCrashInfo(crashreportcategory);
        throw new ReportedException(crashreport);
    }
}
项目:DecompiledMinecraft    文件:EntityPlayerMP.java   
public void onUpdateEntity()
{
    try
    {
        super.onUpdate();

        for (int i = 0; i < this.inventory.getSizeInventory(); ++i)
        {
            ItemStack itemstack = this.inventory.getStackInSlot(i);

            if (itemstack != null && itemstack.getItem().isMap())
            {
                Packet packet = ((ItemMapBase)itemstack.getItem()).createMapDataPacket(itemstack, this.worldObj, this);

                if (packet != null)
                {
                    this.playerNetServerHandler.sendPacket(packet);
                }
            }
        }

        if (this.getHealth() != this.lastHealth || this.lastFoodLevel != this.foodStats.getFoodLevel() || this.foodStats.getSaturationLevel() == 0.0F != this.wasHungry)
        {
            this.playerNetServerHandler.sendPacket(new S06PacketUpdateHealth(this.getHealth(), this.foodStats.getFoodLevel(), this.foodStats.getSaturationLevel()));
            this.lastHealth = this.getHealth();
            this.lastFoodLevel = this.foodStats.getFoodLevel();
            this.wasHungry = this.foodStats.getSaturationLevel() == 0.0F;
        }

        if (this.getHealth() + this.getAbsorptionAmount() != this.combinedHealth)
        {
            this.combinedHealth = this.getHealth() + this.getAbsorptionAmount();

            for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.health))
            {
                this.getWorldScoreboard().getValueFromObjective(this.getName(), scoreobjective).func_96651_a(Arrays.<EntityPlayer>asList(new EntityPlayer[] {this}));
            }
        }

        if (this.experienceTotal != this.lastExperience)
        {
            this.lastExperience = this.experienceTotal;
            this.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(this.experience, this.experienceTotal, this.experienceLevel));
        }

        if (this.ticksExisted % 20 * 5 == 0 && !this.getStatFile().hasAchievementUnlocked(AchievementList.exploreAllBiomes))
        {
            this.updateBiomesExplored();
        }
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Ticking player");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("Player being ticked");
        this.addEntityCrashInfo(crashreportcategory);
        throw new ReportedException(crashreport);
    }
}
项目:DecompiledMinecraft    文件:NetHandlerPlayClient.java   
public void handleSetExperience(S1FPacketSetExperience packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    this.gameController.thePlayer.setXPStats(packetIn.func_149397_c(), packetIn.getTotalExperience(), packetIn.getLevel());
}
项目:BaseClient    文件:EntityPlayerMP.java   
public void onUpdateEntity()
{
    try
    {
        super.onUpdate();

        for (int i = 0; i < this.inventory.getSizeInventory(); ++i)
        {
            ItemStack itemstack = this.inventory.getStackInSlot(i);

            if (itemstack != null && itemstack.getItem().isMap())
            {
                Packet packet = ((ItemMapBase)itemstack.getItem()).createMapDataPacket(itemstack, this.worldObj, this);

                if (packet != null)
                {
                    this.playerNetServerHandler.sendPacket(packet);
                }
            }
        }

        if (this.getHealth() != this.lastHealth || this.lastFoodLevel != this.foodStats.getFoodLevel() || this.foodStats.getSaturationLevel() == 0.0F != this.wasHungry)
        {
            this.playerNetServerHandler.sendPacket(new S06PacketUpdateHealth(this.getHealth(), this.foodStats.getFoodLevel(), this.foodStats.getSaturationLevel()));
            this.lastHealth = this.getHealth();
            this.lastFoodLevel = this.foodStats.getFoodLevel();
            this.wasHungry = this.foodStats.getSaturationLevel() == 0.0F;
        }

        if (this.getHealth() + this.getAbsorptionAmount() != this.combinedHealth)
        {
            this.combinedHealth = this.getHealth() + this.getAbsorptionAmount();

            for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.health))
            {
                this.getWorldScoreboard().getValueFromObjective(this.getName(), scoreobjective).func_96651_a(Arrays.<EntityPlayer>asList(new EntityPlayer[] {this}));
            }
        }

        if (this.experienceTotal != this.lastExperience)
        {
            this.lastExperience = this.experienceTotal;
            this.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(this.experience, this.experienceTotal, this.experienceLevel));
        }

        if (this.ticksExisted % 20 * 5 == 0 && !this.getStatFile().hasAchievementUnlocked(AchievementList.exploreAllBiomes))
        {
            this.updateBiomesExplored();
        }
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Ticking player");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("Player being ticked");
        this.addEntityCrashInfo(crashreportcategory);
        throw new ReportedException(crashreport);
    }
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
public void handleSetExperience(S1FPacketSetExperience packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    this.gameController.thePlayer.setXPStats(packetIn.func_149397_c(), packetIn.getTotalExperience(), packetIn.getLevel());
}
项目:BaseClient    文件:EntityPlayerMP.java   
public void onUpdateEntity()
{
    try
    {
        super.onUpdate();

        for (int i = 0; i < this.inventory.getSizeInventory(); ++i)
        {
            ItemStack itemstack = this.inventory.getStackInSlot(i);

            if (itemstack != null && itemstack.getItem().isMap())
            {
                Packet packet = ((ItemMapBase)itemstack.getItem()).createMapDataPacket(itemstack, this.worldObj, this);

                if (packet != null)
                {
                    this.playerNetServerHandler.sendPacket(packet);
                }
            }
        }

        if (this.getHealth() != this.lastHealth || this.lastFoodLevel != this.foodStats.getFoodLevel() || this.foodStats.getSaturationLevel() == 0.0F != this.wasHungry)
        {
            this.playerNetServerHandler.sendPacket(new S06PacketUpdateHealth(this.getHealth(), this.foodStats.getFoodLevel(), this.foodStats.getSaturationLevel()));
            this.lastHealth = this.getHealth();
            this.lastFoodLevel = this.foodStats.getFoodLevel();
            this.wasHungry = this.foodStats.getSaturationLevel() == 0.0F;
        }

        if (this.getHealth() + this.getAbsorptionAmount() != this.combinedHealth)
        {
            this.combinedHealth = this.getHealth() + this.getAbsorptionAmount();

            for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.health))
            {
                this.getWorldScoreboard().getValueFromObjective(this.getName(), scoreobjective).func_96651_a(Arrays.<EntityPlayer>asList(new EntityPlayer[] {this}));
            }
        }

        if (this.experienceTotal != this.lastExperience)
        {
            this.lastExperience = this.experienceTotal;
            this.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(this.experience, this.experienceTotal, this.experienceLevel));
        }

        if (this.ticksExisted % 20 * 5 == 0 && !this.getStatFile().hasAchievementUnlocked(AchievementList.exploreAllBiomes))
        {
            this.updateBiomesExplored();
        }
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Ticking player");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("Player being ticked");
        this.addEntityCrashInfo(crashreportcategory);
        throw new ReportedException(crashreport);
    }
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
public void handleSetExperience(S1FPacketSetExperience packetIn) {
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    this.gameController.thePlayer.setXPStats(packetIn.func_149397_c(), packetIn.getTotalExperience(),
            packetIn.getLevel());
}
项目: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;
}
项目:Resilience-Client-Source    文件:EntityPlayerMP.java   
public void onUpdateEntity()
{
    try
    {
        super.onUpdate();

        for (int var1 = 0; var1 < this.inventory.getSizeInventory(); ++var1)
        {
            ItemStack var6 = this.inventory.getStackInSlot(var1);

            if (var6 != null && var6.getItem().isMap())
            {
                Packet var8 = ((ItemMapBase)var6.getItem()).func_150911_c(var6, this.worldObj, this);

                if (var8 != null)
                {
                    this.playerNetServerHandler.sendPacket(var8);
                }
            }
        }

        if (this.getHealth() != this.lastHealth || this.lastFoodLevel != this.foodStats.getFoodLevel() || this.foodStats.getSaturationLevel() == 0.0F != this.wasHungry)
        {
            this.playerNetServerHandler.sendPacket(new S06PacketUpdateHealth(this.getHealth(), this.foodStats.getFoodLevel(), this.foodStats.getSaturationLevel()));
            this.lastHealth = this.getHealth();
            this.lastFoodLevel = this.foodStats.getFoodLevel();
            this.wasHungry = this.foodStats.getSaturationLevel() == 0.0F;
        }

        if (this.getHealth() + this.getAbsorptionAmount() != this.field_130068_bO)
        {
            this.field_130068_bO = this.getHealth() + this.getAbsorptionAmount();
            Collection var5 = this.getWorldScoreboard().func_96520_a(IScoreObjectiveCriteria.health);
            Iterator var7 = var5.iterator();

            while (var7.hasNext())
            {
                ScoreObjective var9 = (ScoreObjective)var7.next();
                this.getWorldScoreboard().func_96529_a(this.getCommandSenderName(), var9).func_96651_a(Arrays.asList(new EntityPlayer[] {this}));
            }
        }

        if (this.experienceTotal != this.lastExperience)
        {
            this.lastExperience = this.experienceTotal;
            this.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(this.experience, this.experienceTotal, this.experienceLevel));
        }

        if (this.ticksExisted % 20 * 5 == 0 && !this.func_147099_x().hasAchievementUnlocked(AchievementList.field_150961_L))
        {
            this.func_147098_j();
        }
    }
    catch (Throwable var4)
    {
        CrashReport var2 = CrashReport.makeCrashReport(var4, "Ticking player");
        CrashReportCategory var3 = var2.makeCategory("Player being ticked");
        this.addEntityCrashInfo(var3);
        throw new ReportedException(var2);
    }
}
项目:Resilience-Client-Source    文件:NetHandlerPlayClient.java   
public void handleSetExperience(S1FPacketSetExperience p_147295_1_)
{
    this.gameController.thePlayer.setXPStats(p_147295_1_.func_149397_c(), p_147295_1_.func_149396_d(), p_147295_1_.func_149395_e());
}
项目:NeptuneMod    文件:NeptunePacketFactory.java   
@Override
public Packet setExperience(float bar, int level, int totalXp) {
    return (Packet) new S1FPacketSetExperience(bar, level, totalXp);
}
项目: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;
}
项目:Cauldron    文件:EntityPlayerMP.java   
public void onUpdateEntity()
{
    try
    {
        super.onUpdate();

        for (int i = 0; i < this.inventory.getSizeInventory(); ++i)
        {
            ItemStack itemstack = this.inventory.getStackInSlot(i);

            if (itemstack != null && itemstack.getItem().isMap())
            {
                Packet packet = ((ItemMapBase)itemstack.getItem()).func_150911_c(itemstack, this.worldObj, this);

                if (packet != null)
                {
                    this.playerNetServerHandler.sendPacket(packet);
                }
            }
        }

        // CraftBukkit - Optionally scale health
        if (this.getHealth() != this.lastHealth || this.lastFoodLevel != this.foodStats.getFoodLevel() || this.foodStats.getSaturationLevel() == 0.0F != this.wasHungry)
        {
            this.playerNetServerHandler.sendPacket(new S06PacketUpdateHealth(this.getBukkitEntity().getScaledHealth(), this.foodStats.getFoodLevel(), this.foodStats.getSaturationLevel()));
            this.lastHealth = this.getHealth();
            this.lastFoodLevel = this.foodStats.getFoodLevel();
            this.wasHungry = this.foodStats.getSaturationLevel() == 0.0F;
        }

        if (this.getHealth() + this.getAbsorptionAmount() != this.field_130068_bO)
        {
            this.field_130068_bO = this.getHealth() + this.getAbsorptionAmount();
            // CraftBukkit - Update ALL the scores!
            this.worldObj.getServer().getScoreboardManager().updateAllScoresForList(IScoreObjectiveCriteria.health, this.getCommandSenderName(), com.google.common.collect.ImmutableList.of(this));
        }

        // CraftBukkit start - Force max health updates
        if (this.maxHealthCache != this.getMaxHealth())
        {
            this.getBukkitEntity().updateScaledHealth();
        }

        // CraftBukkit end

        if (this.experienceTotal != this.lastExperience)
        {
            this.lastExperience = this.experienceTotal;
            this.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(this.experience, this.experienceTotal, this.experienceLevel));
        }

        if (this.ticksExisted % 20 * 5 == 0 && !this.func_147099_x().hasAchievementUnlocked(AchievementList.field_150961_L))
        {
            this.func_147098_j();
        }

        // CraftBukkit start
        if (this.oldLevel == -1)
        {
            this.oldLevel = this.experienceLevel;
        }

        if (this.oldLevel != this.experienceLevel)
        {
            CraftEventFactory.callPlayerLevelChangeEvent(this.worldObj.getServer().getPlayer((EntityPlayerMP) this), this.oldLevel, this.experienceLevel);
            this.oldLevel = this.experienceLevel;
        }

        // CraftBukkit end
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Ticking player");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("Player being ticked");
        this.addEntityCrashInfo(crashreportcategory);
        throw new ReportedException(crashreport);
    }
}
项目:Cauldron    文件:NetHandlerPlayClient.java   
public void handleSetExperience(S1FPacketSetExperience p_147295_1_)
{
    this.gameController.thePlayer.setXPStats(p_147295_1_.func_149397_c(), p_147295_1_.func_149396_d(), p_147295_1_.func_149395_e());
}
项目:Cauldron    文件:EntityPlayerMP.java   
public void onUpdateEntity()
{
    try
    {
        super.onUpdate();

        for (int i = 0; i < this.inventory.getSizeInventory(); ++i)
        {
            ItemStack itemstack = this.inventory.getStackInSlot(i);

            if (itemstack != null && itemstack.getItem().isMap())
            {
                Packet packet = ((ItemMapBase)itemstack.getItem()).func_150911_c(itemstack, this.worldObj, this);

                if (packet != null)
                {
                    this.playerNetServerHandler.sendPacket(packet);
                }
            }
        }

        if (this.getHealth() != this.lastHealth || this.lastFoodLevel != this.foodStats.getFoodLevel() || this.foodStats.getSaturationLevel() == 0.0F != this.wasHungry)
        {
            this.playerNetServerHandler.sendPacket(new S06PacketUpdateHealth(this.getHealth(), this.foodStats.getFoodLevel(), this.foodStats.getSaturationLevel()));
            this.lastHealth = this.getHealth();
            this.lastFoodLevel = this.foodStats.getFoodLevel();
            this.wasHungry = this.foodStats.getSaturationLevel() == 0.0F;
        }

        if (this.getHealth() + this.getAbsorptionAmount() != this.field_130068_bO)
        {
            this.field_130068_bO = this.getHealth() + this.getAbsorptionAmount();
            Collection collection = this.getWorldScoreboard().func_96520_a(IScoreObjectiveCriteria.health);
            Iterator iterator = collection.iterator();

            while (iterator.hasNext())
            {
                ScoreObjective scoreobjective = (ScoreObjective)iterator.next();
                this.getWorldScoreboard().func_96529_a(this.getCommandSenderName(), scoreobjective).func_96651_a(Arrays.asList(new EntityPlayer[] {this}));
            }
        }

        if (this.experienceTotal != this.lastExperience)
        {
            this.lastExperience = this.experienceTotal;
            this.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(this.experience, this.experienceTotal, this.experienceLevel));
        }

        if (this.ticksExisted % 20 * 5 == 0 && !this.func_147099_x().hasAchievementUnlocked(AchievementList.field_150961_L))
        {
            this.func_147098_j();
        }
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Ticking player");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("Player being ticked");
        this.addEntityCrashInfo(crashreportcategory);
        throw new ReportedException(crashreport);
    }
}
项目:Cauldron    文件:NetHandlerPlayClient.java   
public void handleSetExperience(S1FPacketSetExperience p_147295_1_)
{
    this.gameController.thePlayer.setXPStats(p_147295_1_.func_149397_c(), p_147295_1_.func_149396_d(), p_147295_1_.func_149395_e());
}
项目: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
}
项目:DecompiledMinecraft    文件:INetHandlerPlayClient.java   
void handleSetExperience(S1FPacketSetExperience packetIn);
项目:DecompiledMinecraft    文件:INetHandlerPlayClient.java   
void handleSetExperience(S1FPacketSetExperience packetIn);
项目:BaseClient    文件:INetHandlerPlayClient.java   
void handleSetExperience(S1FPacketSetExperience packetIn);
项目:BaseClient    文件:INetHandlerPlayClient.java   
void handleSetExperience(S1FPacketSetExperience packetIn);
项目:Resilience-Client-Source    文件:INetHandlerPlayClient.java   
void handleSetExperience(S1FPacketSetExperience var1);
项目:Cauldron    文件:INetHandlerPlayClient.java   
void handleSetExperience(S1FPacketSetExperience p_147295_1_);
项目:Cauldron    文件:INetHandlerPlayClient.java   
void handleSetExperience(S1FPacketSetExperience p_147295_1_);