Search in sources :

Example 1 with ArmorType

use of org.spongepowered.api.data.type.ArmorType in project SpongeCommon by SpongePowered.

the class ArmorTypePropertyStore method getFor.

@Override
protected Optional<ArmorTypeProperty> getFor(ItemStack itemStack) {
    if (itemStack.getItem() instanceof ItemArmor) {
        final ItemArmor armor = (ItemArmor) itemStack.getItem();
        final ItemArmor.ArmorMaterial armorMaterial = armor.getArmorMaterial();
        return Optional.of(new ArmorTypeProperty((ArmorType) (Object) armorMaterial));
    }
    return Optional.empty();
}
Also used : ItemArmor(net.minecraft.item.ItemArmor) ArmorTypeProperty(org.spongepowered.api.data.property.item.ArmorTypeProperty) ArmorType(org.spongepowered.api.data.type.ArmorType)

Aggregations

ItemArmor (net.minecraft.item.ItemArmor)1 ArmorTypeProperty (org.spongepowered.api.data.property.item.ArmorTypeProperty)1 ArmorType (org.spongepowered.api.data.type.ArmorType)1