Search in sources :

Example 11 with ISkinPointer

use of riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer 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 12 with ISkinPointer

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

the class GuiDyeTable method drawGuiContainerForegroundLayer.

@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
    GuiHelper.renderLocalizedGuiName(this.fontRendererObj, this.xSize, tileEntity.getInventoryName());
    this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 46, this.ySize - 96 + 2, 4210752);
    Slot slot = (Slot) inventorySlots.inventorySlots.get(45);
    ItemStack skinStack = slot.getStack();
    ISkinPointer skinPointer = SkinNBTHelper.getSkinPointerFromStack(skinStack);
    if (skinPointer != null) {
        GL11.glPushMatrix();
        GL11.glColor4f(1F, 1F, 1F, 1F);
        RenderHelper.enableStandardItemLighting();
        float boxX = 242.5F;
        float boxY = 102;
        float scale = 11F;
        GL11.glTranslatef((float) boxX, (float) boxY, 500.0F);
        GL11.glScalef(-scale, scale, scale);
        float rotation = (float) ((double) System.currentTimeMillis() / 10 % 360);
        float fade = (float) ((double) System.currentTimeMillis() / 400 % Math.PI * 2);
        float change = (float) Math.sin(fade);
        float alpha = change * 50;
        // ModLogger.log(alpha);
        GL11.glRotatef(-20, 1, 0, 0);
        GL11.glRotatef(rotation, 0, 1, 0);
        // GL11.glEnable(GL11.GL_ALPHA_TEST);
        // GL11.glEnable(GL11.GL_DEPTH_TEST);
        // ModRenderHelper.enableAlphaBlend();
        // GL11.glDisable(GL11.GL_CULL_FACE);
        // GL11.glDisable(GL11.GL_DEPTH_TEST);
        drawRect(guiLeft, guiTop, guiLeft + 50, guiTop + 50, 0xFFFFFFFF);
        int dyeSlot = mouseOverDyeSlot(mouseX, mouseY);
        dyeSlot = -1;
        if (dyeSlot != -1) {
            GL11.glPushMatrix();
            // GL11.glEnable(GL11.GL_CULL_FACE);
            SkinItemRenderHelper.renderSkinAsItem(skinPointer, true, false, 140, 176);
            // ItemStackRenderHelper.renderItemModelFromSkinPointer(skinPointer, true, false);
            GL11.glPopMatrix();
            GL11.glPopMatrix();
            Color c = new Color(198, 198, 198, (int) (240));
            RenderHelper.disableStandardItemLighting();
            GL11.glDisable(GL11.GL_DEPTH_TEST);
            drawRect(152, 20, 250, 95, c.getRGB());
            GL11.glColor4f(1, 1, 1, 1);
            GL11.glEnable(GL11.GL_DEPTH_TEST);
            RenderHelper.enableStandardItemLighting();
            GL11.glPushMatrix();
            GL11.glTranslatef((float) boxX, (float) boxY, 200.0F);
            GL11.glScalef(-scale, scale, scale);
            GL11.glRotatef(-20, 1, 0, 0);
            GL11.glRotatef(rotation, 0, 1, 0);
            for (int i = 0; i < 8; i++) {
                if (i != dyeSlot) {
                    skinPointer.getSkinDye().addDye(i, rolloverDyes[dyeSlot].getDyeColour(i));
                }
            }
            GL11.glColor3f(1F, 1F, 1F);
            SkinItemRenderHelper.renderSkinAsItem(skinPointer, true, false, 140, 176);
        } else {
            ModRenderHelper.enableAlphaBlend();
            SkinItemRenderHelper.renderSkinAsItem(skinPointer, true, false, 140, 176);
        }
        GL11.glPopMatrix();
    }
    GL11.glDisable(GL11.GL_DEPTH_TEST);
}
Also used : Color(java.awt.Color) Slot(net.minecraft.inventory.Slot) ItemStack(net.minecraft.item.ItemStack) ISkinPointer(riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer)

Example 13 with ISkinPointer

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

the class SkinnableEntityCreeperRenderer method renderEquipmentType.

