Example usage for net.minecraftforge.client ForgeHooksClient getArmorModel

List of usage examples for net.minecraftforge.client ForgeHooksClient getArmorModel

Introduction

In this page you can find the example usage for net.minecraftforge.client ForgeHooksClient getArmorModel.

Prototype

public static <A extends BipedModel<?>> A getArmorModel(LivingEntity entityLiving, ItemStack itemStack,
            EquipmentSlotType slot, A _default) 

Source Link

Usage

From source file:buildcraft.robotics.render.RenderRobot.java

License:Minecraft Mod Public

private void doRenderWearable(EntityRobot entity, TextureManager textureManager, ItemStack wearable) {
    if (wearable.getItem() instanceof IRobotOverlayItem) {
        ((IRobotOverlayItem) wearable.getItem()).renderRobotOverlay(wearable, textureManager);
    } else if (wearable.getItem() instanceof ItemArmor) {
        GL11.glPushMatrix();/*from w  w  w  . ja  v a2s . c  o m*/
        GL11.glScalef(1.0125F, 1.0125F, 1.0125F);
        GL11.glTranslatef(0.0f, -0.25f, 0.0f);
        GL11.glRotatef(180F, 0, 0, 1);

        int color = wearable.getItem().getColorFromItemStack(wearable, 0);
        if (color != 16777215) {
            GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT);
            GL11.glColor3ub((byte) (color >> 16), (byte) ((color >> 8) & 255), (byte) (color & 255));
        }

        textureManager.bindTexture(RenderBiped.getArmorResource(entity, wearable, 0, null));
        ModelBiped armorModel = ForgeHooksClient.getArmorModel(entity, wearable, 0, null);
        if (armorModel != null) {
            armorModel.render(entity, 0, 0, 0, -90f, 0, 1 / 16F);

            if (color != 16777215) {
                GL11.glPopAttrib();
            }
        } else {
            GL11.glRotatef(-90.0f, 0.0f, 1.0f, 0.0f);
            helmetBox.render(1 / 16F);

            if (color != 16777215) {
                this.bindTexture(RenderBiped.getArmorResource(entity, wearable, 0, "overlay"));
                helmetBox.render(1 / 16F);
                GL11.glPopAttrib();
            }
        }

        GL11.glPopMatrix();
    } else if (wearable.getItem() instanceof ItemSkull) {
        doRenderSkull(wearable);
    }
}

From source file:de.sanandrew.mods.sanlib.sanplayermodel.client.renderer.entity.layers.LayerSanArmor.java

License:Creative Commons License

@Override
protected ModelBiped getArmorModelHook(EntityLivingBase entity, ItemStack itemStack, EntityEquipmentSlot slot,
        ModelBiped model) {// ww w  .  j a  va  2  s.  co  m
    ModelSanPlayerArmor armor = getCustomArmorModel(itemStack, slot);
    if (armor != null) {
        this.armTilt = Math.max(this.armTilt, armor.getArmTilt());
        return armor;
    }

    return ForgeHooksClient.getArmorModel(entity, itemStack, slot, model);
}

From source file:runes.Runes.Entites.RenderEskimoZombie.java

License:Open Source License

protected int func_130006_a(EntityLiving par1EntityLiving, int par2, float par3) {
    ItemStack itemstack = par1EntityLiving.func_130225_q(3 - par2);

    if (itemstack != null) {
        Item item = itemstack.getItem();

        if (item instanceof ItemArmor) {
            ItemArmor itemarmor = (ItemArmor) item;
            this.bindTexture(getArmorResource(par1EntityLiving, itemstack, par2, null));
            ModelBiped modelbiped = par2 == 2 ? this.field_82425_h : this.field_82423_g;
            modelbiped.bipedHead.showModel = par2 == 0;
            modelbiped.bipedHeadwear.showModel = par2 == 0;
            modelbiped.bipedBody.showModel = par2 == 1 || par2 == 2;
            modelbiped.bipedRightArm.showModel = par2 == 1;
            modelbiped.bipedLeftArm.showModel = par2 == 1;
            modelbiped.bipedRightLeg.showModel = par2 == 2 || par2 == 3;
            modelbiped.bipedLeftLeg.showModel = par2 == 2 || par2 == 3;
            modelbiped = ForgeHooksClient.getArmorModel(par1EntityLiving, itemstack, par2, modelbiped);
            this.setRenderPassModel(modelbiped);
            modelbiped.onGround = this.mainModel.onGround;
            modelbiped.isRiding = this.mainModel.isRiding;
            modelbiped.isChild = this.mainModel.isChild;
            float f1 = 1.0F;

            //Move out of if to allow for more then just CLOTH to have color
            int j = itemarmor.getColor(itemstack);
            if (j != -1) {
                float f2 = (float) (j >> 16 & 255) / 255.0F;
                float f3 = (float) (j >> 8 & 255) / 255.0F;
                float f4 = (float) (j & 255) / 255.0F;
                GL11.glColor3f(f1 * f2, f1 * f3, f1 * f4);

                if (itemstack.isItemEnchanted()) {
                    return 31;
                }//from   ww w.  j av  a 2 s.  c o m

                return 16;
            }

            GL11.glColor3f(f1, f1, f1);

            if (itemstack.isItemEnchanted()) {
                return 15;
            }

            return 1;
        }
    }

    return -1;
}