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

项目:DecompiledMinecraft    文件:SharedMonsterAttributes.java   
public static void func_151475_a(BaseAttributeMap p_151475_0_, NBTTagList p_151475_1_)
{
    for (int i = 0; i < p_151475_1_.tagCount(); ++i)
    {
        NBTTagCompound nbttagcompound = p_151475_1_.getCompoundTagAt(i);
        IAttributeInstance iattributeinstance = p_151475_0_.getAttributeInstanceByName(nbttagcompound.getString("Name"));

        if (iattributeinstance != null)
        {
            applyModifiersToAttributeInstance(iattributeinstance, nbttagcompound);
        }
        else
        {
            logger.warn("Ignoring unknown attribute \'" + nbttagcompound.getString("Name") + "\'");
        }
    }
}
项目:DecompiledMinecraft    文件:SharedMonsterAttributes.java   
public static void func_151475_a(BaseAttributeMap p_151475_0_, NBTTagList p_151475_1_)
{
    for (int i = 0; i < p_151475_1_.tagCount(); ++i)
    {
        NBTTagCompound nbttagcompound = p_151475_1_.getCompoundTagAt(i);
        IAttributeInstance iattributeinstance = p_151475_0_.getAttributeInstanceByName(nbttagcompound.getString("Name"));

        if (iattributeinstance != null)
        {
            applyModifiersToAttributeInstance(iattributeinstance, nbttagcompound);
        }
        else
        {
            logger.warn("Ignoring unknown attribute \'" + nbttagcompound.getString("Name") + "\'");
        }
    }
}
项目:BaseClient    文件:SharedMonsterAttributes.java   
public static void func_151475_a(BaseAttributeMap p_151475_0_, NBTTagList p_151475_1_)
{
    for (int i = 0; i < p_151475_1_.tagCount(); ++i)
    {
        NBTTagCompound nbttagcompound = p_151475_1_.getCompoundTagAt(i);
        IAttributeInstance iattributeinstance = p_151475_0_.getAttributeInstanceByName(nbttagcompound.getString("Name"));

        if (iattributeinstance != null)
        {
            applyModifiersToAttributeInstance(iattributeinstance, nbttagcompound);
        }
        else
        {
            logger.warn("Ignoring unknown attribute \'" + nbttagcompound.getString("Name") + "\'");
        }
    }
}
项目:BaseClient    文件:SharedMonsterAttributes.java   
public static void func_151475_a(BaseAttributeMap p_151475_0_, NBTTagList p_151475_1_)
{
    for (int i = 0; i < p_151475_1_.tagCount(); ++i)
    {
        NBTTagCompound nbttagcompound = p_151475_1_.getCompoundTagAt(i);
        IAttributeInstance iattributeinstance = p_151475_0_.getAttributeInstanceByName(nbttagcompound.getString("Name"));

        if (iattributeinstance != null)
        {
            applyModifiersToAttributeInstance(iattributeinstance, nbttagcompound);
        }
        else
        {
            logger.warn("Ignoring unknown attribute \'" + nbttagcompound.getString("Name") + "\'");
        }
    }
}
项目:PopularMMOS-EpicProportions-Mod    文件:PotionLoader.java   
public void applyAttributesModifiersToEntity(EntityLivingBase p_111185_1_, BaseAttributeMap p_111185_2_, int p_111185_3_)
{
    Iterator iterator = this.field_111188_I.entrySet().iterator();

    while (iterator.hasNext())
    {
        Entry entry = (Entry)iterator.next();
        IAttributeInstance iattributeinstance = p_111185_2_.getAttributeInstance((IAttribute)entry.getKey());

        if (iattributeinstance != null)
        {
            AttributeModifier attributemodifier = (AttributeModifier)entry.getValue();
            iattributeinstance.removeModifier(attributemodifier);
            iattributeinstance.applyModifier(new AttributeModifier(attributemodifier.getID(), this.getName() + " " + p_111185_3_, this.func_111183_a(p_111185_3_, attributemodifier), attributemodifier.getOperation()));
        }
    }
}
项目:MHuanterMod    文件:Utils.java   
public static double rateDamage(ItemStack is)
{
  if (is == null) {
    return 0.0D;
  }
  Multimap attrs = is.getItem().getAttributeModifiers(is);
  if (attrs == null) {
    return 0.0D;
  }
  BaseAttributeMap test = new ServersideAttributeMap();
  test.applyAttributeModifiers(attrs);
  IAttributeInstance attr = test.getAttributeInstance(SharedMonsterAttributes.attackDamage);
  if (attr == null) {
    return 0.0D;
  }
  return attr.getAttributeValue();
}
项目:Resilience-Client-Source    文件:SharedMonsterAttributes.java   
public static void func_151475_a(BaseAttributeMap p_151475_0_, NBTTagList p_151475_1_)
{
    for (int var2 = 0; var2 < p_151475_1_.tagCount(); ++var2)
    {
        NBTTagCompound var3 = p_151475_1_.getCompoundTagAt(var2);
        IAttributeInstance var4 = p_151475_0_.getAttributeInstanceByName(var3.getString("Name"));

        if (var4 != null)
        {
            applyModifiersToAttributeInstance(var4, var3);
        }
        else
        {
            logger.warn("Ignoring unknown attribute \'" + var3.getString("Name") + "\'");
        }
    }
}
项目:Resilience-Client-Source    文件:Potion.java   
public void applyAttributesModifiersToEntity(EntityLivingBase par1EntityLivingBase, BaseAttributeMap par2BaseAttributeMap, int par3)
{
    Iterator var4 = this.field_111188_I.entrySet().iterator();

    while (var4.hasNext())
    {
        Entry var5 = (Entry)var4.next();
        IAttributeInstance var6 = par2BaseAttributeMap.getAttributeInstance((IAttribute)var5.getKey());

        if (var6 != null)
        {
            AttributeModifier var7 = (AttributeModifier)var5.getValue();
            var6.removeModifier(var7);
            var6.applyModifier(new AttributeModifier(var7.getID(), this.getName() + " " + par3, this.func_111183_a(par3, var7), var7.getOperation()));
        }
    }
}
项目:Gadomancy    文件:PotionBuffGolem.java   
@Override
public void applyAttributesModifiersToEntity(EntityLivingBase entity, BaseAttributeMap attrMap, int amplifier) {
    super.applyAttributesModifiersToEntity(entity, attrMap, amplifier);

    if(entity instanceof EntityGolemBase) {
        EntityGolemBase golem = (EntityGolemBase) entity;

        IAttributeInstance inst = golem.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
        if(inst.getModifier(SPEED_INC_PERCENT.getID()) != null) {
            inst.applyModifier(SPEED_INC_PERCENT);
        }

        inst = golem.getEntityAttribute(SharedMonsterAttributes.maxHealth);
        if(inst.getModifier(HEALTH_INC_PERCENT.getID()) != null) {
            inst.applyModifier(HEALTH_INC_PERCENT);
        }

        inst = golem.getEntityAttribute(SharedMonsterAttributes.attackDamage);
        if(inst.getModifier(DAMAGE_INC_PERCENT.getID()) != null) {
            inst.applyModifier(DAMAGE_INC_PERCENT);
        }
    }
}
项目:Gadomancy    文件:PotionBuffGolem.java   
@Override
public void removeAttributesModifiersFromEntity(EntityLivingBase entity, BaseAttributeMap attrMap, int amplifier) {
    super.removeAttributesModifiersFromEntity(entity, attrMap, amplifier);

    if(entity instanceof EntityGolemBase) {
        EntityGolemBase golem = (EntityGolemBase) entity;

        IAttributeInstance inst = golem.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
        if(inst.getModifier(SPEED_INC_PERCENT.getID()) != null) {
            inst.removeModifier(SPEED_INC_PERCENT);
        }

        inst = golem.getEntityAttribute(SharedMonsterAttributes.maxHealth);
        if(inst.getModifier(HEALTH_INC_PERCENT.getID()) != null) {
            inst.removeModifier(HEALTH_INC_PERCENT);
        }

        inst = golem.getEntityAttribute(SharedMonsterAttributes.attackDamage);
        if(inst.getModifier(DAMAGE_INC_PERCENT.getID()) != null) {
            inst.removeModifier(DAMAGE_INC_PERCENT);
        }
    }
}
项目:Cauldron    文件:SharedMonsterAttributes.java   
public static void func_151475_a(BaseAttributeMap p_151475_0_, NBTTagList p_151475_1_)
{
    for (int i = 0; i < p_151475_1_.tagCount(); ++i)
    {
        NBTTagCompound nbttagcompound = p_151475_1_.getCompoundTagAt(i);
        IAttributeInstance iattributeinstance = p_151475_0_.getAttributeInstanceByName(nbttagcompound.getString("Name"));

        if (iattributeinstance != null)
        {
            applyModifiersToAttributeInstance(iattributeinstance, nbttagcompound);
        }
        else
        {
            logger.warn("Ignoring unknown attribute \'" + nbttagcompound.getString("Name") + "\'");
        }
    }
}
项目:Cauldron    文件:Potion.java   
public void applyAttributesModifiersToEntity(EntityLivingBase p_111185_1_, BaseAttributeMap p_111185_2_, int p_111185_3_)
{
    Iterator iterator = this.field_111188_I.entrySet().iterator();

    while (iterator.hasNext())
    {
        Entry entry = (Entry)iterator.next();
        IAttributeInstance iattributeinstance = p_111185_2_.getAttributeInstance((IAttribute)entry.getKey());

        if (iattributeinstance != null)
        {
            AttributeModifier attributemodifier = (AttributeModifier)entry.getValue();
            iattributeinstance.removeModifier(attributemodifier);
            iattributeinstance.applyModifier(new AttributeModifier(attributemodifier.getID(), this.getName() + " " + p_111185_3_, this.func_111183_a(p_111185_3_, attributemodifier), attributemodifier.getOperation()));
        }
    }
}
项目:Cauldron    文件:SharedMonsterAttributes.java   
public static void func_151475_a(BaseAttributeMap p_151475_0_, NBTTagList p_151475_1_)
{
    for (int i = 0; i < p_151475_1_.tagCount(); ++i)
    {
        NBTTagCompound nbttagcompound = p_151475_1_.getCompoundTagAt(i);
        IAttributeInstance iattributeinstance = p_151475_0_.getAttributeInstanceByName(nbttagcompound.getString("Name"));

        if (iattributeinstance != null)
        {
            applyModifiersToAttributeInstance(iattributeinstance, nbttagcompound);
        }
        else
        {
            logger.warn("Ignoring unknown attribute \'" + nbttagcompound.getString("Name") + "\'");
        }
    }
}
项目:Cauldron    文件:Potion.java   
public void applyAttributesModifiersToEntity(EntityLivingBase p_111185_1_, BaseAttributeMap p_111185_2_, int p_111185_3_)
{
    Iterator iterator = this.field_111188_I.entrySet().iterator();

    while (iterator.hasNext())
    {
        Entry entry = (Entry)iterator.next();
        IAttributeInstance iattributeinstance = p_111185_2_.getAttributeInstance((IAttribute)entry.getKey());

        if (iattributeinstance != null)
        {
            AttributeModifier attributemodifier = (AttributeModifier)entry.getValue();
            iattributeinstance.removeModifier(attributemodifier);
            iattributeinstance.applyModifier(new AttributeModifier(attributemodifier.getID(), this.getName() + " " + p_111185_3_, this.func_111183_a(p_111185_3_, attributemodifier), attributemodifier.getOperation()));
        }
    }
}
项目: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    文件: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    文件: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    文件: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()));
        }
    }
}
项目:DecompiledMinecraft    文件:EntityLivingBase.java   
public BaseAttributeMap getAttributeMap()
{
    if (this.attributeMap == null)
    {
        this.attributeMap = new ServersideAttributeMap();
    }

    return this.attributeMap;
}
项目:DecompiledMinecraft    文件:SharedMonsterAttributes.java   
/**
 * Creates an NBTTagList from a BaseAttributeMap, including all its AttributeInstances
 */
