Jump to content

[How to] Custom 3D armor render


iBuilder99

Recommended Posts

Hey guys!

I was looking for a custom renderer for my armor and I found this method in the Item class :

public ModelBiped getArmorModel(EntityLiving entityLiving, ItemStack itemStack, int armorSlot){
   return null;
}

To do that you need to create a new class that extends ModelBiped :

public class MyCustomArmorRender extends ModelBiped{
      public MyCustomArmorRender(){
            //load the normal player model from ModelBiped
            super();
      }
      
      //self explaining
      public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float  par6, float par7){

      }
}

.....and thanks to the 'Advanced model loader' in Forge you can render a wavefront object for your armor.

If you are done with your render you can bind the texture for the model with :

public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer){

}

in the Item class. Put 'return new MyCustomArmorRender();' into the 'getArmorModel' method.

(I hope it was not pure luck that it worked for me, correct me if I'm wrong)

 

Link to comment
Share on other sites

  • 1 month later...

I tried to reproduce this by myself.

But I'm running into some errors, so if you could specify them a little more I'd be thankful.

 

1. Do I have to make my Items class extend Item or ItemArmor (ran in some errors with the renderIndex while having it extend ItemArmor)? You obviously can't wear an Item so I tried it with the isValidArmor() method (it worked).

 

2. In the render() method in the ModelBiped extending class, do you render the ModelBiped model AND your model (btw I'm using normal techne made models, so I'm loading them in the constructor too) or something else?

 

At the moment nothing renders when I put on my item (or at least is invisible ^^) but I really hope that you can clarify this because it sounds very good to me at the moment.

And no my name is not inspired by DBZ ^^

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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