Search in sources :

Example 1 with SkinModelTexture

use of riskyken.armourersWorkshop.client.skin.SkinModelTexture in project Armourers-Workshop by RiskyKen.

the class ModelSkinChest method render.

@Override
public void render(Entity entity, Skin armourData, boolean showSkinPaint, ISkinDye skinDye, byte[] extraColour, boolean itemRender, double distance, boolean doLodLoading) {
    if (armourData == null) {
        return;
    }
    ArrayList<SkinPart> parts = armourData.getParts();
    if (entity != null && entity instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) entity;
        this.isSneak = player.isSneaking();
        this.isRiding = player.isRiding();
        this.heldItemRight = 0;
        if (player.getHeldItem() != null) {
            this.heldItemRight = 1;
        }
    }
    if (ClientProxy.isJrbaClientLoaded()) {
        this.isChild = false;
    }
    ApiRegistrar.INSTANCE.onRenderEquipment(entity, SkinTypeRegistry.skinChest);
    RenderHelper.enableGUIStandardItemLighting();
    if (armourData.hasPaintData() & showSkinPaint) {
        if (extraColour == null) {
            extraColour = PaintingHelper.getLocalPlayerExtraColours();
        }
        SkinModelTexture st = ClientSkinPaintCache.INSTANCE.getTextureForSkin(armourData, skinDye, extraColour);
        st.bindTexture();
        GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        bipedBody.render(SCALE);
        bipedLeftArm.render(SCALE);
        bipedRightArm.render(SCALE);
        GL11.glPopAttrib();
    }
    boolean override = SkinProperties.PROP_ARMOUR_OVERRIDE.getValue(armourData.getProperties());
    for (int i = 0; i < parts.size(); i++) {
        SkinPart part = parts.get(i);
        GL11.glPushMatrix();
        if (isChild) {
            float f6 = 2.0F;
            GL11.glScalef(1.0F / f6, 1.0F / f6, 1.0F / f6);
            GL11.glTranslatef(0.0F, 24.0F * SCALE, 0.0F);
        }
        ApiRegistrar.INSTANCE.onRenderEquipmentPart(entity, part.getPartType());
        if (part.getPartType().getPartName().equals("base")) {
            renderChest(part, SCALE, skinDye, extraColour, itemRender, distance, doLodLoading);
        } else if (part.getPartType().getPartName().equals("leftArm")) {
            renderLeftArm(part, SCALE, skinDye, extraColour, itemRender, distance, doLodLoading, override);
        } else if (part.getPartType().getPartName().equals("rightArm")) {
            renderRightArm(part, SCALE, skinDye, extraColour, itemRender, distance, doLodLoading, override);
        }
        GL11.glPopMatrix();
    }
    GL11.glColor3f(1F, 1F, 1F);
}
Also used : EntityPlayer(net.minecraft.entity.player.EntityPlayer) SkinPart(riskyken.armourersWorkshop.common.skin.data.SkinPart) SkinModelTexture(riskyken.armourersWorkshop.client.skin.SkinModelTexture)

Example 2 with SkinModelTexture

use of riskyken.armourersWorkshop.client.skin.SkinModelTexture in project Armourers-Workshop by RiskyKen.

the class ModelSkinFeet method render.

