Java 类net.minecraft.entity.ai.attributes.AttributeInstance 实例源码

项目:RuneCraftery    文件:EntityAnimal.java   
public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) {
   if(this.func_85032_ar()) {
      return false;
   } else {
      this.field_70788_c = 60;
      if(!this.func_70650_aV()) {
         AttributeInstance var3 = this.func_110148_a(SharedMonsterAttributes.field_111263_d);
         if(var3.func_111127_a(field_110179_h) == null) {
            var3.func_111121_a(field_110181_i);
         }
      }

      this.field_70789_a = null;
      this.field_70881_d = 0;
      return super.func_70097_a(p_70097_1_, p_70097_2_);
   }
}
项目:RuneCraftery    文件:EntityPigZombie.java   
public void func_70071_h_() {
   if(this.field_110191_bu != this.field_70789_a && !this.field_70170_p.field_72995_K) {
      AttributeInstance var1 = this.func_110148_a(SharedMonsterAttributes.field_111263_d);
      var1.func_111124_b(field_110190_br);
      if(this.field_70789_a != null) {
         var1.func_111121_a(field_110190_br);
      }
   }

   this.field_110191_bu = this.field_70789_a;
   if(this.field_70838_e > 0 && --this.field_70838_e == 0) {
      this.func_85030_a("mob.zombiepig.zpigangry", this.func_70599_aP() * 2.0F, ((this.field_70146_Z.nextFloat() - this.field_70146_Z.nextFloat()) * 0.2F + 1.0F) * 1.8F);
   }

   super.func_70071_h_();
}
项目:RuneCraftery    文件:SharedMonsterAttributes.java   
private static NBTTagCompound func_111261_a(AttributeInstance p_111261_0_) {
   NBTTagCompound var1 = new NBTTagCompound();
   Attribute var2 = p_111261_0_.func_111123_a();
   var1.func_74778_a("Name", var2.func_111108_a());
   var1.func_74780_a("Base", p_111261_0_.func_111125_b());
   Collection var3 = p_111261_0_.func_111122_c();
   if(var3 != null && !var3.isEmpty()) {
      NBTTagList var4 = new NBTTagList();
      Iterator var5 = var3.iterator();

      while(var5.hasNext()) {
         AttributeModifier var6 = (AttributeModifier)var5.next();
         if(var6.func_111165_e()) {
            var4.func_74742_a(func_111262_a(var6));
         }
      }

      var1.func_74782_a("Modifiers", var4);
   }

   return var1;
}
项目:RuneCraftery    文件:SharedMonsterAttributes.java   
private static void func_111258_a(AttributeInstance p_111258_0_, NBTTagCompound p_111258_1_) {
   p_111258_0_.func_111128_a(p_111258_1_.func_74769_h("Base"));
   if(p_111258_1_.func_74764_b("Modifiers")) {
      NBTTagList var2 = p_111258_1_.func_74761_m("Modifiers");

      for(int var3 = 0; var3 < var2.func_74745_c(); ++var3) {
         AttributeModifier var4 = func_111259_a((NBTTagCompound)var2.func_74743_b(var3));
         AttributeModifier var5 = p_111258_0_.func_111127_a(var4.func_111167_a());
         if(var5 != null) {
            p_111258_0_.func_111124_b(var5);
         }

         p_111258_0_.func_111121_a(var4);
      }
   }

}
项目:RuneCraftery    文件:EntityPlayerSP.java   
public float func_71151_f() {
   float var1 = 1.0F;
   if(this.field_71075_bZ.field_75100_b) {
      var1 *= 1.1F;
   }

   AttributeInstance var2 = this.func_110148_a(SharedMonsterAttributes.field_111263_d);
   var1 = (float)((double)var1 * ((var2.func_111126_e() / (double)this.field_71075_bZ.func_75094_b() + 1.0D) / 2.0D));
   if(this.func_71039_bw() && this.func_71011_bu().field_77993_c == Item.field_77707_k.field_77779_bT) {
      int var3 = this.func_71057_bx();
      float var4 = (float)var3 / 20.0F;
      if(var4 > 1.0F) {
         var4 = 1.0F;
      } else {
         var4 *= var4;
      }

      var1 *= 1.0F - var4 * 0.15F;
   }

   return var1;
}
项目:RuneCraftery    文件:EntityLivingBase.java   
/**
 * Set sprinting switch for Entity.
 */
