Search in sources :

Example 1 with DamageAbsorptionProperty

use of org.spongepowered.api.data.property.item.DamageAbsorptionProperty in project SpongeCommon by SpongePowered.

the class DamageAbsorptionPropertyStore method getFor.

@Override
protected Optional<DamageAbsorptionProperty> getFor(ItemStack itemStack) {
    if (itemStack.getItem() instanceof ItemArmor) {
        final ItemArmor armor = (ItemArmor) itemStack.getItem();
        final int reduction = armor.damageReduceAmount;
        return Optional.of(new DamageAbsorptionProperty(reduction));
    }
    return Optional.empty();
}
Also used : DamageAbsorptionProperty(org.spongepowered.api.data.property.item.DamageAbsorptionProperty) ItemArmor(net.minecraft.item.ItemArmor)

Aggregations

ItemArmor (net.minecraft.item.ItemArmor)1 DamageAbsorptionProperty (org.spongepowered.api.data.property.item.DamageAbsorptionProperty)1