public static NBTTagList writeBaseAttributeMapToNBT(BaseAttributeMap p_111257_0_)
{
    NBTTagList nbttaglist = new NBTTagList();

    for (IAttributeInstance iattributeinstance : p_111257_0_.getAllAttributes())
    {
        nbttaglist.appendTag(writeAttributeInstanceToNBT(iattributeinstance));
    }

    return nbttaglist;
}
项目:DecompiledMinecraft    文件:Potion.java   
public void removeAttributesModifiersFromEntity(EntityLivingBase entityLivingBaseIn, BaseAttributeMap p_111187_2_, int amplifier)
{
    for (Entry<IAttribute, AttributeModifier> entry : this.attributeModifierMap.entrySet())
    {
        IAttributeInstance iattributeinstance = p_111187_2_.getAttributeInstance((IAttribute)entry.getKey());

        if (iattributeinstance != null)
        {
            iattributeinstance.removeModifier((AttributeModifier)entry.getValue());
        }
    }
}
项目:DecompiledMinecraft    文件:Potion.java   
public void applyAttributesModifiersToEntity(EntityLivingBase entityLivingBaseIn, BaseAttributeMap p_111185_2_, int amplifier)
{
    for (Entry<IAttribute, AttributeModifier> entry : this.attributeModifierMap.entrySet())
    {
        IAttributeInstance iattributeinstance = p_111185_2_.getAttributeInstance((IAttribute)entry.getKey());

        if (iattributeinstance != null)
        {
            AttributeModifier attributemodifier = (AttributeModifier)entry.getValue();
            iattributeinstance.removeModifier(attributemodifier);
            iattributeinstance.applyModifier(new AttributeModifier(attributemodifier.getID(), this.getName() + " " + amplifier, this.getAttributeModifierAmount(amplifier, attributemodifier), attributemodifier.getOperation()));
        }
    }
}
项目:DecompiledMinecraft    文件:PotionHealthBoost.java   
public void removeAttributesModifiersFromEntity(EntityLivingBase entityLivingBaseIn, BaseAttributeMap p_111187_2_, int amplifier)
{
    super.removeAttributesModifiersFromEntity(entityLivingBaseIn, p_111187_2_, amplifier);

    if (entityLivingBaseIn.getHealth() > entityLivingBaseIn.getMaxHealth())
    {
        entityLivingBaseIn.setHealth(entityLivingBaseIn.getMaxHealth());
    }
}
项目:DecompiledMinecraft    文件:EntityLivingBase.java   
public BaseAttributeMap getAttributeMap()
{
    if (this.attributeMap == null)
    {
        this.attributeMap = new ServersideAttributeMap();
    }

    return this.attributeMap;
}
项目:DecompiledMinecraft    文件:SharedMonsterAttributes.java   
/**
 * Creates an NBTTagList from a BaseAttributeMap, including all its AttributeInstances
 */
