Search in sources :

Example 21 with SkinPointer

use of riskyken.armourersWorkshop.common.skin.data.SkinPointer in project Armourers-Workshop by RiskyKen.

the class SkinDataHandler method writeSkinPointerToCompound.

@Override
public void writeSkinPointerToCompound(ISkinPointer skinPointer, NBTTagCompound compound) {
    if (compound == null) {
        return;
    }
    SkinPointer sp = new SkinPointer(skinPointer);
    sp.writeToCompound(compound);
}
Also used : ISkinPointer(riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer) SkinPointer(riskyken.armourersWorkshop.common.skin.data.SkinPointer)

Example 22 with SkinPointer

use of riskyken.armourersWorkshop.common.skin.data.SkinPointer in project Armourers-Workshop by RiskyKen.

the class SkinDataHandler method readSkinPointerFromCompound.

@Override
public ISkinPointer readSkinPointerFromCompound(NBTTagCompound compound) {
    if (!SkinNBTHelper.compoundHasSkinData(compound)) {
        return null;
    }
    SkinPointer sp = new SkinPointer();
    sp.readFromCompound(compound);
    return sp;
}
Also used : ISkinPointer(riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer) SkinPointer(riskyken.armourersWorkshop.common.skin.data.SkinPointer)

Example 23 with SkinPointer

use of riskyken.armourersWorkshop.common.skin.data.SkinPointer 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)

Example 24 with SkinPointer

use of riskyken.armourersWorkshop.common.skin.data.SkinPointer in project Armourers-Workshop by RiskyKen.

the class ContainerDyeTable method skinAdded.

public void skinAdded(ItemStack stack) {
    updateLockedSlots(stack);
    if (tileEntity.getWorldObj().isRemote) {
        return;
    }
    SkinPointer skinPointer = SkinNBTHelper.getSkinPointerFromStack(stack);
    ISkinDye dye = skinPointer.getSkinDye();
    skinRemoved();
    updateLockedSlots(stack);
    putStackInSlot(45, stack.copy());
    putDyesInSlots();
    detectAndSendChanges();
}
Also used : SkinPointer(riskyken.armourersWorkshop.common.skin.data.SkinPointer) ISkinDye(riskyken.armourersWorkshop.api.common.skin.data.ISkinDye)

Example 25 with SkinPointer

use of riskyken.armourersWorkshop.common.skin.data.SkinPointer in project Armourers-Workshop by RiskyKen.

the class ContainerDyeTable method dyeAdded.

public void dyeAdded(ItemStack dyeStack, int slotId) {
    ItemStack skinStack = getSlot(45).getStack();
    if (skinStack == null) {
        return;
    }
    SkinPointer skinPointer = SkinNBTHelper.getSkinPointerFromStack(skinStack);
    ISkinDye skinDye = skinPointer.getSkinDye();
    byte[] rgbt = PaintingHelper.getToolPaintData(dyeStack);
    String name = null;
    if (dyeStack.hasDisplayName()) {
        name = dyeStack.getDisplayName();
    }
    skinDye.addDye(slotId, rgbt, name);
    SkinNBTHelper.addSkinDataToStack(skinStack, skinPointer);
}
Also used : SkinPointer(riskyken.armourersWorkshop.common.skin.data.SkinPointer) ISkinDye(riskyken.armourersWorkshop.api.common.skin.data.ISkinDye) ItemStack(net.minecraft.item.ItemStack)

Aggregations

SkinPointer (riskyken.armourersWorkshop.common.skin.data.SkinPointer)64 ItemStack (net.minecraft.item.ItemStack)28 Skin (riskyken.armourersWorkshop.common.skin.data.Skin)19 ISkinPointer (riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer)15 Item (net.minecraft.item.Item)13 ISkinDye (riskyken.armourersWorkshop.api.common.skin.data.ISkinDye)8 LibraryFile (riskyken.armourersWorkshop.common.library.LibraryFile)7 SkinIdentifier (riskyken.armourersWorkshop.common.skin.data.SkinIdentifier)7 ISkinType (riskyken.armourersWorkshop.api.common.skin.type.ISkinType)6 AbstractClientPlayer (net.minecraft.client.entity.AbstractClientPlayer)4 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)4 ItemSkin (riskyken.armourersWorkshop.common.items.ItemSkin)4 Minecraft (net.minecraft.client.Minecraft)3 ScaledResolution (net.minecraft.client.gui.ScaledResolution)3 ItemBlock (net.minecraft.item.ItemBlock)3 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)3 AbstractModelSkin (riskyken.armourersWorkshop.client.model.skin.AbstractModelSkin)3 MessageServerLibrarySendSkin (riskyken.armourersWorkshop.common.network.messages.server.MessageServerLibrarySendSkin)3 SkinDye (riskyken.armourersWorkshop.common.skin.data.SkinDye)3 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)2