Jump to content

[1.7.10] Help rendering custom .obj armor


soliddanii

Recommended Posts

I've already searched for a solution to my problem and i'm unable to solve it on my own, probably because i don't have much knowlodege about openGL or rendering.

 

This is my render class:

 

public class HunterHatRender extends ModelBiped
{
private final IModelCustom hunterHat;

    public HunterHatRender() {

        hunterHat = AdvancedModelLoader.loadModel(new ResourceLocation(Main.MODID,
			"models/hunterHat.obj"));
	ModelRenderer objModelAttach = new ModelRenderer(this){
		@Override
		public void render(float f) {
			GL11.glPushMatrix();
			GL11.glTranslatef(0.0F, 1.0F, 0.0F);
			FMLClientHandler.instance().getClient().renderEngine
					.bindTexture(new ResourceLocation(Main.MODID, "textures/armor/texture.png"));
			hunterHat.renderAll();
			GL11.glPopMatrix();
		}
	};
	bipedHead.addChild(objModelAttach);
        
    }


}

 

An this is what i get:

 

 

t5sylt.png

 

54w1hf.png

 

2v2yzok.png

 

 

I know the model (hat) isn't finished, is incorrectly placed and doesn't have a texture, but those are other problems i know how to fix.

Why does a biped without textures render on top of the normal player? I just wan't to render my hat :(

 

Thank you.

Link to comment
Share on other sites

I'm almost there.

 

With this code:

 

@SideOnly(Side.CLIENT)
@Override
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) {

	ModelBiped armorModel = null;
	if (itemStack != null && itemStack.getItem() instanceof HunterHat) {
		armorModel = new HunterHatRender();
		armorModel.bipedHead.showModel = true;
		armorModel.bipedHeadwear.showModel = false;
		armorModel.bipedBody.showModel = false;
		armorModel.bipedRightArm.showModel = false;
		armorModel.bipedLeftArm.showModel = false;
		armorModel.bipedRightLeg.showModel = false;
		armorModel.bipedLeftLeg.showModel = false;

		armorModel.isSneak = entityLiving.isSneaking();
		armorModel.isRiding = entityLiving.isRiding();
		armorModel.isChild = entityLiving.isChild();

		if (entityLiving instanceof EntityPlayer) {
			armorModel.aimedBow = ((EntityPlayer) entityLiving)
					.getItemInUseDuration() > 2;
			armorModel.heldItemRight = ((EntityPlayer) entityLiving)
					.getCurrentEquippedItem() != null ? 1 : 0;
		}
	}
	return armorModel;
}

 

I get this:

 

 

wklkqv.png

 

 

bipedHead.showModel = true is the only way i can see my model, but i still get the biped head rendered.

Also, the model looks f***d up, almost nothing like what i modeled, but thats another problem.

Link to comment
Share on other sites

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.