public static NBTTagList writeBaseAttributeMapToNBT(BaseAttributeMap p_111257_0_)
{
    NBTTagList nbttaglist = new NBTTagList();

    for (IAttributeInstance iattributeinstance : p_111257_0_.getAllAttributes())
    {
        nbttaglist.appendTag(writeAttributeInstanceToNBT(iattributeinstance));
    }

    return nbttaglist;
}
项目:DecompiledMinecraft    文件:NetHandlerPlayClient.java   
/**
 * Updates en entity's attributes and their respective modifiers, which are used for speed bonusses (player
 * sprinting, animals fleeing, baby speed), weapon/tool attackDamage, hostiles followRange randomization, zombie
 * maxHealth and knockback resistance as well as reinforcement spawning chance.
 */
public void handleEntityProperties(S20PacketEntityProperties packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());

    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();

            for (S20PacketEntityProperties.Snapshot s20packetentityproperties$snapshot : packetIn.func_149441_d())
            {
                IAttributeInstance iattributeinstance = baseattributemap.getAttributeInstanceByName(s20packetentityproperties$snapshot.func_151409_a());

                if (iattributeinstance == null)
                {
                    iattributeinstance = baseattributemap.registerAttribute(new RangedAttribute((IAttribute)null, s20packetentityproperties$snapshot.func_151409_a(), 0.0D, 2.2250738585072014E-308D, Double.MAX_VALUE));
                }

                iattributeinstance.setBaseValue(s20packetentityproperties$snapshot.func_151410_b());
                iattributeinstance.removeAllModifiers();

                for (AttributeModifier attributemodifier : s20packetentityproperties$snapshot.func_151408_c())
                {
                    iattributeinstance.applyModifier(attributemodifier);
                }
            }
        }
    }
}
项目:DecompiledMinecraft    文件:Potion.java   
public void removeAttributesModifiersFromEntity(EntityLivingBase entityLivingBaseIn, BaseAttributeMap p_111187_2_, int amplifier)
{
    for (Entry<IAttribute, AttributeModifier> entry : this.attributeModifierMap.entrySet())
    {
        IAttributeInstance iattributeinstance = p_111187_2_.getAttributeInstance((IAttribute)entry.getKey());

        if (iattributeinstance != null)
        {
            iattributeinstance.removeModifier((AttributeModifier)entry.getValue());
        }
    }
}
项目:DecompiledMinecraft    文件:Potion.java   
public void applyAttributesModifiersToEntity(EntityLivingBase entityLivingBaseIn, BaseAttributeMap p_111185_2_, int amplifier)
{
    for (Entry<IAttribute, AttributeModifier> entry : this.attributeModifierMap.entrySet())
    {
        IAttributeInstance iattributeinstance = p_111185_2_.getAttributeInstance((IAttribute)entry.getKey());

        if (iattributeinstance != null)
        {
            AttributeModifier attributemodifier = (AttributeModifier)entry.getValue();
            iattributeinstance.removeModifier(attributemodifier);
            iattributeinstance.applyModifier(new AttributeModifier(attributemodifier.getID(), this.getName() + " " + amplifier, this.getAttributeModifierAmount(amplifier, attributemodifier), attributemodifier.getOperation()));
        }
    }
}
项目:DecompiledMinecraft    文件:PotionHealthBoost.java   
public void removeAttributesModifiersFromEntity(EntityLivingBase entityLivingBaseIn, BaseAttributeMap p_111187_2_, int amplifier)
{
    super.removeAttributesModifiersFromEntity(entityLivingBaseIn, p_111187_2_, amplifier);

    if (entityLivingBaseIn.getHealth() > entityLivingBaseIn.getMaxHealth())
    {
        entityLivingBaseIn.setHealth(entityLivingBaseIn.getMaxHealth());
    }
}
项目:BaseClient    文件:EntityLivingBase.java   
public BaseAttributeMap getAttributeMap()
{
    if (this.attributeMap == null)
    {
        this.attributeMap = new ServersideAttributeMap();
    }

    return this.attributeMap;
}
项目:BaseClient    文件:SharedMonsterAttributes.java   
/**
 * Creates an NBTTagList from a BaseAttributeMap, including all its AttributeInstances
 */