public void setSprinting(boolean par1)
{
    super.setSprinting(par1);
    AttributeInstance attributeinstance = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed);

    if (attributeinstance.getModifier(sprintingSpeedBoostModifierUUID) != null)
    {
        attributeinstance.removeModifier(sprintingSpeedBoostModifier);
    }

    if (par1)
    {
        attributeinstance.applyModifier(sprintingSpeedBoostModifier);
    }
}
项目:RuneCraftery    文件:EntityAnimal.java   
/**
 * Called when the entity is attacked.
 */
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
{
    if (this.isEntityInvulnerable())
    {
        return false;
    }
    else
    {
        this.fleeingTick = 60;

        if (!this.isAIEnabled())
        {
            AttributeInstance attributeinstance = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed);

            if (attributeinstance.getModifier(field_110179_h) == null)
            {
                attributeinstance.applyModifier(field_110181_i);
            }
        }

        this.entityToAttack = null;
        this.inLove = 0;
        return super.attackEntityFrom(par1DamageSource, par2);
    }
}
项目:RuneCraftery    文件:EntityPigZombie.java   
/**
 * Called to update the entity's position/logic.
 */
public void onUpdate()
{
    if (this.field_110191_bu != this.entityToAttack && !this.worldObj.isRemote)
    {
        AttributeInstance attributeinstance = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
        attributeinstance.removeModifier(field_110190_br);

        if (this.entityToAttack != null)
        {
            attributeinstance.applyModifier(field_110190_br);
        }
    }

    this.field_110191_bu = this.entityToAttack;

    if (this.randomSoundDelay > 0 && --this.randomSoundDelay == 0)
    {
        this.playSound("mob.zombiepig.zpigangry", this.getSoundVolume() * 2.0F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) * 1.8F);
    }

    super.onUpdate();
}
项目:RuneCraftery    文件:EntityZombie.java   
/**
 * Set whether this zombie is a child.
 */
public void setChild(boolean par1)
{
    this.getDataWatcher().updateObject(12, Byte.valueOf((byte)(par1 ? 1 : 0)));

    if (this.worldObj != null && !this.worldObj.isRemote)
    {
        AttributeInstance attributeinstance = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
        attributeinstance.removeModifier(babySpeedBoostModifier);

        if (par1)
        {
            attributeinstance.applyModifier(babySpeedBoostModifier);
        }
    }
}
项目:RuneCraftery    文件:SharedMonsterAttributes.java   
public static void func_111260_a(BaseAttributeMap par0BaseAttributeMap, NBTTagList par1NBTTagList, ILogAgent par2ILogAgent)
{
    for (int i = 0; i < par1NBTTagList.tagCount(); ++i)
    {
        NBTTagCompound nbttagcompound = (NBTTagCompound)par1NBTTagList.tagAt(i);
        AttributeInstance attributeinstance = par0BaseAttributeMap.getAttributeInstanceByName(nbttagcompound.getString("Name"));

        if (attributeinstance != null)
        {
            func_111258_a(attributeinstance, nbttagcompound);
        }
        else if (par2ILogAgent != null)
        {
            par2ILogAgent.logWarning("Ignoring unknown attribute \'" + nbttagcompound.getString("Name") + "\'");
        }
    }
}
项目:RuneCraftery    文件:SharedMonsterAttributes.java   
private static void func_111258_a(AttributeInstance par0AttributeInstance, NBTTagCompound par1NBTTagCompound)
{
    par0AttributeInstance.setAttribute(par1NBTTagCompound.getDouble("Base"));

    if (par1NBTTagCompound.hasKey("Modifiers"))
    {
        NBTTagList nbttaglist = par1NBTTagCompound.getTagList("Modifiers");

        for (int i = 0; i < nbttaglist.tagCount(); ++i)
        {
            AttributeModifier attributemodifier = func_111259_a((NBTTagCompound)nbttaglist.tagAt(i));
            AttributeModifier attributemodifier1 = par0AttributeInstance.getModifier(attributemodifier.getID());

            if (attributemodifier1 != null)
            {
                par0AttributeInstance.removeModifier(attributemodifier1);
            }

            par0AttributeInstance.applyModifier(attributemodifier);
        }
    }
}
项目:RuneCraftery    文件:Potion.java   
public void applyAttributesModifiersToEntity(EntityLivingBase par1EntityLivingBase, BaseAttributeMap par2BaseAttributeMap, int par3)
{
    Iterator iterator = this.field_111188_I.entrySet().iterator();

    while (iterator.hasNext())
    {
        Entry entry = (Entry)iterator.next();
        AttributeInstance attributeinstance = par2BaseAttributeMap.getAttributeInstance((Attribute)entry.getKey());

        if (attributeinstance != null)
        {
            AttributeModifier attributemodifier = (AttributeModifier)entry.getValue();
            attributeinstance.removeModifier(attributemodifier);
            attributeinstance.applyModifier(new AttributeModifier(attributemodifier.getID(), this.getName() + " " + par3, this.func_111183_a(par3, attributemodifier), attributemodifier.getOperation()));
        }
    }
}
项目:Dota2Items    文件:BaseStatsUpdater.java   
private void updateMoveSpeed(EntityLivingBase entity, EntityStats stats) {
    AttributeInstance moveSpeedAttribute = entity.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
    double newMoveSpeed = stats.getMovementSpeed();
    double oldMoveSpeed = moveSpeedAttribute.getAttributeValue();
    if (newMoveSpeed != oldMoveSpeed) {
        double baseMoveSpeed = moveSpeedAttribute.getBaseValue();
        // Get the modifier:
        AttributeModifier speedModifier = moveSpeedAttribute.getModifier(uuid);
        if (speedModifier != null) {
            // Remove the old modifier
            moveSpeedAttribute.removeModifier(speedModifier);
        }
        // I think the argument "2" stands for operation "add percentage":
        speedModifier = new AttributeModifier(uuid, "Speed bonus from Dota 2 Items", newMoveSpeed / baseMoveSpeed - 1.0, 2)
            .setSaved(false); // I think this makes it non-persistent
        moveSpeedAttribute.applyModifier(speedModifier);
    }
}
项目:BetterNutritionMod    文件:EntityLivingBase.java   
/**
 * Set sprinting switch for Entity.
 */
