Search in sources :

Example 1 with RenderItemSwordSkin

use of riskyken.armourersWorkshop.client.render.item.RenderItemSwordSkin in project Armourers-Workshop by RiskyKen.

the class ModAddonManager method overrideItemRenderer.

private static void overrideItemRenderer(String modId, String itemName, RenderType renderType) {
    Item item = GameRegistry.findItem(modId, itemName);
    if (item != null) {
        ItemStack stack = new ItemStack(item);
        IItemRenderer renderer = getItemRenderer(stack);
        if (renderer != null && renderer instanceof RenderItemEquipmentSkin) {
            ModLogger.log(Level.WARN, String.format("Tried to override the render on %s:%s but it has already been overridden.", modId, itemName));
            return;
        }
        ModLogger.log(String.format("Overriding render on %s:%s.", modId, itemName));
        switch(renderType) {
            case SWORD:
                MinecraftForgeClient.registerItemRenderer(item, new RenderItemSwordSkin(renderer));
                break;
            case BOW:
                MinecraftForgeClient.registerItemRenderer(item, new RenderItemBowSkin(renderer));
                break;
        }
    } else {
        ModLogger.log(Level.WARN, String.format("Unable to override item renderer for %s:%s. Can not find item.", modId, itemName));
    }
}
Also used : Item(net.minecraft.item.Item) IItemRenderer(net.minecraftforge.client.IItemRenderer) RenderItemEquipmentSkin(riskyken.armourersWorkshop.client.render.item.RenderItemEquipmentSkin) RenderItemBowSkin(riskyken.armourersWorkshop.client.render.item.RenderItemBowSkin) RenderItemSwordSkin(riskyken.armourersWorkshop.client.render.item.RenderItemSwordSkin) ItemStack(net.minecraft.item.ItemStack)

Aggregations

Item (net.minecraft.item.Item)1 ItemStack (net.minecraft.item.ItemStack)1 IItemRenderer (net.minecraftforge.client.IItemRenderer)1 RenderItemBowSkin (riskyken.armourersWorkshop.client.render.item.RenderItemBowSkin)1 RenderItemEquipmentSkin (riskyken.armourersWorkshop.client.render.item.RenderItemEquipmentSkin)1 RenderItemSwordSkin (riskyken.armourersWorkshop.client.render.item.RenderItemSwordSkin)1