@Override
public void render(Entity entity, Skin armourData, boolean showSkinPaint, ISkinDye skinDye, byte[] extraColour, boolean itemRender, double distance, boolean doLodLoading) {
    if (armourData == null) {
        return;
    }
    ArrayList<SkinPart> parts = armourData.getParts();
    if (entity != null && entity instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) entity;
        this.isSneak = player.isSneaking();
        this.isRiding = player.isRiding();
        this.heldItemRight = 0;
        if (player.getHeldItem() != null) {
            this.heldItemRight = 1;
        }
    }
    if (ClientProxy.isJrbaClientLoaded()) {
        this.isChild = false;
    }
    ApiRegistrar.INSTANCE.onRenderEquipment(entity, SkinTypeRegistry.skinFeet);
    RenderHelper.enableGUIStandardItemLighting();
    if (armourData.hasPaintData() & showSkinPaint) {
        if (extraColour == null) {
            extraColour = PaintingHelper.getLocalPlayerExtraColours();
        }
        SkinModelTexture st = ClientSkinPaintCache.INSTANCE.getTextureForSkin(armourData, skinDye, extraColour);
        st.bindTexture();
        GL11.glPushMatrix();
        GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        if (itemRender) {
            GL11.glTranslated(0, -12 * SCALE, 0);
        }
        bipedLeftLeg.render(SCALE);
        bipedRightLeg.render(SCALE);
        GL11.glPopAttrib();
        GL11.glPopMatrix();
    }
    for (int i = 0; i < parts.size(); i++) {
        SkinPart part = parts.get(i);
        GL11.glPushMatrix();
        if (isChild) {
            float f6 = 2.0F;
            GL11.glScalef(1.0F / f6, 1.0F / f6, 1.0F / f6);
            GL11.glTranslatef(0.0F, 24.0F * SCALE, 0.0F);
        }
        ApiRegistrar.INSTANCE.onRenderEquipmentPart(entity, part.getPartType());
        if (part.getPartType().getPartName().equals("leftFoot")) {
            renderLeftFoot(part, SCALE, skinDye, extraColour, itemRender, distance, doLodLoading);
        } else if (part.getPartType().getPartName().equals("rightFoot")) {
            renderRightFoot(part, SCALE, skinDye, extraColour, itemRender, distance, doLodLoading);
        }
        GL11.glPopMatrix();
    }
    GL11.glColor3f(1F, 1F, 1F);
}
Also used : EntityPlayer(net.minecraft.entity.player.EntityPlayer) SkinPart(riskyken.armourersWorkshop.common.skin.data.SkinPart) SkinModelTexture(riskyken.armourersWorkshop.client.skin.SkinModelTexture)

Example 3 with SkinModelTexture

use of riskyken.armourersWorkshop.client.skin.SkinModelTexture in project Armourers-Workshop by RiskyKen.

the class ModelSkinLegs method render.

@Override
public void render(Entity entity, Skin armourData, boolean showSkinPaint, ISkinDye skinDye, byte[] extraColour, boolean itemRender, double distance, boolean doLodLoading) {
    if (armourData == null) {
        return;
    }
    ArrayList<SkinPart> parts = armourData.getParts();
    if (entity != null && entity instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) entity;
        this.isSneak = player.isSneaking();
        this.isRiding = player.isRiding();
        this.heldItemRight = 0;
        if (player.getHeldItem() != null) {
            this.heldItemRight = 1;
        }
    }
    if (ClientProxy.isJrbaClientLoaded()) {
        this.isChild = false;
    }
    ApiRegistrar.INSTANCE.onRenderEquipment(entity, SkinTypeRegistry.skinLegs);
    RenderHelper.enableGUIStandardItemLighting();
    if (armourData.hasPaintData() & showSkinPaint) {
        if (extraColour == null) {
            extraColour = PaintingHelper.getLocalPlayerExtraColours();
        }
        SkinModelTexture st = ClientSkinPaintCache.INSTANCE.getTextureForSkin(armourData, skinDye, extraColour);
        st.bindTexture();
        GL11.glPushMatrix();
        GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        if (itemRender) {
            GL11.glTranslated(0, -12 * SCALE, 0);
        }
        bipedLeftLeg.render(SCALE);
        bipedRightLeg.render(SCALE);
        GL11.glPopAttrib();
        GL11.glPopMatrix();
    }
    for (int i = 0; i < parts.size(); i++) {
        SkinPart part = parts.get(i);
        GL11.glPushMatrix();
        if (isChild) {
            float f6 = 2.0F;
            GL11.glScalef(1.0F / f6, 1.0F / f6, 1.0F / f6);
            GL11.glTranslatef(0.0F, 24.0F * SCALE, 0.0F);
        }
        ApiRegistrar.INSTANCE.onRenderEquipmentPart(entity, part.getPartType());
        if (part.getPartType().getPartName().equals("leftLeg")) {
            renderLeftLeg(part, SCALE, skinDye, extraColour, itemRender, distance, doLodLoading);
        } else if (part.getPartType().getPartName().equals("rightLeg")) {
            renderRightLeg(part, SCALE, skinDye, extraColour, itemRender, distance, doLodLoading);
        } else if (part.getPartType().getPartName().equals("skirt")) {
            renderSkirt(part, SCALE, skinDye, extraColour, itemRender, distance, doLodLoading);
        }
        GL11.glPopMatrix();
    }
    GL11.glColor3f(1F, 1F, 1F);
}
Also used : EntityPlayer(net.minecraft.entity.player.EntityPlayer) SkinPart(riskyken.armourersWorkshop.common.skin.data.SkinPart) SkinModelTexture(riskyken.armourersWorkshop.client.skin.SkinModelTexture)

