当前位置: 首页>>代码示例>>Java>>正文


Java ItemMapBase类代码示例

本文整理汇总了Java中net.minecraft.item.ItemMapBase的典型用法代码示例。如果您正苦于以下问题:Java ItemMapBase类的具体用法?Java ItemMapBase怎么用?Java ItemMapBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ItemMapBase类属于net.minecraft.item包,在下文中一共展示了ItemMapBase类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onUpdateEntity

import net.minecraft.item.ItemMapBase; //导入依赖的package包/类
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);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:59,代码来源:EntityPlayerMP.java

示例2: onUpdateEntity

import net.minecraft.item.ItemMapBase; //导入依赖的package包/类
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);
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:62,代码来源:EntityPlayerMP.java

示例3: onUpdateEntity

import net.minecraft.item.ItemMapBase; //导入依赖的package包/类
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);
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:79,代码来源:EntityPlayerMP.java

示例4: onUpdateEntity

import net.minecraft.item.ItemMapBase; //导入依赖的package包/类
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);
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:62,代码来源:EntityPlayerMP.java

示例5: func_71127_g

import net.minecraft.item.ItemMapBase; //导入依赖的package包/类
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);
   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:45,代码来源:EntityPlayerMP.java

示例6: onUpdateEntity

import net.minecraft.item.ItemMapBase; //导入依赖的package包/类
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);
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:57,代码来源:EntityPlayerMP.java


注:本文中的net.minecraft.item.ItemMapBase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。