private void renderEquipmentType(EntityLivingBase entity, RendererLivingEntity renderer, ISkinType skinType, IEntityEquipment equipmentData) {
    if (equipmentData.haveEquipment(skinType, 0)) {
        ISkinPointer skinPointer = equipmentData.getSkinPointer(skinType, 0);
        Skin skin = ClientSkinCache.INSTANCE.getSkin(skinPointer);
        if (skin == null) {
            return;
        }
        GL11.glEnable(GL11.GL_NORMALIZE);
        float scale = 0.0625F;
        for (int i = 0; i < skin.getParts().size(); i++) {
            SkinPartRenderer.INSTANCE.renderPart(skin.getParts().get(i), scale, skinPointer.getSkinDye(), null, false);
        }
        GL11.glDisable(GL11.GL_NORMALIZE);
    }
}
Also used : Skin(riskyken.armourersWorkshop.common.skin.data.Skin) ISkinPointer(riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer)

Example 14 with ISkinPointer

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

the class SkinnableEntityGhastRenderer method renderEquipmentType.

private void renderEquipmentType(EntityLivingBase entity, RendererLivingEntity renderer, ISkinType skinType, IEntityEquipment equipmentData) {
    if (equipmentData.haveEquipment(skinType, 0)) {
        ISkinPointer skinPointer = equipmentData.getSkinPointer(skinType, 0);
        Skin skin = ClientSkinCache.INSTANCE.getSkin(skinPointer);
        if (skin == null) {
            return;
        }
        GL11.glEnable(GL11.GL_NORMALIZE);
        float scale = 1F / 16F;
        for (int i = 0; i < skin.getParts().size(); i++) {
            SkinPartRenderer.INSTANCE.renderPart(skin.getParts().get(i), scale, skinPointer.getSkinDye(), null, false);
        }
        GL11.glDisable(GL11.GL_NORMALIZE);
    }
}
Also used : Skin(riskyken.armourersWorkshop.common.skin.data.Skin) ISkinPointer(riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer)

Example 15 with ISkinPointer

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

the class SkinnableEntitySkeletonRenderer method renderEquipmentType.

private void renderEquipmentType(EntityLivingBase entity, RendererLivingEntity renderer, ISkinType skinType, IEntityEquipment equipmentData) {
    float scale = 0.0625F;
    if (renderer instanceof RenderSkeleton) {
        RenderSkeleton rs = (RenderSkeleton) renderer;
        if (!equipmentData.haveEquipment(skinType, 0)) {
            return;
        }
        ISkinPointer skinPointer = equipmentData.getSkinPointer(skinType, 0);
        Skin skin = ClientSkinCache.INSTANCE.getSkin(skinPointer);
        if (skin == null) {
            return;
        }
        AbstractModelSkin model = SkinModelRenderer.INSTANCE.getModelForEquipmentType(skinType);
        GL11.glPushMatrix();
        model.render(entity, rs.modelBipedMain, skin, false, skinPointer.getSkinDye(), null, false, 0, false);
        GL11.glPopMatrix();
    }
}
Also used : RenderSkeleton(net.minecraft.client.renderer.entity.RenderSkeleton) AbstractModelSkin(riskyken.armourersWorkshop.client.model.skin.AbstractModelSkin) Skin(riskyken.armourersWorkshop.common.skin.data.Skin) AbstractModelSkin(riskyken.armourersWorkshop.client.model.skin.AbstractModelSkin) ISkinPointer(riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer)

Aggregations

ISkinPointer (riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer)15 Skin (riskyken.armourersWorkshop.common.skin.data.Skin)8 SkinPointer (riskyken.armourersWorkshop.common.skin.data.SkinPointer)4 ItemStack (net.minecraft.item.ItemStack)3 AbstractModelSkin (riskyken.armourersWorkshop.client.model.skin.AbstractModelSkin)2 GameProfile (com.mojang.authlib.GameProfile)1 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)1 Color (java.awt.Color)1 Block (net.minecraft.block.Block)1 AbstractClientPlayer (net.minecraft.client.entity.AbstractClientPlayer)1 EntityClientPlayerMP (net.minecraft.client.entity.EntityClientPlayerMP)1 ModelZombieVillager (net.minecraft.client.model.ModelZombieVillager)1 RenderSkeleton (net.minecraft.client.renderer.entity.RenderSkeleton)1 RenderZombie (net.minecraft.client.renderer.entity.RenderZombie)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 Slot (net.minecraft.inventory.Slot)1 MovingObjectPosition (net.minecraft.util.MovingObjectPosition)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 World (net.minecraft.world.World)1 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)1