Search in sources :

Example 6 with SkinPart

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

use of riskyken.armourersWorkshop.common.skin.data.SkinPart 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 8 with SkinPart

use of riskyken.armourersWorkshop.common.skin.data.SkinPart 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 9 with SkinPart

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

the class SkinPartSerializer method loadSkinPart.

public static SkinPart loadSkinPart(DataInputStream stream, int version) throws IOException, InvalidCubeTypeException {
    ISkinPartType skinPart = null;
    SkinCubeData cubeData = null;
    ArrayList<CubeMarkerData> markerBlocks = null;
    if (version < 6) {
        skinPart = SkinTypeRegistry.INSTANCE.getSkinPartFromLegacyId(stream.readByte());
        if (skinPart == null) {
            ModLogger.log(Level.ERROR, "Skin part was null");
            throw new IOException("Skin part was null");
        }
    } else {
        String regName = null;
        if (version > 12) {
            regName = StreamUtils.readString(stream, Charsets.US_ASCII);
        } else {
            regName = stream.readUTF();
        }
        if (regName.equals("armourers:skirt.base")) {
            regName = "armourers:legs.skirt";
        }
        if (regName.equals("armourers:bow.base")) {
            regName = "armourers:bow.frame1";
        }
        if (regName.equals("armourers:arrow.base")) {
            regName = "armourers:bow.arrow";
        }
        skinPart = SkinTypeRegistry.INSTANCE.getSkinPartFromRegistryName(regName);
        if (skinPart == null) {
            ModLogger.log(Level.ERROR, "Skin part was null - reg name: " + regName + " version: " + version);
            throw new IOException("Skin part was null - reg name: " + regName + " version: " + version);
        }
    }
    cubeData = new SkinCubeData();
    cubeData.readFromStream(stream, version, skinPart);
    markerBlocks = new ArrayList<CubeMarkerData>();
    if (version > 8) {
        int markerCount = stream.readInt();
        for (int i = 0; i < markerCount; i++) {
            markerBlocks.add(new CubeMarkerData(stream, version));
        }
    }
    return new SkinPart(cubeData, skinPart, markerBlocks);
}
Also used : ISkinPartType(riskyken.armourersWorkshop.api.common.skin.type.ISkinPartType) SkinCubeData(riskyken.armourersWorkshop.common.skin.data.SkinCubeData) CubeMarkerData(riskyken.armourersWorkshop.common.skin.cubes.CubeMarkerData) IOException(java.io.IOException) SkinPart(riskyken.armourersWorkshop.common.skin.data.SkinPart)

Example 10 with SkinPart

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

the class BlockSkinnable method isBedFoot.

@Override
public boolean isBedFoot(IBlockAccess world, int x, int y, int z) {
    Skin skin = getSkin(world, x, y, z);
    if (skin != null) {
        for (int i = 0; i < skin.getPartCount(); i++) {
            SkinPart part = skin.getParts().get(i);
            part.getMarkerCount();
        }
    }
    return false;
}
Also used : Skin(riskyken.armourersWorkshop.common.skin.data.Skin) SkinPart(riskyken.armourersWorkshop.common.skin.data.SkinPart)

Aggregations

SkinPart (riskyken.armourersWorkshop.common.skin.data.SkinPart)26 Skin (riskyken.armourersWorkshop.common.skin.data.Skin)10 EntityPlayer (net.minecraft.entity.player.EntityPlayer)8 ArrayList (java.util.ArrayList)5 IPoint3D (riskyken.armourersWorkshop.api.common.IPoint3D)5 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)3 ISkinPartType (riskyken.armourersWorkshop.api.common.skin.type.ISkinPartType)3 SkinModelTexture (riskyken.armourersWorkshop.client.skin.SkinModelTexture)3 CubeMarkerData (riskyken.armourersWorkshop.common.skin.cubes.CubeMarkerData)3 Color (java.awt.Color)2 IOException (java.io.IOException)2 AbstractClientPlayer (net.minecraft.client.entity.AbstractClientPlayer)2 IRectangle3D (riskyken.armourersWorkshop.api.common.IRectangle3D)2 IEntityEquipment (riskyken.armourersWorkshop.api.common.skin.IEntityEquipment)2 Rectangle3D (riskyken.armourersWorkshop.api.common.skin.Rectangle3D)2 ISkinPartTypeTextured (riskyken.armourersWorkshop.api.common.skin.type.ISkinPartTypeTextured)2 SkinSaveException (riskyken.armourersWorkshop.common.exception.SkinSaveException)2 SkinCubeData (riskyken.armourersWorkshop.common.skin.data.SkinCubeData)2 SkinBlock (riskyken.armourersWorkshop.common.skin.type.block.SkinBlock)2 MovementType (riskyken.armourersWorkshop.common.skin.type.wings.SkinWings.MovementType)2