public void setSprinting(boolean par1)
{
    super.setSprinting(par1);
    AttributeInstance attributeinstance = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed);

    if (attributeinstance.getModifier(sprintingSpeedBoostModifierUUID) != null)
    {
        attributeinstance.removeModifier(sprintingSpeedBoostModifier);
    }

    if (par1)
    {
        attributeinstance.applyModifier(sprintingSpeedBoostModifier);
    }
}
项目:BetterNutritionMod    文件:EntityAnimal.java   
/**
 * Called when the entity is attacked.
 */
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
{
    if (this.isEntityInvulnerable())
    {
        return false;
    }
    else
    {
        this.fleeingTick = 60;

        if (!this.isAIEnabled())
        {
            AttributeInstance attributeinstance = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed);

            if (attributeinstance.getModifier(field_110179_h) == null)
            {
                attributeinstance.applyModifier(field_110181_i);
            }
        }

        this.entityToAttack = null;
        this.inLove = 0;
        return super.attackEntityFrom(par1DamageSource, par2);
    }
}
项目:BetterNutritionMod    文件:EntityPigZombie.java   
/**
 * Called to update the entity's position/logic.
 */
public void onUpdate()
{
    if (this.field_110191_bu != this.entityToAttack && !this.worldObj.isRemote)
    {
        AttributeInstance attributeinstance = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
        attributeinstance.removeModifier(field_110190_br);

        if (this.entityToAttack != null)
        {
            attributeinstance.applyModifier(field_110190_br);
        }
    }

    this.field_110191_bu = this.entityToAttack;

    if (this.randomSoundDelay > 0 && --this.randomSoundDelay == 0)
    {
        this.playSound("mob.zombiepig.zpigangry", this.getSoundVolume() * 2.0F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) * 1.8F);
    }

    super.onUpdate();
}
项目:BetterNutritionMod    文件:EntityZombie.java   
/**
 * Set whether this zombie is a child.
 */
