Example usage for net.minecraftforge.client ForgeHooksClient getArmorTexture

List of usage examples for net.minecraftforge.client ForgeHooksClient getArmorTexture

Introduction

In this page you can find the example usage for net.minecraftforge.client ForgeHooksClient getArmorTexture.

Prototype

public static String getArmorTexture(Entity entity, ItemStack armor, String _default, EquipmentSlotType slot,
            String type) 

Source Link

Usage

From source file:runes.Runes.Entites.RenderEskimoZombie.java

License:Open Source License

/**
* More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide.
*
* @param entity Entity wearing the armor
* @param stack ItemStack for the armor/*  w  w  w  . j  a  v a  2  s .  c  om*/
* @param slot Slot ID that the item is in
* @param type Subtype, can be null or "overlay"
* @return ResourceLocation pointing at the armor's texture
*/
public static ResourceLocation getArmorResource(Entity entity, ItemStack stack, int slot, String type) {
    ItemArmor item = (ItemArmor) stack.getItem();
    String s1 = String.format("textures/models/armor/%s_layer_%d%s.png",
            bipedArmorFilenamePrefix[item.renderIndex], (slot == 2 ? 2 : 1),
            type == null ? "" : String.format("_%s", type));

    s1 = ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type);
    ResourceLocation resourcelocation = (ResourceLocation) field_110859_k.get(s1);

    if (resourcelocation == null) {
        resourcelocation = new ResourceLocation(s1);
        field_110859_k.put(s1, resourcelocation);
    }

    return resourcelocation;
}