Search in sources :

Example 1 with GuiSkinLibrary

use of riskyken.armourersWorkshop.client.gui.skinlibrary.GuiSkinLibrary in project Armourers-Workshop by RiskyKen.

the class ContainerArmourLibrary method updateSkinName.

@SideOnly(Side.CLIENT)
public void updateSkinName(int slotId) {
    Minecraft mc = Minecraft.getMinecraft();
    GuiScreen screen = mc.currentScreen;
    if (screen != null && screen instanceof GuiSkinLibrary) {
        GuiSkinLibrary libScreen = (GuiSkinLibrary) screen;
        ItemStack stack = getSlot(36).getStack();
        if (stack == null) {
            libScreen.setFileName("");
        } else {
            SkinPointer skinPointer = SkinNBTHelper.getSkinPointerFromStack(stack);
            if (skinPointer != null) {
                if (ClientSkinCache.INSTANCE.isSkinInCache(skinPointer)) {
                    Skin skin = ClientSkinCache.INSTANCE.getSkin(skinPointer);
                    String skinName = skin.getCustomName();
                    if (!StringUtils.isNullOrEmpty(skinName)) {
                        libScreen.setFileName(skinName);
                    }
                }
            }
        }
    }
}
Also used : SkinPointer(riskyken.armourersWorkshop.common.skin.data.SkinPointer) GuiScreen(net.minecraft.client.gui.GuiScreen) ItemSkin(riskyken.armourersWorkshop.common.items.ItemSkin) Skin(riskyken.armourersWorkshop.common.skin.data.Skin) ItemStack(net.minecraft.item.ItemStack) Minecraft(net.minecraft.client.Minecraft) GuiSkinLibrary(riskyken.armourersWorkshop.client.gui.skinlibrary.GuiSkinLibrary) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Aggregations

SideOnly (cpw.mods.fml.relauncher.SideOnly)1 Minecraft (net.minecraft.client.Minecraft)1 GuiScreen (net.minecraft.client.gui.GuiScreen)1 ItemStack (net.minecraft.item.ItemStack)1 GuiSkinLibrary (riskyken.armourersWorkshop.client.gui.skinlibrary.GuiSkinLibrary)1 ItemSkin (riskyken.armourersWorkshop.common.items.ItemSkin)1 Skin (riskyken.armourersWorkshop.common.skin.data.Skin)1 SkinPointer (riskyken.armourersWorkshop.common.skin.data.SkinPointer)1