public void setChild(boolean par1)
{
    this.getDataWatcher().updateObject(12, Byte.valueOf((byte)(par1 ? 1 : 0)));

    if (this.worldObj != null && !this.worldObj.isRemote)
    {
        AttributeInstance attributeinstance = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
        attributeinstance.removeModifier(babySpeedBoostModifier);

        if (par1)
        {
            attributeinstance.applyModifier(babySpeedBoostModifier);
        }
    }
}
项目:BetterNutritionMod    文件:SharedMonsterAttributes.java   
public static void func_111260_a(BaseAttributeMap par0BaseAttributeMap, NBTTagList par1NBTTagList, ILogAgent par2ILogAgent)
{
    for (int i = 0; i < par1NBTTagList.tagCount(); ++i)
    {
        NBTTagCompound nbttagcompound = (NBTTagCompound)par1NBTTagList.tagAt(i);
        AttributeInstance attributeinstance = par0BaseAttributeMap.getAttributeInstanceByName(nbttagcompound.getString("Name"));

        if (attributeinstance != null)
        {
            func_111258_a(attributeinstance, nbttagcompound);
        }
        else if (par2ILogAgent != null)
        {
            par2ILogAgent.logWarning("Ignoring unknown attribute \'" + nbttagcompound.getString("Name") + "\'");
        }
    }
}
项目:BetterNutritionMod    文件:SharedMonsterAttributes.java   
private static void func_111258_a(AttributeInstance par0AttributeInstance, NBTTagCompound par1NBTTagCompound)
{
    par0AttributeInstance.setAttribute(par1NBTTagCompound.getDouble("Base"));

    if (par1NBTTagCompound.hasKey("Modifiers"))
    {
        NBTTagList nbttaglist = par1NBTTagCompound.getTagList("Modifiers");

        for (int i = 0; i < nbttaglist.tagCount(); ++i)
        {
            AttributeModifier attributemodifier = func_111259_a((NBTTagCompound)nbttaglist.tagAt(i));
            AttributeModifier attributemodifier1 = par0AttributeInstance.getModifier(attributemodifier.getID());

            if (attributemodifier1 != null)
            {
                par0AttributeInstance.removeModifier(attributemodifier1);
            }

            par0AttributeInstance.applyModifier(attributemodifier);
        }
    }
}
项目:BetterNutritionMod    文件:Potion.java   
public void applyAttributesModifiersToEntity(EntityLivingBase par1EntityLivingBase, BaseAttributeMap par2BaseAttributeMap, int par3)
{
    Iterator iterator = this.field_111188_I.entrySet().iterator();

    while (iterator.hasNext())
    {
        Entry entry = (Entry)iterator.next();
        AttributeInstance attributeinstance = par2BaseAttributeMap.getAttributeInstance((Attribute)entry.getKey());

        if (attributeinstance != null)
        {
            AttributeModifier attributemodifier = (AttributeModifier)entry.getValue();
            attributeinstance.removeModifier(attributemodifier);
            attributeinstance.applyModifier(new AttributeModifier(attributemodifier.getID(), this.getName() + " " + par3, this.func_111183_a(par3, attributemodifier), attributemodifier.getOperation()));
        }
    }
}
项目:Modjam-3    文件:EntitySwarmZombie.java   
/**
 * Set whether this zombie is a child.
 */
