use of net.minecraft.entity.ai.attributes.ModifiableAttributeInstance in project ArsMagica2 by Mithion.
the class Freedom method applyEffect.
@Override
public boolean applyEffect(EntityPlayer player, World world, ItemStack stack, ImbuementApplicationTypes matchedType, Object... params) {
ModifiableAttributeInstance instance = (ModifiableAttributeInstance) player.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.movementSpeed);
ArrayList<AttributeModifier> toRemove = new ArrayList<AttributeModifier>();
Collection c = instance.func_111122_c();
ArrayList arraylist = new ArrayList(c);
Iterator iterator = arraylist.iterator();
while (iterator.hasNext()) {
AttributeModifier attributemodifier = (AttributeModifier) iterator.next();
if (attributemodifier.getOperation() == 2 && attributemodifier.getAmount() < 0.0f) {
toRemove.add(attributemodifier);
}
}
for (AttributeModifier modifier : toRemove) {
instance.removeModifier(modifier);
}
return toRemove.size() > 0;
}
Aggregations