Java 类net.minecraft.network.packet.Packet8UpdateHealth 实例源码

项目:RuneCraftery    文件:NetClientHandler.java   
/**
 * Recieves player health from the server and then proceeds to set it locally on the client.
 */
public void handleUpdateHealth(Packet8UpdateHealth par1Packet8UpdateHealth)
{
    this.mc.thePlayer.setPlayerSPHealth(par1Packet8UpdateHealth.healthMP);
    this.mc.thePlayer.getFoodStats().setFoodLevel(par1Packet8UpdateHealth.food);
    this.mc.thePlayer.getFoodStats().setFoodSaturationLevel(par1Packet8UpdateHealth.foodSaturation);
}
项目:BetterNutritionMod    文件:NetClientHandler.java   
/**
 * Recieves player health from the server and then proceeds to set it locally on the client.
 */
public void handleUpdateHealth(Packet8UpdateHealth par1Packet8UpdateHealth)
{
    this.mc.thePlayer.setPlayerSPHealth(par1Packet8UpdateHealth.healthMP);
    this.mc.thePlayer.getFoodStats().setFoodLevel(par1Packet8UpdateHealth.food);
    this.mc.thePlayer.getFoodStats().setFoodSaturationLevel(par1Packet8UpdateHealth.foodSaturation);
}
项目:forge_world_downloader    文件:WDLNetClientHandler.java   
@Override
public void handleUpdateHealth(Packet8UpdateHealth par1Packet8UpdateHealth)
{
    nch.handleUpdateHealth(par1Packet8UpdateHealth);        
}
项目:RuneCraftery    文件:EntityPlayerMP.java   
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);
   }
}
项目:RuneCraftery    文件:NetHandler.java   
public void func_72521_a(Packet8UpdateHealth p_72521_1_) {
   this.func_72509_a(p_72521_1_);
}
项目:RuneCraftery    文件:NetClientHandler.java   
public void func_72521_a(Packet8UpdateHealth p_72521_1_) {
   this.field_72563_h.field_71439_g.func_71150_b(p_72521_1_.field_73640_a);
   this.field_72563_h.field_71439_g.func_71024_bL().func_75114_a(p_72521_1_.field_73638_b);
   this.field_72563_h.field_71439_g.func_71024_bL().func_75119_b(p_72521_1_.field_73639_c);
}
项目:RuneCraftery    文件: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 && 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);
    }
}
项目:BetterNutritionMod    文件: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 && 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);
    }
}