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

项目: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);
                }
            }
        }
    }
}
项目: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    文件: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);
                }
            }
        }
    }
}
项目:Zombe-Modpack    文件: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(SPacketEntityProperties 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
        {
            AbstractAttributeMap abstractattributemap = ((EntityLivingBase)entity).getAttributeMap();

            for (SPacketEntityProperties.Snapshot spacketentityproperties$snapshot : packetIn.getSnapshots())
            {
                IAttributeInstance iattributeinstance = abstractattributemap.getAttributeInstanceByName(spacketentityproperties$snapshot.getName());

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

                iattributeinstance.setBaseValue(spacketentityproperties$snapshot.getBaseValue());
                iattributeinstance.removeAllModifiers();

                for (AttributeModifier attributemodifier : spacketentityproperties$snapshot.getModifiers())
                {
                    iattributeinstance.applyModifier(attributemodifier);
                }
            }
        }
    }
}
项目:Backmemed    文件: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(SPacketEntityProperties 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
        {
            AbstractAttributeMap abstractattributemap = ((EntityLivingBase)entity).getAttributeMap();

            for (SPacketEntityProperties.Snapshot spacketentityproperties$snapshot : packetIn.getSnapshots())
            {
                IAttributeInstance iattributeinstance = abstractattributemap.getAttributeInstanceByName(spacketentityproperties$snapshot.getName());

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

                iattributeinstance.setBaseValue(spacketentityproperties$snapshot.getBaseValue());
                iattributeinstance.removeAllModifiers();

                for (AttributeModifier attributemodifier : spacketentityproperties$snapshot.getModifiers())
                {
                    iattributeinstance.applyModifier(attributemodifier);
                }
            }
        }
    }
}
项目:CustomWorldGen    文件: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(SPacketEntityProperties 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
        {
            AbstractAttributeMap abstractattributemap = ((EntityLivingBase)entity).getAttributeMap();

            for (SPacketEntityProperties.Snapshot spacketentityproperties$snapshot : packetIn.getSnapshots())
            {
                IAttributeInstance iattributeinstance = abstractattributemap.getAttributeInstanceByName(spacketentityproperties$snapshot.getName());

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

                iattributeinstance.setBaseValue(spacketentityproperties$snapshot.getBaseValue());
                iattributeinstance.removeAllModifiers();

                for (AttributeModifier attributemodifier : spacketentityproperties$snapshot.getModifiers())
                {
                    iattributeinstance.applyModifier(attributemodifier);
                }
            }
        }
    }
}
项目:Resilience-Client-Source    文件: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 p_147290_1_)
{
    Entity var2 = this.clientWorldController.getEntityByID(p_147290_1_.func_149442_c());

    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).getAttributeMap();
            Iterator var4 = p_147290_1_.func_149441_d().iterator();

            while (var4.hasNext())
            {
                S20PacketEntityProperties.Snapshot var5 = (S20PacketEntityProperties.Snapshot)var4.next();
                IAttributeInstance var6 = var3.getAttributeInstanceByName(var5.func_151409_a());

                if (var6 == null)
                {
                    var6 = var3.registerAttribute(new RangedAttribute(var5.func_151409_a(), 0.0D, 2.2250738585072014E-308D, Double.MAX_VALUE));
                }

                var6.setBaseValue(var5.func_151410_b());
                var6.removeAllModifiers();
                Iterator var7 = var5.func_151408_c().iterator();

                while (var7.hasNext())
                {
                    AttributeModifier var8 = (AttributeModifier)var7.next();
                    var6.applyModifier(var8);
                }
            }
        }
    }
}
项目:ExpandedRailsMod    文件: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(SPacketEntityProperties 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
        {
            AbstractAttributeMap abstractattributemap = ((EntityLivingBase)entity).getAttributeMap();

            for (SPacketEntityProperties.Snapshot spacketentityproperties$snapshot : packetIn.getSnapshots())
            {
                IAttributeInstance iattributeinstance = abstractattributemap.getAttributeInstanceByName(spacketentityproperties$snapshot.getName());

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

                iattributeinstance.setBaseValue(spacketentityproperties$snapshot.getBaseValue());
                iattributeinstance.removeAllModifiers();

                for (AttributeModifier attributemodifier : spacketentityproperties$snapshot.getModifiers())
                {
                    iattributeinstance.applyModifier(attributemodifier);
                }
            }
        }
    }
}
项目:Cauldron    文件:NetHandlerPlayClient.java   
public void handleEntityProperties(S20PacketEntityProperties p_147290_1_)
{
    Entity entity = this.clientWorldController.getEntityByID(p_147290_1_.func_149442_c());

    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 = p_147290_1_.func_149441_d().iterator();

            while (iterator.hasNext())
            {
                S20PacketEntityProperties.Snapshot snapshot = (S20PacketEntityProperties.Snapshot)iterator.next();
                IAttributeInstance iattributeinstance = baseattributemap.getAttributeInstanceByName(snapshot.func_151409_a());

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

                iattributeinstance.setBaseValue(snapshot.func_151410_b());
                iattributeinstance.removeAllModifiers();
                Iterator iterator1 = snapshot.func_151408_c().iterator();

                while (iterator1.hasNext())
                {
                    AttributeModifier attributemodifier = (AttributeModifier)iterator1.next();
                    iattributeinstance.applyModifier(attributemodifier);
                }
            }
        }
    }
}
项目:Cauldron    文件:NetHandlerPlayClient.java   
public void handleEntityProperties(S20PacketEntityProperties p_147290_1_)
{
    Entity entity = this.clientWorldController.getEntityByID(p_147290_1_.func_149442_c());

    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 = p_147290_1_.func_149441_d().iterator();

            while (iterator.hasNext())
            {
                S20PacketEntityProperties.Snapshot snapshot = (S20PacketEntityProperties.Snapshot)iterator.next();
                IAttributeInstance iattributeinstance = baseattributemap.getAttributeInstanceByName(snapshot.func_151409_a());

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

                iattributeinstance.setBaseValue(snapshot.func_151410_b());
                iattributeinstance.removeAllModifiers();
                Iterator iterator1 = snapshot.func_151408_c().iterator();

                while (iterator1.hasNext())
                {
                    AttributeModifier attributemodifier = (AttributeModifier)iterator1.next();
                    iattributeinstance.applyModifier(attributemodifier);
                }
            }
        }
    }
}
项目: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    文件: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    文件: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);
                }
            }
        }
    }
}
项目:BetterNutritionMod    文件: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);
                }
            }
        }
    }
}
项目:Skree    文件:TweakerSystem.java   
@NModuleTrigger(trigger = "PRE_INITIALIZATION")
public void preInit() {
  ReflectiveModifier.modifyFieldValue(RangedAttribute.class, (RangedAttribute) SharedMonsterAttributes.MAX_HEALTH, "field_111118_b", Double.MAX_VALUE);
}