@SubscribeEvent public void onEntityUpdate (LivingUpdateEvent event) { final EntityLivingBase entity = event.getEntityLiving(); if (entity instanceof EntitySheep) { final ModifiableAttributeInstance instance = (ModifiableAttributeInstance) entity.getEntityAttribute(SharedMonsterAttributes.ARMOR); final boolean hasModifier = instance.hasModifier(sheepArmor); final boolean isSheared = ((EntitySheep) entity).getSheared(); if (!isSheared && !hasModifier) { instance.applyModifier(sheepArmor); } else if (isSheared && hasModifier) { instance.removeModifier(sheepArmor); } } }
@Override public ModifiedAttribute getModifiedAttribute(Attribute attribute) { final IAttributeInstance instance = this.getAttributeInstance((IAttribute) attribute); if (instance != null && instance instanceof ModifiableAttributeInstance) { return (ModifiedAttribute) instance; } return null; }
@Override public ModifiedAttribute getModifiedAttributeByName(String name) { final IAttributeInstance instance = this.getAttributeInstanceByName(name); if (instance != null && instance instanceof ModifiableAttributeInstance) { return (ModifiedAttribute) instance; } return null; }
@Override public ModifiedAttribute registerAttribute(Attribute attribute) { final IAttributeInstance instance = this.registerAttribute((IAttribute) attribute); if (instance != null && instance instanceof ModifiableAttributeInstance) { return (ModifiedAttribute) instance; } return null; }
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; } }
public void combineAttributes(BaseAttributeMap map) { Iterator<ModifiableAttributeInstance> itr = map.func_111146_a().iterator(); while(itr.hasNext()) { ModifiableAttributeInstance incrementAttribute = itr.next(); double oldValue = func_110140_aT().func_111152_a(incrementAttribute.func_111123_a().func_111108_a()).func_111125_b(); double increment = incrementAttribute.func_111125_b(); func_110140_aT().func_111152_a(incrementAttribute.func_111123_a().func_111108_a()).func_111128_a(oldValue + increment); } }
public ModifiableAttributeInstance func_111159_c(Attribute p_111159_1_) { return (ModifiableAttributeInstance)super.func_111151_a(p_111159_1_); }
public void func_111149_a(ModifiableAttributeInstance p_111149_1_) { if(p_111149_1_.func_111123_a().func_111111_c()) { this.field_111162_d.add(p_111149_1_); } }
@Override public void onEntityUpdate () { super.onEntityUpdate(); final ListIterator<EntityLivingBase> itr = this.trackedEntities.listIterator(); while (itr.hasNext()) { final EntityLivingBase entity = itr.next(); if (entity == null || entity.isDead) { itr.remove(); } final ModifiableAttributeInstance attack = (ModifiableAttributeInstance) entity.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE); final ModifiableAttributeInstance health = (ModifiableAttributeInstance) entity.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH); if (attack != null && health != null) { if (!attack.hasModifier(SPAWN_BONUS)) { attack.applyModifier(SPAWN_BONUS); } if (!health.hasModifier(SPAWN_BONUS)) { health.applyModifier(SPAWN_BONUS); entity.setHealth(entity.getMaxHealth()); } itr.remove(); } } }
public void func_111149_a(ModifiableAttributeInstance p_111149_1_) {}