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

项目: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    文件: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()));
        }
    }
}
项目: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()));
        }
    }
}
项目:RuneCraftery    文件:ModifiableAttributeInstance.java   
public ModifiableAttributeInstance(BaseAttributeMap p_i1608_1_, Attribute p_i1608_2_) {
   this.field_111138_a = p_i1608_1_;
   this.field_111136_b = p_i1608_2_;
   this.field_111132_f = p_i1608_2_.func_111110_b();

   for(int var3 = 0; var3 < 3; ++var3) {
      this.field_111137_c.put(Integer.valueOf(var3), new HashSet());
   }

}
项目: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    文件: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   
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    文件: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());
        }
    }
}
项目:BetterNutritionMod    文件: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;
}
项目:BetterNutritionMod    文件: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());
        }
    }
}
项目:RuneCraftery    文件:ModifiableAttributeInstance.java   
public Attribute func_111123_a() {
   return this.field_111136_b;
}
项目:RuneCraftery    文件:BaseAttributeMap.java   
public AttributeInstance func_111151_a(Attribute p_111151_1_) {
   return (AttributeInstance)this.field_111154_a.get(p_111151_1_);
}
项目:RuneCraftery    文件:ServersideAttributeMap.java   
public ModifiableAttributeInstance func_111159_c(Attribute p_111159_1_) {
   return (ModifiableAttributeInstance)super.func_111151_a(p_111159_1_);
}
项目:RuneCraftery    文件:ServersideAttributeMap.java   
public AttributeInstance func_111151_a(Attribute p_111151_1_) {
   return this.func_111159_c(p_111151_1_);
}
项目:RuneCraftery    文件:EntityLivingBase.java   
public AttributeInstance func_110148_a(Attribute p_110148_1_) {
   return this.func_110140_aT().func_111151_a(p_110148_1_);
}
项目:RuneCraftery    文件:ItemPotion.java   
@SideOnly(Side.CLIENT)
public void func_77624_a(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) {
   if(p_77624_1_.func_77960_j() != 0) {
      List var5 = Item.field_77726_bs.func_77832_l(p_77624_1_);
      HashMultimap var6 = HashMultimap.create();
      Iterator var16;
      if(var5 != null && !var5.isEmpty()) {
         var16 = var5.iterator();

         while(var16.hasNext()) {
            PotionEffect var8 = (PotionEffect)var16.next();
            String var9 = StatCollector.func_74838_a(var8.func_76453_d()).trim();
            Potion var10 = Potion.field_76425_a[var8.func_76456_a()];
            Map var11 = var10.func_111186_k();
            if(var11 != null && var11.size() > 0) {
               Iterator var12 = var11.entrySet().iterator();

               while(var12.hasNext()) {
                  Entry var13 = (Entry)var12.next();
                  AttributeModifier var14 = (AttributeModifier)var13.getValue();
                  AttributeModifier var15 = new AttributeModifier(var14.func_111166_b(), var10.func_111183_a(var8.func_76458_c(), var14), var14.func_111169_c());
                  var6.put(((Attribute)var13.getKey()).func_111108_a(), var15);
               }
            }

            if(var8.func_76458_c() > 0) {
               var9 = var9 + " " + StatCollector.func_74838_a("potion.potency." + var8.func_76458_c()).trim();
            }

            if(var8.func_76459_b() > 20) {
               var9 = var9 + " (" + Potion.func_76389_a(var8) + ")";
            }

            if(var10.func_76398_f()) {
               p_77624_3_.add(EnumChatFormatting.RED + var9);
            } else {
               p_77624_3_.add(EnumChatFormatting.GRAY + var9);
            }
         }
      } else {
         String var7 = StatCollector.func_74838_a("potion.empty").trim();
         p_77624_3_.add(EnumChatFormatting.GRAY + var7);
      }

      if(!var6.isEmpty()) {
         p_77624_3_.add("");
         p_77624_3_.add(EnumChatFormatting.DARK_PURPLE + StatCollector.func_74838_a("potion.effects.whenDrank"));
         var16 = var6.entries().iterator();

         while(var16.hasNext()) {
            Entry var17 = (Entry)var16.next();
            AttributeModifier var18 = (AttributeModifier)var17.getValue();
            double var19 = var18.func_111164_d();
            double var20;
            if(var18.func_111169_c() != 1 && var18.func_111169_c() != 2) {
               var20 = var18.func_111164_d();
            } else {
               var20 = var18.func_111164_d() * 100.0D;
            }

            if(var19 > 0.0D) {
               p_77624_3_.add(EnumChatFormatting.BLUE + StatCollector.func_74837_a("attribute.modifier.plus." + var18.func_111169_c(), new Object[]{ItemStack.field_111284_a.format(var20), StatCollector.func_74838_a("attribute.name." + (String)var17.getKey())}));
            } else if(var19 < 0.0D) {
               var20 *= -1.0D;
               p_77624_3_.add(EnumChatFormatting.RED + StatCollector.func_74837_a("attribute.modifier.take." + var18.func_111169_c(), new Object[]{ItemStack.field_111284_a.format(var20), StatCollector.func_74838_a("attribute.name." + (String)var17.getKey())}));
            }
         }
      }

   }
}
项目:RuneCraftery    文件:Potion.java   
public Potion func_111184_a(Attribute p_111184_1_, String p_111184_2_, double p_111184_3_, int p_111184_5_) {
   AttributeModifier var6 = new AttributeModifier(UUID.fromString(p_111184_2_), this.func_76393_a(), p_111184_3_, p_111184_5_);
   this.field_111188_I.put(p_111184_1_, var6);
   return this;
}
项目:RuneCraftery    文件:EntityLivingBase.java   
public AttributeInstance getEntityAttribute(Attribute par1Attribute)
{
    return this.getAttributeMap().getAttributeInstance(par1Attribute);
}
项目:RuneCraftery    文件:Potion.java   
public Potion func_111184_a(Attribute par1Attribute, String par2Str, double par3, int par5)
{
    AttributeModifier attributemodifier = new AttributeModifier(UUID.fromString(par2Str), this.getName(), par3, par5);
    this.field_111188_I.put(par1Attribute, attributemodifier);
    return this;
}
项目:BetterNutritionMod    文件:EntityLivingBase.java   
public AttributeInstance getEntityAttribute(Attribute par1Attribute)
{
    return this.getAttributeMap().getAttributeInstance(par1Attribute);
}
项目:BetterNutritionMod    文件:Potion.java   
public Potion func_111184_a(Attribute par1Attribute, String par2Str, double par3, int par5)
{
    AttributeModifier attributemodifier = new AttributeModifier(UUID.fromString(par2Str), this.getName(), par3, par5);
    this.field_111188_I.put(par1Attribute, attributemodifier);
    return this;
}
项目:RuneCraftery    文件:BaseAttributeMap.java   
public abstract AttributeInstance func_111150_b(Attribute var1);
项目:RuneCraftery    文件:AttributeInstance.java   
Attribute func_111123_a();