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); } }
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); } }
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); } }
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); } }
public void func_71127_g() { try { super.func_70071_h_(); for(int var1 = 0; var1 < this.field_71071_by.func_70302_i_(); ++var1) { ItemStack var6 = this.field_71071_by.func_70301_a(var1); if(var6 != null && Item.field_77698_e[var6.field_77993_c].func_77643_m_() && this.field_71135_a.func_72568_e() <= 5) { Packet var8 = ((ItemMapBase)Item.field_77698_e[var6.field_77993_c]).func_77871_c(var6, this.field_70170_p, this); if(var8 != null) { this.field_71135_a.func_72567_b(var8); } } } if(this.func_110143_aJ() != this.field_71149_ch || this.field_71146_ci != this.field_71100_bB.func_75116_a() || this.field_71100_bB.func_75115_e() == 0.0F != this.field_71147_cj) { this.field_71135_a.func_72567_b(new Packet8UpdateHealth(this.func_110143_aJ(), this.field_71100_bB.func_75116_a(), this.field_71100_bB.func_75115_e())); this.field_71149_ch = this.func_110143_aJ(); this.field_71146_ci = this.field_71100_bB.func_75116_a(); this.field_71147_cj = this.field_71100_bB.func_75115_e() == 0.0F; } if(this.func_110143_aJ() + this.func_110139_bj() != this.field_130068_bO) { this.field_130068_bO = this.func_110143_aJ() + this.func_110139_bj(); Collection var5 = this.func_96123_co().func_96520_a(ScoreObjectiveCriteria.field_96638_f); Iterator var7 = var5.iterator(); while(var7.hasNext()) { ScoreObjective var9 = (ScoreObjective)var7.next(); this.func_96123_co().func_96529_a(this.func_70023_ak(), var9).func_96651_a(Arrays.asList(new EntityPlayer[]{this})); } } if(this.field_71067_cb != this.field_71144_ck) { this.field_71144_ck = this.field_71067_cb; this.field_71135_a.func_72567_b(new Packet43Experience(this.field_71106_cc, this.field_71067_cb, this.field_71068_ca)); } } catch (Throwable var4) { CrashReport var2 = CrashReport.func_85055_a(var4, "Ticking player"); CrashReportCategory var3 = var2.func_85058_a("Player being ticked"); this.func_85029_a(var3); throw new ReportedException(var2); } }
public void onUpdateEntity() { try { super.onUpdate(); for (int i = 0; i < this.inventory.getSizeInventory(); ++i) { ItemStack itemstack = this.inventory.getStackInSlot(i); if (itemstack != null && Item.itemsList[itemstack.itemID].isMap() && this.playerNetServerHandler.packetSize() <= 5) { Packet packet = ((ItemMapBase)Item.itemsList[itemstack.itemID]).createMapDataPacket(itemstack, this.worldObj, this); if (packet != null) { this.playerNetServerHandler.sendPacketToPlayer(packet); } } } if (this.getHealth() != this.lastHealth || this.lastFoodLevel != this.foodStats.getFoodLevel() || this.foodStats.getSaturationLevel() == 0.0F != this.wasHungry) { this.playerNetServerHandler.sendPacketToPlayer(new Packet8UpdateHealth(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(ScoreObjectiveCriteria.health); Iterator iterator = collection.iterator(); while (iterator.hasNext()) { ScoreObjective scoreobjective = (ScoreObjective)iterator.next(); this.getWorldScoreboard().func_96529_a(this.getEntityName(), scoreobjective).func_96651_a(Arrays.asList(new EntityPlayer[] {this})); } } if (this.experienceTotal != this.lastExperience) { this.lastExperience = this.experienceTotal; this.playerNetServerHandler.sendPacketToPlayer(new Packet43Experience(this.experience, this.experienceTotal, this.experienceLevel)); } } catch (Throwable throwable) { CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Ticking player"); CrashReportCategory crashreportcategory = crashreport.makeCategory("Player being ticked"); this.addEntityCrashInfo(crashreportcategory); throw new ReportedException(crashreport); } }