Jump to content

[1.6.4] How to set custom colors for a custom armor?


Recommended Posts

I want to set a custom color for my custom armor, not the item, i'm refering to the texture which renders over the player.


I know how to set a custom color to the item:


public boolean hasColor(ItemStack par1ItemStack)
	return true;

public int getColor(ItemStack par1ItemStack)
	return 16711680;


I've also seen inside of the RenderBiped.class that the color is only got for the items which are a instace of ItemArmor:


    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);
                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;

                    return 16;

                GL11.glColor3f(f1, f1, f1);

                if (itemstack.isItemEnchanted())
                    return 15;

                return 1;

        return -1;


So i don't know how to set a custom color to the armor texture.



Well, knowing this: Is there any way to set a custom color to the texture of a custom armor?


I hope you could understand me and thanks for helping.

Link to comment
Share on other sites



And it's not easy.


Take a look at how vanilla handles dyed leather armor.


You can also take a look at this class (1.7.2) or this class (1.6.4).


The absolutely most important thing to understand is:


Vanilla color multiplies a "base" armor texture, then renders a second overlay texture.  If the second texture is not transparent, then the colored bits won't show through.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.


Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.


DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.