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

项目:forge_world_downloader    文件:WDLNetClientHandler.java   
@Override
public void handleExperience(Packet43Experience par1Packet43Experience)
{
    nch.handleExperience(par1Packet43Experience);       
}
项目: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_72522_a(Packet43Experience p_72522_1_) {
   this.func_72509_a(p_72522_1_);
}
项目:RuneCraftery    文件:NetClientHandler.java   
public void func_72522_a(Packet43Experience p_72522_1_) {
   this.field_72563_h.field_71439_g.func_71152_a(p_72522_1_.field_73396_a, p_72522_1_.field_73394_b, p_72522_1_.field_73395_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);
    }
}
项目:RuneCraftery    文件:NetClientHandler.java   
/**
 * Handle an experience packet.
 */
public void handleExperience(Packet43Experience par1Packet43Experience)
{
    this.mc.thePlayer.setXPStats(par1Packet43Experience.experience, par1Packet43Experience.experienceTotal, par1Packet43Experience.experienceLevel);
}
项目: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);
    }
}
项目:BetterNutritionMod    文件:NetClientHandler.java   
/**
 * Handle an experience packet.
 */
public void handleExperience(Packet43Experience par1Packet43Experience)
{
    this.mc.thePlayer.setXPStats(par1Packet43Experience.experience, par1Packet43Experience.experienceTotal, par1Packet43Experience.experienceLevel);
}
项目:EnhancedBooks    文件:ServerPacketHandler.java   
private void handleExpBookGuiButtonPressed(int buttonPressed, EntityPlayer player) {
    if (player.isDead || player.capabilities.isCreativeMode) return;
    ItemStack item = player.inventory.getCurrentItem();
    if (buttonPressed == 1) {
        // Add one level to book
        if (player.experienceLevel >= 1 && item.getItemDamage() >= 1) {
            Utils.log("ServerPacketHandler: Added one level to book");
            item.damageItem(-1, player);
            player.experienceLevel -= 1;
        }
    }

    if (buttonPressed == 2) {
        while (player.experienceLevel >= 1 && item.getItemDamage() >= 1) {
            // Add all the player's xp! :D
            item.damageItem(-1, player);
            player.experienceLevel -= 1;
        }
        Utils.log("ServerPacketHandler: Added all levels to book");
    }

    // KK, subtracting now
    if (buttonPressed == -1) {
        // Subtract 1 level from book
        if (item.getItemDamage() < item.getMaxDamage()) {
            item.damageItem(1, player);
            player.experienceLevel += 1;
            Utils.log("ServerPacketHandler: Subtracted one level");
        }
    }
    if (buttonPressed == -2) {
        // Subtract all the XP from the book! :D
        while (item.getItemDamage() < item.getMaxDamage()) {
            item.damageItem(1, player);
            player.experienceLevel += 1;
        }
        Utils.log("ServerPacketHandler: Subtracted all levels");
    }
    // Send a packet back to the client to tell it to update XP
    PacketDispatcher.sendPacketToPlayer(new Packet43Experience(player.experience, player.experienceTotal, player.experienceLevel), (Player) player);
}