Search in sources :

Example 1 with IExplosiveContainerItem

use of com.builtbroken.mc.api.items.explosives.IExplosiveContainerItem in project Engine by VoltzEngine-Project.

the class ExplosiveRegistryClient method getCornerIconFor.

/**
     * Gets the corner icon for the explosive item. Defaults
     * to using {@link ITexturedExplosiveHandler} if the explosive
     * handler implements the interface. If it doesn't then
     * the map will be searched for the item.
     *
     * @param stack
     * @return item or missing icon
     */
public static IIcon getCornerIconFor(final ItemStack stack, int pass) {
    ItemStack item = stack;
    if (item.getItem() instanceof IExplosiveContainerItem) {
        item = ((IExplosiveContainerItem) item.getItem()).getExplosiveStack(stack);
    }
    if (item != null) {
        IExplosiveHandler handler = ExplosiveRegistry.get(item);
        if (handler instanceof ITexturedExplosiveHandler) {
            IIcon icon = ((ITexturedExplosiveHandler) handler).getBottomLeftCornerIcon(item, pass);
            if (icon != null) {
                return icon;
            }
        }
        ItemStackWrapper wrapper = new ItemStackWrapper(item);
        if (EX_CORNER_ICONS.containsKey(wrapper)) {
            return EX_CORNER_ICONS.get(wrapper);
        }
    }
    return missing_corner_icon;
}
Also used : IIcon(net.minecraft.util.IIcon) IExplosiveContainerItem(com.builtbroken.mc.api.items.explosives.IExplosiveContainerItem) ItemStack(net.minecraft.item.ItemStack) IExplosiveHandler(com.builtbroken.mc.api.explosive.IExplosiveHandler) ItemStackWrapper(com.builtbroken.mc.prefab.items.ItemStackWrapper) ITexturedExplosiveHandler(com.builtbroken.mc.api.explosive.ITexturedExplosiveHandler)

Aggregations

IExplosiveHandler (com.builtbroken.mc.api.explosive.IExplosiveHandler)1 ITexturedExplosiveHandler (com.builtbroken.mc.api.explosive.ITexturedExplosiveHandler)1 IExplosiveContainerItem (com.builtbroken.mc.api.items.explosives.IExplosiveContainerItem)1 ItemStackWrapper (com.builtbroken.mc.prefab.items.ItemStackWrapper)1 ItemStack (net.minecraft.item.ItemStack)1 IIcon (net.minecraft.util.IIcon)1