public static NBTTagList writeBaseAttributeMapToNBT(BaseAttributeMap p_111257_0_)
{
    NBTTagList nbttaglist = new NBTTagList();

    for (IAttributeInstance iattributeinstance : p_111257_0_.getAllAttributes())
    {
        nbttaglist.appendTag(writeAttributeInstanceToNBT(iattributeinstance));
    }

    return nbttaglist;
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
/**
 * Updates en entity's attributes and their respective modifiers, which are used for speed bonusses (player
 * sprinting, animals fleeing, baby speed), weapon/tool attackDamage, hostiles followRange randomization, zombie
 * maxHealth and knockback resistance as well as reinforcement spawning chance.
 */
public void handleEntityProperties(S20PacketEntityProperties packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());

    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();

            for (S20PacketEntityProperties.Snapshot s20packetentityproperties$snapshot : packetIn.func_149441_d())
            {
                IAttributeInstance iattributeinstance = baseattributemap.getAttributeInstanceByName(s20packetentityproperties$snapshot.func_151409_a());

                if (iattributeinstance == null)
                {
                    iattributeinstance = baseattributemap.registerAttribute(new RangedAttribute((IAttribute)null, s20packetentityproperties$snapshot.func_151409_a(), 0.0D, 2.2250738585072014E-308D, Double.MAX_VALUE));
                }

                iattributeinstance.setBaseValue(s20packetentityproperties$snapshot.func_151410_b());
                iattributeinstance.removeAllModifiers();

                for (AttributeModifier attributemodifier : s20packetentityproperties$snapshot.func_151408_c())
                {
                    iattributeinstance.applyModifier(attributemodifier);
                }
            }
        }
    }
}
项目:BaseClient    文件:Potion.java   
public void removeAttributesModifiersFromEntity(EntityLivingBase entityLivingBaseIn, BaseAttributeMap p_111187_2_, int amplifier)
{
    for (Entry<IAttribute, AttributeModifier> entry : this.attributeModifierMap.entrySet())
    {
        IAttributeInstance iattributeinstance = p_111187_2_.getAttributeInstance((IAttribute)entry.getKey());

        if (iattributeinstance != null)
        {
            iattributeinstance.removeModifier((AttributeModifier)entry.getValue());
        }
    }
}
项目:BaseClient    文件:Potion.java   
public void applyAttributesModifiersToEntity(EntityLivingBase entityLivingBaseIn, BaseAttributeMap p_111185_2_, int amplifier)
{
    for (Entry<IAttribute, AttributeModifier> entry : this.attributeModifierMap.entrySet())
    {
        IAttributeInstance iattributeinstance = p_111185_2_.getAttributeInstance((IAttribute)entry.getKey());

        if (iattributeinstance != null)
        {
            AttributeModifier attributemodifier = (AttributeModifier)entry.getValue();
            iattributeinstance.removeModifier(attributemodifier);
            iattributeinstance.applyModifier(new AttributeModifier(attributemodifier.getID(), this.getName() + " " + amplifier, this.getAttributeModifierAmount(amplifier, attributemodifier), attributemodifier.getOperation()));
        }
    }
}
项目:BaseClient    文件:PotionHealthBoost.java   
public void removeAttributesModifiersFromEntity(EntityLivingBase entityLivingBaseIn, BaseAttributeMap p_111187_2_, int amplifier)
{
    super.removeAttributesModifiersFromEntity(entityLivingBaseIn, p_111187_2_, amplifier);

    if (entityLivingBaseIn.getHealth() > entityLivingBaseIn.getMaxHealth())
    {
        entityLivingBaseIn.setHealth(entityLivingBaseIn.getMaxHealth());
    }
}
项目:BaseClient    文件:EntityLivingBase.java   
public BaseAttributeMap getAttributeMap()
{
    if (this.attributeMap == null)
    {
        this.attributeMap = new ServersideAttributeMap();
    }

    return this.attributeMap;
}
项目:BaseClient    文件:SharedMonsterAttributes.java   
/**
 * Creates an NBTTagList from a BaseAttributeMap, including all its AttributeInstances
 */
