Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

  • Author

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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.