public void setChild(boolean par1)
{
    this.getDataWatcher().updateObject(12, Byte.valueOf((byte) (par1 ? 1 : 0)));

    if (this.worldObj != null && !this.worldObj.isRemote)
    {
        AttributeInstance attributeinstance = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
        attributeinstance.removeModifier(babySpeedBoostModifier);

        if (par1)
        {
            attributeinstance.applyModifier(babySpeedBoostModifier);
        }
    }
}
项目:RuneCraftery    文件:BaseAttributeMap.java   
public void func_111148_a(Multimap p_111148_1_) {
   Iterator var2 = p_111148_1_.entries().iterator();

   while(var2.hasNext()) {
      Entry var3 = (Entry)var2.next();
      AttributeInstance var4 = this.func_111152_a((String)var3.getKey());
      if(var4 != null) {
         var4.func_111124_b((AttributeModifier)var3.getValue());
      }
   }

}
项目:RuneCraftery    文件:BaseAttributeMap.java   
public void func_111147_b(Multimap p_111147_1_) {
   Iterator var2 = p_111147_1_.entries().iterator();

   while(var2.hasNext()) {
      Entry var3 = (Entry)var2.next();
      AttributeInstance var4 = this.func_111152_a((String)var3.getKey());
      if(var4 != null) {
         var4.func_111124_b((AttributeModifier)var3.getValue());
         var4.func_111121_a((AttributeModifier)var3.getValue());
      }
   }

}
项目:RuneCraftery    文件:ServersideAttributeMap.java   
public AttributeInstance func_111150_b(Attribute p_111150_1_) {
   if(this.field_111153_b.containsKey(p_111150_1_.func_111108_a())) {
      throw new IllegalArgumentException("Attribute is already registered!");
   } else {
      ModifiableAttributeInstance var2 = new ModifiableAttributeInstance(this, p_111150_1_);
      this.field_111153_b.put(p_111150_1_.func_111108_a(), var2);
      if(p_111150_1_ instanceof RangedAttribute && ((RangedAttribute)p_111150_1_).func_111116_f() != null) {
         this.field_111163_c.put(((RangedAttribute)p_111150_1_).func_111116_f(), var2);
      }

      this.field_111154_a.put(p_111150_1_, var2);
      return var2;
   }
}
项目:RuneCraftery    文件:ServersideAttributeMap.java   
public Collection func_111160_c() {
   HashSet var1 = Sets.newHashSet();
   Iterator var2 = this.func_111146_a().iterator();

   while(var2.hasNext()) {
      AttributeInstance var3 = (AttributeInstance)var2.next();
      if(var3.func_111123_a().func_111111_c()) {
         var1.add(var3);
      }
   }

   return var1;
}
项目:RuneCraftery    文件:EntityLivingBase.java   
public void func_70031_b(boolean p_70031_1_) {
   super.func_70031_b(p_70031_1_);
   AttributeInstance var2 = this.func_110148_a(SharedMonsterAttributes.field_111263_d);
   if(var2.func_111127_a(field_110156_b) != null) {
      var2.func_111124_b(field_110157_c);
   }

   if(p_70031_1_) {
      var2.func_111121_a(field_110157_c);
   }

}
项目:RuneCraftery    文件:EntityZombie.java   
public void func_82227_f(boolean p_82227_1_) {
   this.func_70096_w().func_75692_b(12, Byte.valueOf((byte)(p_82227_1_?1:0)));
   if(this.field_70170_p != null && !this.field_70170_p.field_72995_K) {
      AttributeInstance var2 = this.func_110148_a(SharedMonsterAttributes.field_111263_d);
      var2.func_111124_b(field_110188_br);
      if(p_82227_1_) {
         var2.func_111121_a(field_110188_br);
      }
   }

}
项目:RuneCraftery    文件:SharedMonsterAttributes.java   
public static NBTTagList func_111257_a(BaseAttributeMap p_111257_0_) {
   NBTTagList var1 = new NBTTagList();
   Iterator var2 = p_111257_0_.func_111146_a().iterator();

   while(var2.hasNext()) {
      AttributeInstance var3 = (AttributeInstance)var2.next();
      var1.func_74742_a(func_111261_a(var3));
   }

   return var1;
}
项目:RuneCraftery    文件:SharedMonsterAttributes.java   
public static void func_111260_a(BaseAttributeMap p_111260_0_, NBTTagList p_111260_1_, ILogAgent p_111260_2_) {
   for(int var3 = 0; var3 < p_111260_1_.func_74745_c(); ++var3) {
      NBTTagCompound var4 = (NBTTagCompound)p_111260_1_.func_74743_b(var3);
      AttributeInstance var5 = p_111260_0_.func_111152_a(var4.func_74779_i("Name"));
      if(var5 != null) {
         func_111258_a(var5, var4);
      } else if(p_111260_2_ != null) {
         p_111260_2_.func_98236_b("Ignoring unknown attribute \'" + var4.func_74779_i("Name") + "\'");
      }
   }

}
项目:RuneCraftery    文件:Packet44UpdateAttributes.java   
public Packet44UpdateAttributes(int p_i1486_1_, Collection p_i1486_2_) {
   this.field_111005_a = p_i1486_1_;
   Iterator var3 = p_i1486_2_.iterator();

   while(var3.hasNext()) {
      AttributeInstance var4 = (AttributeInstance)var3.next();
      this.field_111004_b.add(new Packet44UpdateAttributesSnapshot(this, var4.func_111123_a().func_111108_a(), var4.func_111125_b(), var4.func_111122_c()));
   }

}
项目:RuneCraftery    文件:NetClientHandler.java   
public void func_110773_a(Packet44UpdateAttributes p_110773_1_) {
   Entity var2 = this.func_72545_a(p_110773_1_.func_111002_d());
   if(var2 != null) {
      if(!(var2 instanceof EntityLivingBase)) {
         throw new IllegalStateException("Server tried to update attributes of a non-living entity (actually: " + var2 + ")");
      } else {
         BaseAttributeMap var3 = ((EntityLivingBase)var2).func_110140_aT();
         Iterator var4 = p_110773_1_.func_111003_f().iterator();

         while(var4.hasNext()) {
            Packet44UpdateAttributesSnapshot var5 = (Packet44UpdateAttributesSnapshot)var4.next();
            AttributeInstance var6 = var3.func_111152_a(var5.func_142040_a());
            if(var6 == null) {
               var6 = var3.func_111150_b(new RangedAttribute(var5.func_142040_a(), 0.0D, 2.2250738585072014E-308D, Double.MAX_VALUE));
            }

            var6.func_111128_a(var5.func_142041_b());
            var6.func_142049_d();
            Iterator var7 = var5.func_142039_c().iterator();

            while(var7.hasNext()) {
               AttributeModifier var8 = (AttributeModifier)var7.next();
               var6.func_111121_a(var8);
            }
         }

      }
   }
}
项目:RuneCraftery    文件:Potion.java   
public void func_111187_a(EntityLivingBase p_111187_1_, BaseAttributeMap p_111187_2_, int p_111187_3_) {
   Iterator var4 = this.field_111188_I.entrySet().iterator();

   while(var4.hasNext()) {
      Entry var5 = (Entry)var4.next();
      AttributeInstance var6 = p_111187_2_.func_111151_a((Attribute)var5.getKey());
      if(var6 != null) {
         var6.func_111124_b((AttributeModifier)var5.getValue());
      }
   }

}
项目:RuneCraftery    文件:Potion.java   
public void func_111185_a(EntityLivingBase p_111185_1_, BaseAttributeMap p_111185_2_, int p_111185_3_) {
   Iterator var4 = this.field_111188_I.entrySet().iterator();

   while(var4.hasNext()) {
      Entry var5 = (Entry)var4.next();
      AttributeInstance var6 = p_111185_2_.func_111151_a((Attribute)var5.getKey());
      if(var6 != null) {
         AttributeModifier var7 = (AttributeModifier)var5.getValue();
         var6.func_111124_b(var7);
         var6.func_111121_a(new AttributeModifier(var7.func_111167_a(), this.func_76393_a() + " " + p_111185_3_, this.func_111183_a(p_111185_3_, var7), var7.func_111169_c()));
      }
   }

}
项目:RuneCraftery    文件:SharedMonsterAttributes.java   
public static NBTTagList func_111257_a(BaseAttributeMap par0BaseAttributeMap)
{
    NBTTagList nbttaglist = new NBTTagList();
    Iterator iterator = par0BaseAttributeMap.getAllAttributes().iterator();

    while (iterator.hasNext())
    {
        AttributeInstance attributeinstance = (AttributeInstance)iterator.next();
        nbttaglist.appendTag(func_111261_a(attributeinstance));
    }

    return nbttaglist;
}
项目:RuneCraftery    文件:SharedMonsterAttributes.java   
private static NBTTagCompound func_111261_a(AttributeInstance par0AttributeInstance)
{
    NBTTagCompound nbttagcompound = new NBTTagCompound();
    Attribute attribute = par0AttributeInstance.func_111123_a();
    nbttagcompound.setString("Name", attribute.getAttributeUnlocalizedName());
    nbttagcompound.setDouble("Base", par0AttributeInstance.getBaseValue());
    Collection collection = par0AttributeInstance.func_111122_c();

    if (collection != null && !collection.isEmpty())
    {
        NBTTagList nbttaglist = new NBTTagList();
        Iterator iterator = collection.iterator();

        while (iterator.hasNext())
        {
            AttributeModifier attributemodifier = (AttributeModifier)iterator.next();

            if (attributemodifier.isSaved())
            {
                nbttaglist.appendTag(func_111262_a(attributemodifier));
            }
        }

        nbttagcompound.setTag("Modifiers", nbttaglist);
    }

    return nbttagcompound;
}
项目:RuneCraftery    文件:Packet44UpdateAttributes.java   
public Packet44UpdateAttributes(int par1, Collection par2Collection)
{
    this.field_111005_a = par1;
    Iterator iterator = par2Collection.iterator();

    while (iterator.hasNext())
    {
        AttributeInstance attributeinstance = (AttributeInstance)iterator.next();
        this.field_111004_b.add(new Packet44UpdateAttributesSnapshot(this, attributeinstance.func_111123_a().getAttributeUnlocalizedName(), attributeinstance.getBaseValue(), attributeinstance.func_111122_c()));
    }
}
项目:RuneCraftery    文件:EntityPlayerSP.java   
/**
 * Gets the player's field of view multiplier. (ex. when flying)
 */