public static NBTTagList writeBaseAttributeMapToNBT(BaseAttributeMap p_111257_0_)
{
    NBTTagList nbttaglist = new NBTTagList();

    for (IAttributeInstance iattributeinstance : p_111257_0_.getAllAttributes())
    {
        nbttaglist.appendTag(writeAttributeInstanceToNBT(iattributeinstance));
    }

    return nbttaglist;
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
/**
 * Updates en entity's attributes and their respective modifiers, which are used
 * for speed bonusses (player sprinting, animals fleeing, baby speed),
 * weapon/tool attackDamage, hostiles followRange randomization, zombie
 * maxHealth and knockback resistance as well as reinforcement spawning chance.
 */
public void handleEntityProperties(S20PacketEntityProperties packetIn) {
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());

    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();

            for (S20PacketEntityProperties.Snapshot s20packetentityproperties$snapshot : packetIn.func_149441_d()) {
                IAttributeInstance iattributeinstance = baseattributemap
                        .getAttributeInstanceByName(s20packetentityproperties$snapshot.func_151409_a());

                if (iattributeinstance == null) {
                    iattributeinstance = baseattributemap.registerAttribute(new RangedAttribute((IAttribute) null,
                            s20packetentityproperties$snapshot.func_151409_a(), 0.0D, 2.2250738585072014E-308D,
                            Double.MAX_VALUE));
                }

                iattributeinstance.setBaseValue(s20packetentityproperties$snapshot.func_151410_b());
                iattributeinstance.removeAllModifiers();

                for (AttributeModifier attributemodifier : s20packetentityproperties$snapshot.func_151408_c()) {
                    iattributeinstance.applyModifier(attributemodifier);
                }
            }
        }
    }
}
项目:BaseClient    文件:Potion.java   
public void removeAttributesModifiersFromEntity(EntityLivingBase entityLivingBaseIn, BaseAttributeMap p_111187_2_, int amplifier)
{
    for (Entry<IAttribute, AttributeModifier> entry : this.attributeModifierMap.entrySet())
    {
        IAttributeInstance iattributeinstance = p_111187_2_.getAttributeInstance((IAttribute)entry.getKey());

        if (iattributeinstance != null)
        {
            iattributeinstance.removeModifier((AttributeModifier)entry.getValue());
        }
    }
}
项目:BaseClient    文件:Potion.java   
public void applyAttributesModifiersToEntity(EntityLivingBase entityLivingBaseIn, BaseAttributeMap p_111185_2_, int amplifier)
{
    for (Entry<IAttribute, AttributeModifier> entry : this.attributeModifierMap.entrySet())
    {
        IAttributeInstance iattributeinstance = p_111185_2_.getAttributeInstance((IAttribute)entry.getKey());

        if (iattributeinstance != null)
        {
            AttributeModifier attributemodifier = (AttributeModifier)entry.getValue();
            iattributeinstance.removeModifier(attributemodifier);
            iattributeinstance.applyModifier(new AttributeModifier(attributemodifier.getID(), this.getName() + " " + amplifier, this.getAttributeModifierAmount(amplifier, attributemodifier), attributemodifier.getOperation()));
        }
    }
}