Example 4 with SkinModelTexture

use of riskyken.armourersWorkshop.client.skin.SkinModelTexture in project Armourers-Workshop by RiskyKen.

the class ClientSkinPaintCache method genTextures.

private void genTextures() {
    SkinModelTexture smt = null;
    TextureGenInfo tgi = null;
    synchronized (requestList) {
        if (requestList.size() > 0) {
            tgi = requestList.get(requestList.size() - 1);
            requestList.remove(requestList.size() - 1);
            smt = new SkinModelTexture();
            smt.createTextureForColours(tgi.skin, tgi.cmk);
        }
    }
    if (smt != null && tgi != null) {
        synchronized (textureMap) {
            textureMap.put(tgi.cmk, smt);
        }
        synchronized (requestSet) {
            requestSet.remove(tgi);
        }
    }
}
Also used : SkinModelTexture(riskyken.armourersWorkshop.client.skin.SkinModelTexture)

Example 5 with SkinModelTexture

use of riskyken.armourersWorkshop.client.skin.SkinModelTexture in project Armourers-Workshop by RiskyKen.

the class ModelSkinHead method render.

@Override
public void render(Entity entity, Skin skin, boolean showSkinPaint, ISkinDye skinDye, byte[] extraColour, boolean itemRender, double distance, boolean doLodLoading) {
    if (skin == null) {
        return;
    }
    if (entity != null && entity instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) entity;
        this.isSneak = player.isSneaking();
        this.isRiding = player.isRiding();
        this.heldItemRight = 0;
        if (player.getHeldItem() != null) {
            this.heldItemRight = 1;
        }
    }
    if (ClientProxy.isJrbaClientLoaded()) {
        this.isChild = false;
    }
    ApiRegistrar.INSTANCE.onRenderEquipment(entity, SkinTypeRegistry.skinHead);
    RenderHelper.enableGUIStandardItemLighting();
    if (skin.hasPaintData() & showSkinPaint) {
        if (extraColour == null) {
            extraColour = PaintingHelper.getLocalPlayerExtraColours();
        }
        SkinModelTexture st = ClientSkinPaintCache.INSTANCE.getTextureForSkin(skin, skinDye, extraColour);
        st.bindTexture();
        GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        bipedHead.render(SCALE);
        GL11.glPopAttrib();
    }
    if (skin.getParts().size() > 0) {
        ApiRegistrar.INSTANCE.onRenderEquipmentPart(entity, skin.getParts().get(0).getPartType());
        GL11.glPushMatrix();
        if (isChild) {
            float f6 = 2.0F;
            GL11.glScalef(1.5F / f6, 1.5F / f6, 1.5F / f6);
            GL11.glTranslatef(0.0F, 16.0F * SCALE, 0.0F);
        }
        GL11.glColor3f(1F, 1F, 1F);
        GL11.glRotated(Math.toDegrees(bipedHead.rotateAngleZ), 0, 0, 1);
        GL11.glRotated(Math.toDegrees(bipedHead.rotateAngleY), 0, 1, 0);
        GL11.glRotated(Math.toDegrees(bipedHead.rotateAngleX), 1, 0, 0);
        if (isSneak) {
            GL11.glTranslated(0, 1 * SCALE, 0);
        }
        renderHead(skin.getParts().get(0), SCALE, skinDye, extraColour, distance, doLodLoading);
        GL11.glPopMatrix();
    }
    GL11.glColor3f(1F, 1F, 1F);
}
Also used : EntityPlayer(net.minecraft.entity.player.EntityPlayer) SkinModelTexture(riskyken.armourersWorkshop.client.skin.SkinModelTexture)

Aggregations

SkinModelTexture (riskyken.armourersWorkshop.client.skin.SkinModelTexture)5 EntityPlayer (net.minecraft.entity.player.EntityPlayer)4 SkinPart (riskyken.armourersWorkshop.common.skin.data.SkinPart)3