Java Code Examples for net.minecraft.item.ItemArmor#ArmorMaterial

The following examples show how to use net.minecraft.item.ItemArmor#ArmorMaterial . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WrappedArmorMaterialImpl.java    From customstuff4 with GNU General Public License v3.0 6 votes vote down vote up
@Nullable
@Override
public ItemArmor.ArmorMaterial getArmorMaterial()
{
    if (material != null)
        return material;

    if (vanillaMaterials.containsKey(name))
    {
        material = vanillaMaterials.get(name);
    } else
    {
        for (ItemArmor.ArmorMaterial mat : ItemArmor.ArmorMaterial.values())
        {
            if (mat.name().equalsIgnoreCase(name))
            {
                material = mat;
                break;
            }
        }
    }

    return material;
}
 
Example 2
Source File: WrappedArmorMaterialDeserializerTest.java    From customstuff4 with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void fromString()
{
    Map<String, WrappedArmorMaterial> map = gson.fromJson("{ \"material\":\"iron\" }", new TypeToken<Map<String, WrappedArmorMaterial>>() {}.getType());

    ItemArmor.ArmorMaterial material = map.get("material").getArmorMaterial();
    assertSame(ItemArmor.ArmorMaterial.IRON, material);
}
 
Example 3
Source File: ItemPneumaticArmor.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
public ItemPneumaticArmor(String textureLocation, ItemArmor.ArmorMaterial par2EnumArmorMaterial, int par3,
        int par4, int volume, int maxAir){
    super(par2EnumArmorMaterial, par3, par4);
    this.textureLocation = textureLocation;
    this.volume = volume;
    setMaxDamage(maxAir);
    setCreativeTab(PneumaticCraft.tabPneumaticCraft);
}
 
Example 4
Source File: WrappedArmorMaterial.java    From customstuff4 with GNU General Public License v3.0 4 votes vote down vote up
static WrappedArmorMaterial of(ItemArmor.ArmorMaterial material)
{
    return () -> material;
}
 
Example 5
Source File: WrappedArmorMaterial.java    From customstuff4 with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Gets the material. Returns null if the material does not exist.
 */
@Nullable
ItemArmor.ArmorMaterial getArmorMaterial();