public float getFOVMultiplier()
{
    float f = 1.0F;

    if (this.capabilities.isFlying)
    {
        f *= 1.1F;
    }

    AttributeInstance attributeinstance = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
    f = (float)((double)f * ((attributeinstance.getAttributeValue() / (double)this.capabilities.getWalkSpeed() + 1.0D) / 2.0D));

    if (this.isUsingItem() && this.getItemInUse().itemID == Item.bow.itemID)
    {
        int i = this.getItemInUseDuration();
        float f1 = (float)i / 20.0F;

        if (f1 > 1.0F)
        {
            f1 = 1.0F;
        }
        else
        {
            f1 *= f1;
        }

        f *= 1.0F - f1 * 0.15F;
    }

    return ForgeHooksClient.getOffsetFOV(this, f);
}
项目:RuneCraftery    文件:NetClientHandler.java   
public void func_110773_a(Packet44UpdateAttributes par1Packet44UpdateAttributes)
{
    Entity entity = this.getEntityByID(par1Packet44UpdateAttributes.func_111002_d());

    if (entity != null)
    {
        if (!(entity instanceof EntityLivingBase))
        {
            throw new IllegalStateException("Server tried to update attributes of a non-living entity (actually: " + entity + ")");
        }
        else
        {
            BaseAttributeMap baseattributemap = ((EntityLivingBase)entity).getAttributeMap();
            Iterator iterator = par1Packet44UpdateAttributes.func_111003_f().iterator();

            while (iterator.hasNext())
            {
                Packet44UpdateAttributesSnapshot packet44updateattributessnapshot = (Packet44UpdateAttributesSnapshot)iterator.next();
                AttributeInstance attributeinstance = baseattributemap.getAttributeInstanceByName(packet44updateattributessnapshot.func_142040_a());

                if (attributeinstance == null)
                {
                    attributeinstance = baseattributemap.func_111150_b(new RangedAttribute(packet44updateattributessnapshot.func_142040_a(), 0.0D, 2.2250738585072014E-308D, Double.MAX_VALUE));
                }

                attributeinstance.setAttribute(packet44updateattributessnapshot.func_142041_b());
                attributeinstance.func_142049_d();
                Iterator iterator1 = packet44updateattributessnapshot.func_142039_c().iterator();

                while (iterator1.hasNext())
                {
                    AttributeModifier attributemodifier = (AttributeModifier)iterator1.next();
                    attributeinstance.applyModifier(attributemodifier);
                }
            }
        }
    }
}
项目:RuneCraftery    文件:Potion.java   
public void removeAttributesModifiersFromEntity(EntityLivingBase par1EntityLivingBase, BaseAttributeMap par2BaseAttributeMap, int par3)
{
    Iterator iterator = this.field_111188_I.entrySet().iterator();

    while (iterator.hasNext())
    {
        Entry entry = (Entry)iterator.next();
        AttributeInstance attributeinstance = par2BaseAttributeMap.getAttributeInstance((Attribute)entry.getKey());

        if (attributeinstance != null)
        {
            attributeinstance.removeModifier((AttributeModifier)entry.getValue());
        }
    }
}
项目:Dota2Items    文件:PhaseBoots.java   
public static void addKnockbackResistance(EntityLivingBase entity) {
    AttributeInstance attr = entity.getEntityAttribute(SharedMonsterAttributes.knockbackResistance);
    // Get the modifier:
    AttributeModifier modifier = attr.getModifier(uuid);
    if (modifier != null) {
        return;
    }
    // I think the argument "0" stands for operation "add amount":
    modifier = new AttributeModifier(uuid, "Speed bonus from Dota 2 Items", 1, 0)
        .setSaved(false); // I think this makes it non-persistent
    attr.applyModifier(modifier);
}