Search in sources :

Example 1 with SkinPointer

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

the class GuiGlobalLibraryPanelSkinInfo method drawPreviewBox.

public void drawPreviewBox(Skin skin, int boxX, int boxY, int boxWidth, int boxHeight, int mouseX, int mouseY, float partialTickTime) {
    drawGradientRect(boxX, boxY, boxX + boxWidth, boxY + boxHeight, 0x22888888, 0x22CCCCCC);
    if (skin != null) {
        int iconSize = Math.min(boxWidth, boxHeight);
        ScaledResolution scaledResolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
        float scale = 10 - scaledResolution.getScaleFactor();
        GL11.glPushMatrix();
        GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
        GL11.glTranslatef(boxX + boxWidth / 2, boxY + boxHeight / 2, 500.0F);
        GL11.glScalef((float) (-scale), (float) scale, (float) scale);
        GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F);
        float rotation = (float) ((double) System.currentTimeMillis() / 10 % 360);
        GL11.glRotatef(rotation, 0.0F, 1.0F, 0.0F);
        RenderHelper.enableStandardItemLighting();
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glEnable(GL11.GL_NORMALIZE);
        GL11.glEnable(GL11.GL_COLOR_MATERIAL);
        ModRenderHelper.enableAlphaBlend();
        SkinItemRenderHelper.renderSkinAsItem(skin, new SkinPointer(skin), true, false, boxWidth, boxHeight);
        GL11.glPopAttrib();
        GL11.glPopMatrix();
    }
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) SkinPointer(riskyken.armourersWorkshop.common.skin.data.SkinPointer)

Example 2 with SkinPointer

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

the class SkinModelRenderer method getPlayerCustomArmour.

public Skin getPlayerCustomArmour(Entity entity, ISkinType skinType, int slotIndex) {
    if (!(entity instanceof AbstractClientPlayer)) {
        return null;
    }
    AbstractClientPlayer player = (AbstractClientPlayer) entity;
    EntityEquipmentData equipmentData = playerEquipmentMap.get(new PlayerPointer(player));
    // Look for skinned armourer.
    if (skinType.getVanillaArmourSlotId() >= 0 && skinType.getVanillaArmourSlotId() < 4 && slotIndex == 0) {
        int slot = 3 - skinType.getVanillaArmourSlotId();
        ItemStack armourStack = player.getCurrentArmor(slot);
        if (SkinNBTHelper.stackHasSkinData(armourStack)) {
            SkinPointer sp = SkinNBTHelper.getSkinPointerFromStack(armourStack);
            return getCustomArmourItemData(sp);
        }
    }
    // No skinned armour found checking the equipment wardrobe.
    if (equipmentData == null) {
        return null;
    }
    if (!equipmentData.haveEquipment(skinType, slotIndex)) {
        return null;
    }
    ISkinPointer skinPointer = equipmentData.getSkinPointer(skinType, slotIndex);
    return getCustomArmourItemData(skinPointer);
}
Also used : AbstractClientPlayer(net.minecraft.client.entity.AbstractClientPlayer) SkinPointer(riskyken.armourersWorkshop.common.skin.data.SkinPointer) ISkinPointer(riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer) EntityEquipmentData(riskyken.armourersWorkshop.common.skin.EntityEquipmentData) PlayerPointer(riskyken.armourersWorkshop.common.data.PlayerPointer) ItemStack(net.minecraft.item.ItemStack) ISkinPointer(riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer)

Example 3 with SkinPointer

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

the class SkinModelRenderer method getPlayerDyeData.

public ISkinDye getPlayerDyeData(Entity entity, ISkinType skinType, int slotIndex) {
    if (!(entity instanceof AbstractClientPlayer)) {
        return null;
    }
    AbstractClientPlayer player = (AbstractClientPlayer) entity;
    EntityEquipmentData equipmentData = playerEquipmentMap.get(new PlayerPointer(player));
    // Look for skinned armourer.
    if (skinType.getVanillaArmourSlotId() >= 0 && skinType.getVanillaArmourSlotId() < 4 && slotIndex == 0) {
        int slot = 3 - skinType.getVanillaArmourSlotId();
        ItemStack armourStack = player.getCurrentArmor(slot);
        if (SkinNBTHelper.stackHasSkinData(armourStack)) {
            SkinPointer sp = SkinNBTHelper.getSkinPointerFromStack(armourStack);
            return sp.getSkinDye();
        }
    }
    // No skinned armour found checking the equipment wardrobe.
    if (equipmentData == null) {
        return null;
    }
    if (!equipmentData.haveEquipment(skinType, slotIndex)) {
        return null;
    }
    ISkinDye skinDye = equipmentData.getSkinPointer(skinType, slotIndex).getSkinDye();
    return skinDye;
}
Also used : AbstractClientPlayer(net.minecraft.client.entity.AbstractClientPlayer) SkinPointer(riskyken.armourersWorkshop.common.skin.data.SkinPointer) ISkinPointer(riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer) EntityEquipmentData(riskyken.armourersWorkshop.common.skin.EntityEquipmentData) PlayerPointer(riskyken.armourersWorkshop.common.data.PlayerPointer) ISkinDye(riskyken.armourersWorkshop.api.common.skin.data.ISkinDye) ItemStack(net.minecraft.item.ItemStack)

Example 4 with SkinPointer

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

the class SkinModelRenderer method renderEquipmentPartFromStack.

public boolean renderEquipmentPartFromStack(Entity entity, ItemStack stack, ModelBiped modelBiped, byte[] extraColours, double distance, boolean doLodLoading) {
    SkinPointer skinPointer = SkinNBTHelper.getSkinPointerFromStack(stack);
    if (skinPointer == null) {
        return false;
    }
    Skin data = getCustomArmourItemData(skinPointer);
    return renderEquipmentPart(entity, modelBiped, data, skinPointer.getSkinDye(), extraColours, distance, doLodLoading);
}
Also used : SkinPointer(riskyken.armourersWorkshop.common.skin.data.SkinPointer) ISkinPointer(riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer) Skin(riskyken.armourersWorkshop.common.skin.data.Skin) AbstractModelSkin(riskyken.armourersWorkshop.client.model.skin.AbstractModelSkin)

Example 5 with SkinPointer

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

the class EquipmentRenderHandler method requestSkinModelFromSever.

@Override
public void requestSkinModelFromSever(ItemStack stack) {
    if (!SkinNBTHelper.stackHasSkinData(stack)) {
        return;
    }
    SkinPointer skinPointer = SkinNBTHelper.getSkinPointerFromStack(stack);
    requestSkinModelFromSever(skinPointer);
}
Also used : ISkinPointer(riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer) SkinPointer(riskyken.armourersWorkshop.common.skin.data.SkinPointer)

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